Which patches to use for a composition?

fhill2's picture

Hello. Could any, more experienced, QC user help out on an issue i'm having please?

I'm trying to make a composition that consists of a lot of constantly flowing straight lines that sharply change direction at a specified rate. The camera follows just behind the animated lines, moving with the changes of the constant flowing lines..

I've used nearly all of Kineme's tools before (at a very beginner level) and seen there are a few ways to make animated lines. What patches would allow me to create this in the easiest way possible?

Right now i'm working with a GL line structure and Structure Maker to render the lines instead of trying to do it with Particle Tools. I'm going to add a GL Camera to try and do the camera movement. The only thing i have no idea how to do is how to make the line go straight and then change direction at a specified time. I have attached the composition below.

Flowing Straight Lines Try.qtz2.99 KB

usefuldesign.au's picture
Re: Which patches to use for a composition?

That's a pretty poor way to draw a 6 px wide line isn't it. On Leopard at least you can see a ton of jaggies at each segment join. The corners with that patch are pretty rubbish too. I recommend Kineme's 2D tools although expect to take a speed hit.

I think it would be better to draw continuous segments from one corner to the next, totally only 10 or 20 segments. The leading co-ordinate would need to be smoothed after the queue patch to get that working nicely.

Have a go and see if you can modify this composition to do that.

Flowing Straight Lines Good-Try.qtz7.67 KB

fhill2's picture
Re: Which patches to use for a composition?

Yes, i know i agree with you. Very poor! That's why i'm asking here for some help. Thanks for re-doing the composition for me, it helped me understand a lot.

Just to verify, the random patches give the 'Structure Maker' patch X and Y inputs a pixel value in the composition. What i'm having trouble visualising is what the queue patch does to the X and Y structures coming out of the Structure patch to render the line.

Also, do you mind explaining why you added the expression patch there please?

I can see it needs to be there for a reason more than just letting you know the patch time and increment. I can't get a grasp on it.

jersmi's picture
Re: Which patches to use for a composition?

As well as usefuldesign's example (cool feedback patch time!), Have a look at George Toledo's GT Lines comp and toneburst's Random Walk.

usefuldesign.au's picture
Re: Which patches to use for a composition?

From the commented comp posted below:

These just are there to do one thing only. Provide a patchtime that jumps at a certain increment.

The increment depends on A) the period of the LFO patch, that how often this sequence of patches will 'Fire' b/c only when the square wave is on it's up spike will the Pulse patch output a "1" value since it's set to trigger on "leading edges only".

On a frame when the Pulse is outputting "1" the math exquation is resolves to:
Result = increment * pulse + pt
Result = 1 * 1 + pt
Result = 1 + 0 (the first time pulse 'fires')
Result = 1
Result = 1 + 1 (the secoind time pulse 'fires')
Result = 2
Result = 3, 4, 5,… (on subsequent 'firings')

Also I didn't mention that I changed the Random patches to External Patchtime. If you don't know how to do this, it's in the Apple QC docs and they are compulsory reading I'm afraid. You Ctrl-Click on the Patch and select "External Patchtime" This allows us to freeze the random values, jump to new ones then freeze them again.

I could have just fired any number in there as long as it kept changing but sending an incrementing number allow so of the purlain noise to do it's thing. Actually fiddling with increment and LFO period didn't seem to change much (except for not keeping up with the smooth patch outputs if you're not careful).

The other thiing I did in settings inspector was to change Queue patch from 'continuous sampling' to 'only when values change'. This means or line segments are corner to corner not 'frame to frame' long as determined by leading edge of line values.

Hint to do the last step so corner to corner drawing really occurs (at the moment if you inspect the structure by hovering over Queue Patch output you will see all the values are constantly changing):

Feed unsmoothed values to a Queue Patch then grab the front edge (using smoothed values this time) and replace the top item in the queue structure (Index: 0).

Load Queue with

Flowing Straight Lines Good-Try_Keep_Going.qtz32.94 KB

usefuldesign.au's picture
Re: Which patches to use for a composition?

Cheers, love my maths expression patch — it does almost everything I want in QC outside of a rendering patch ;-) Those two other comps are excellent learning material. I 2nd that.

usefuldesign.au's picture
Re: Which patches to use for a composition?

One side effect of this method is that short distances between corners mean slow line drawing and long distances mean fast line drawing.

To keep an even speed would require some maths to control pulse interval according to distance to travel or a new approach. There's always a bunch of ways to do something in QC — even/especially quite simple things.

fhill2's picture
Re: Which patches to use for a composition?

Thanks a lot for that info about the math patch. I see why you used it now.

I had a look at toneburst's work and all of it is VERY impressive indeed. I like the work he has done here: http://vimeo.com/5074355

On another similar one of his video's toneburst states he used the GL line structure to create the lines like the composition you sent me.

His lines being rendered are a lot bigger than the one's in the composition you sent. How did he achieve that size without degrading the quality, as when i change the "line width" on the GL line structure patch the line becomes jagged and awful, and if i insert the structure maker into a GL camera and adjust the Z position it doesn't seem to get zoomed in. When i put the line structure into a 3d transformation it scales but the lines don't get any bigger. How would you go about making the lines bigger so their pixel width is larger, but they still don't get jagged?

Also, just to verify something with the queue patch on the basic level. I don't know why but i can't seem to get a grasp on what the queue patch does to make the lines render. I see if i remove it they don't render anymore. What does the queue patch do to the incoming X, Y (and/orZ) co-ords going into the GL Line Structure patch to make them render?

usefuldesign.au's picture
Re: Which patches to use for a composition?

I've actually already told you how to get smoother lines out of the GL Line Structure patch. I'll answer this again and your second question about the Queue patch in one answer.

The GL Line Structure patch draws lines between a structure of 3D co-ordinates, either continuously joining one to the next in series, or by joining odd-even pairs of co-ordinates into discontinuous line segments. You choose by setting the relevant input.

At the moment you are using continuos joining. The Queue patch makes a structure. It has two modes of operation for adding elements to the array it outputs, continuous and only when input changes (you change this in settings inspector). In you comp the input is always changing, so in either mode, it will have this stream of points and that's what's making your lines jaggy, they aren't single lines from corner to corner, they a heaps of very short lines in the same direction making your long, corner to corner line.

So you need to set the Queue to only when input changes for a start so you can not get a new array element every frame. Then you need to feed the co-ordinates pre-smooth patch so the array is just made up of point to point.

Yet you want a smooth leading 'point' to your lines and the Queue now will just have stepping lines including the most recent randomly generated point… what to do? There's many ways to fix this up, depending on how you define the problem you'll probably go for a different solution.

Easiest way I can think of is remove the most recent point from the array, since it's actually ahead of the leading edge, but you still need to keep it in your Queue structure for when it's behind the leading edge.

You can see how I did it in this comp. I'm not doing any more of you homework, especially when I rarely get even 'verbal' help for mine on this site. :-)

You'll have to do the last bit but I've given instructions in the file. good luck and you can only learn by trying things out that don't always work.

usefuldesign.au's picture
Re: Which patches to use for a composition?

Round Corners using GL Point Structure.