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

How can I do this in Magic?

Post by Reigel »

Please have a look at that: https://www.youtube.com/watch?v=-X0oDRnqRD8
I would very much like to have means for things like that. This is done in Quartz-Composer and played through VDMX. I for sure do not want to switch to that setup but I am very impressed by the power of clowds of animated dots and lines. I saw a performance by these guys last night and it was tremendous. They did a version of that piece: https://www.youtube.com/watch?v=-X0oDRnqRD8. But it looked quite different this time. Seems to be very open.

Any idea how to do that is welcome.

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

Re: How can I do this in Magic?

Post by artnik »

I also love that look! I've been doing some experimenting over the past few months and have hacked a couple of ISFs that echo that look, or make it possible.

The circular and square extrusions bits could be done with this ISF (VideoHeightfield++): https://www.interactiveshaderformat.com/sketches/1748 (You would use a grid texture for one of the inputs, then something to drive the extrusion on the other).

Another option for something similar is the LIDAR ISF: https://www.interactiveshaderformat.com/sketches/1024

But the line and dot 3D stuff would take custom code to do realtime, or could be done pre-rendered in a 3D app if it doesn't need to be reactive. I've not seen any pre-rolled solutions that would do that in MMV so far. If it's a plugin for Quartz, there may be a route if it's also supported in MMV.
Reigel
Posts: 81
Joined: Sun Mar 15, 2015 9:56 am

Re: How can I do this in Magic?

Post by Reigel »

Thanks for that thoughts and hints.
I talked to that guy and what I know for sure is that there is no 3D-whatsoever involved. It is just points and lines which are moved around in realtime - and all this runs very smooth. There was no chance to talk in depth with him. So that is all I know so far. I do not know Quartz at all. I will try to understand whats it all about. But it seems to be a very different approach.
The LIDAR does some similar impression as far as bumping is involved. So I will play around with that and see what it can do for me.

Thanks so far
Reinhard
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: How can I do this in Magic?

Post by artnik »

Wow, that's a stunning effect for just 2D lines and points. Interested to hear more if you make any progress.

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

Re: How can I do this in Magic?

Post by artnik »

Hey Reinhard,

I did some research and found this piece on Shadertoy that was reworkable: https://www.shadertoy.com/view/Xd2XWR

I've taken the time to port it over to ISF with modifications and have annotated it to make it clear how it works. For convenience I've set up the demo to use variables for line width and dot size to show you where the variables would get referenced in the code: https://www.interactiveshaderformat.com/sketches/1752

There's function calls within the code that are clearly labelled for drawing lines, circles and filled circles, as well as a generalized rotation function. The original coder Daniel Burke did a fantastic job, and it's a good base to build upon. Hopefully my annotations make it easier to understand.

All function calls include the ability to specify a unique origin point, which I've re-jigged to be centred on the screen and Cartesian (i.e. Up/right of center is positive, and down/left of center is negative.

Good luck with your project. As I said before, this effect will require some coding, but this should give you a head start.

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

Re: How can I do this in Magic?

Post by artnik »

I did some more work on this last night. For circular layouts and effects I think it will be easier to specify geometry in Polar Coordinates. There's new functions in the ISF now to accommodate that. Commands that are specified in polar coordinates are labelled with the suffix "Rad"

So, now this will allow you to build animated objects with these functions with the specified arguments:

rot (origin, angle)
line (origin, point1, point2)
lineRad (origin, angle, radius, angle2, radius2)
circle (origin, radius)
circleRad (origin, angle, radius, circleradius)
circleFill (origin, radius)
circleFillRad ((origin, angle, radius, circleradius)
barbell (origin, point1, point2, pointsize)
barbellRad (origin, angle, radius, angle2, radius2, pointsize)

Origin and points are vec2; angle, radius, circle radius are float. Coordinates are normalized.

Once again, mad props to Daniel Burke for the original code. If you're not interested in specifying stuff within the ISF code, it should be trivial to break each function out into an individual ISF to work directly within MMV.
Reigel
Posts: 81
Joined: Sun Mar 15, 2015 9:56 am

Re: How can I do this in Magic?

Post by Reigel »

Hi Nik,
thanks a lot for Your interest and work. But I am afraid I am not deep enough into writing and programming ISFs on my own. I will try to get deeper into that. But as now I am only a user of what I see on the surface of Magic. Here I think I am very much at home. But this may be not sufficient.
So it is up to me to learn how to write shaders.

But anyway I found already some very promising results in combination with some of the shaders You did, especiall Video Heightfield+. Video Heightfield++ doesn not work here.

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

Re: How can I do this in Magic?

Post by artnik »

Hey Reinhard,

I've only tested VideoHeightField++ on V2 versions of Magic, but it should work on 1.65. Which version are you using?

BTW VideoHeightField++ takes two inputs, one for the height and one for the colour. (VideoHeightField+ only takes one for both).

Editing ISF shaders is a lot of fun if you choose to explore it. I'm not at the point yet where I can write them from scratch, but I found it didn't take too long to learn how they work enough to tweak them, or bend them to do things they weren't originally written to do. Most of the time, simply adding in some controls for the variables can make something generically useful where it was specific before. Good luck!

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

Re: How can I do this in Magic?

Post by Reigel »

Aaah! I did not see the second input. So this makes a difference of course - a big one. BTW I am on 2.01b2.

Yeah, I will find some time to recap my math - is some 40 years ago. But I am curious to look inside.

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

Re: How can I do this in Magic?

Post by artnik »

Hey Reinhard,

I took a moment to pull out the BarbellRad function from that ISF and give it a full suite of controls you can work with in Magic without having to do any coding.

It works with Polar Coordinates as input. Basically, the endpoints of the line are specified as an angle (from 0 - 1), and the distance from centre as the radii.

With DotSize at 0 it's just a 2D line, and with anything else the endpoints are drawn.

https://www.interactiveshaderformat.com/sketches/1763

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 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