Page 1 of 1

Possible to Write 2DScene files that expose parameters?

Posted: Tue Jul 22, 2014 2:25 pm
by craftycurate
I'm wondering if it's possible to expose parameters from 2D Scenes files so they can be animated in Magic using sound, MIDI or other parameters?

e.g. if I have a function with an x parameter which draws a curve, could x be made available to Magic and linked to Volume?

I notice that 2DScenes files have a Speed and X,Y parameter, but the X & Y Params don't seem to affect the output in many cases. Is Magic set up to receive parameters from 2DScenes files?

Thanks
Richard

Re: Possible to Write 2DScene files that expose parameters?

Posted: Tue Jul 22, 2014 3:51 pm
by Magic
Some of the 2DScenes files don't connect to the X and Y parameters, but some of them do. For example, the default file (default.glslf) does connect. It all depends on how the file was written by the original author.

If you want to try your hand at editing one of the files (which requires some knowledge of GLSL programming), you can make the X and Y parameters connect to any part of the file. I'd start with looking at the default file and trying to modify some variables to get an idea.
e.g. if I have a function with an x parameter which draws a curve, could x be made available to Magic and linked to Volume?
The answer, quite simply, is "yes". If you know enough about GLSL to be able to write a basic program that draws a curve, you could expose one of the program's variables as the X parameter, and then you could use Magic to link audio or MIDI to it.

The bottom line is that when the X or Y parameters are connected, they can be linked to audio or MIDI just like any other parameters. Check out the sample project "2DScenesExample" for an example of this.

This is a bit of a complicated topic so maybe I'll do a tutorial about it :).

Re: Possible to Write 2DScene files that expose parameters?

Posted: Tue Jul 22, 2014 4:41 pm
by Magic
Ok, you inspired me, so I put this together quickly:
http://magicmusicvisuals.com/forums/vie ... p?f=3&t=86

:)

Re: Possible to Write 2DScene files that expose parameters?

Posted: Tue Jul 22, 2014 5:20 pm
by craftycurate
Nice one! So do mouse.x and mouse.y correspond to Param X and Param Y?

Re: Possible to Write 2DScene files that expose parameters?

Posted: Tue Jul 22, 2014 5:43 pm
by Magic
Yup, exactly.