Previous topicNext topic

How can I do this in Magic?

Questions, comments, feedback, etc.
Post Reply
Reigel
Posts: 81
Joined: Sun Mar 15, 2015 9:56 am

Re: How can I do this in Magic?

Post by Reigel »

Hi Nik,
GREAT! Many thanks for Your fast work. This opens lot of inspiration. I already did some research with this module.
What I will try - provided I find into ISF programming that fast - is give not only polar coordinates for the points but also x/y. For some movements this seems to be more convenient to me. In fact both of them have their strength.
Another thing is that I would not limit rotation to 1 but rather unlimited. It is more fun to just rotate and never come to a stop.

I will let You know when I have some good results.

Best
Reinhard
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: How can I do this in Magic?

Post by artnik »

It has to have a range. 0-1 is pretty standard. You can use modifiers to achieve limitless rotation. e.g. for constant rotation use RAMP instead of INCREASE, or apply a WRAP modifier to your stack.

The core function is actually based on X and Y aready. If you look at the ISF code you will see two variables a and b that are vec2's. If you add float inputs for x and y coordinates, change those two lines to build the vec2's you'll be golden. Inputs are defined at the top, so you can copy and paste the syntax for the other float variables. I'd do it, but am not at home right now.

If you run into trouble, give me a holler. Happy to help you get your start. But the badass feeling you'll get if you do it is worth it. :D

Cheers, nik
Reigel
Posts: 81
Joined: Sun Mar 15, 2015 9:56 am

Re: How can I do this in Magic?

Post by Reigel »

Hi
as to rotation: I tried modifiers but could not exceed 1. Since I will do rotation also by hand via MIDI-controller ramp and wrap does not help here. But I can live with that. I do not have much time left these days. Will be better in summer - or autumn. This year...

Cheers
Reinhard
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: How can I do this in Magic?

Post by artnik »

Well, the ISF format requires inputs to have a range. Magic's approach is to try to standardize that from 0-1, with the understanding that a modifier stack can be built to normalize any input to a 0-1 range.

The rotation issue is always workable, and isn't limited by stopping at 1. i.e. 7.5 full rotations is still really just .5 rotations when you get right down to it. ☺

So, if your midi device outputs values from 0-127, just put a scale modifier in your stack with a decimal value equal to 1/127 and problem is solved.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: How can I do this in Magic?

Post by Magic »

Just a quick note -- ISF doesn't necessarily require MIN or MAX values. If they aren't specified for a particular parameter, the parameter will be unbounded.

Also, Magic automatically scales MIDI values to [0, 1]. You shouldn't need to manually scale by 1/127. If you want the value to be greater than 1, you can add a Scale modifier.
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: How can I do this in Magic?

Post by artnik »

Thanks Eric! I did not know that. I thought that a range was required. I guess this is a never-ending learning experience. :-)

EDIT: I tend to edit shaders over at http://www.interactiveshaderformat.com, and if you don't supply a MIN & MAX then the input sliders default to 0-1 regardless, making it awkward to test values outside that range. If you specify large number to simulate an unbound range, then it becomes difficult to test reliably because of limited resolution on the slider, unless you add another scaling term into the mix. Swings and roundabouts. :-)

Reinhard,

I've uploaded an XY version of Barbell here: https://www.interactiveshaderformat.com/sketches/1765

I also added a ROTATE function to have the maximum flexibility when designing effects.

I've made some design decisions based on how I would use it, (limiting ROTATE once again from 0-1), but based on Eric's input, you can remove the Min & Max values if they don't suit you.

The controls should be fairly self-explanatory, with the exception of the SCALE parameter. I've set that up so that with the default value of 0.5, the bounds on X and Y inputs should map to the edges of the screen. If you want the points to be able to extend past that, then increase the SCALE.

Cheers,
nik
Post Reply