help with iterators (or ?)

jersmi's picture

QC 101 for some, but I need some help. Here i'm trying to use iterators, but maybe there's a better solution using kineme particle tools or ??? Any advice is welcome.

For the sake of learning, let's say I want random images falling from the sky, with physics (speed, resistance, wind, etc.) like raindrops, snowflakes, stones, cats and dogs, etc. each image would have a slightly different mask shape (not rectangular). i can get working a basic iterator patch with a sprite falling from the top, with random X values so each time it falls from a different place. after that:

  1. how can i randomly select the image for each iteration from a folder of images? i have a slideshow qtz using folder images patch and structure indexes loading to image loader. can i use a slideshow setup like this to get the iterator to call a random image for each iteration?

  2. how do i overlap iterations and control the params, ie, so i can increase / decrease density like the particle generator? maybe nested iterators?

  3. how can i randomly select a mask from either a folder of images, or maybe down the road, create a geometric shape mask with some random deform properties?

  4. how can i make the falling images start to interact with a surface, like raindrops hitting the street or something?

i realize there might be some helpful apple tutorials in the dev folder, or some other helpful tutorials out there, but i can't quite put it together as of yet.

Thanks ahead of time for any help.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
1-4

1) use the index to seed a PRNG -- there are numerous examples of this on the mailinglist. You REALLY REALLY DON'T WANT TO USE THE IMAGE DOWNLOADER IN AN ITERATOR (it doesn't work).

2) nested is the way to go (performance will suffer).

3) see #1.

4) code stuff in JS. performance will suffer. There's an example compo with AudioTools that has a sphere bouncing off of sprites -- this is essentially how you'd do it (w/o using particletools to do the physics for you).

jersmi's picture
thanks again

very helpful. that's 2 "performance will suffer" comments... oh, well. see what shakes. :)

cwright's picture
definitely

if you're able, please post some results from this experiment -- we're looking at incorporating more physics into PT/K3D in the coming months, so knowing where natural bottlenecks are can help us focus more appropriately on the most narrow ones.

I'm also considering making a Directory->Image Structure patch (loads images, makes a structure of images, so no downloader is necessary) -- this would help with the image picking portion. If anyone else is interested in this, please let me know, and I'll start getting started on it.

toneburst's picture
Sounds Good

I like the sound of that. I mean the folder-with-images > image structure idea (the indenting makes it look like I was talking about something else).

a|x

jersmi's picture
man, yes

yes to the folder images patch. i do quite a bit of stuff with this and folder movies. besides that (re: #4), i'm not a programmer, so the javascript suggestion is far across the hills.

gtoledo3's picture
Chris, If you did that,

Chris,

If you did that, could it be possible to use a "picture structure" to feed a kineme3D multi-obj/iterator setup, so that you could arrange images to come out on the correct "pieces" of the 3D structure?

cwright's picture
yes

As long as each piece was properly texture-coordinated, yes.

(in fact, you can already do that, it's just tricky to make image structures using javascript, and it tends to exhaust system memory rather quickly)

gtoledo3's picture
"Word".... makes sense. I

"Word".... makes sense. I remember trying something like this with the spotlight patch, and getting it working, but it was super lame on performance. I was hoping that this could lead to something less kludgy. On some real basic tests back with the alpha 9 stuff, I remember that it seemed more efficient to just use multiple renderers, each with their own image inputs, and just do it all manually.... I like the idea that this will set the structure automagically.

usefuldesign.au's picture
Folder -> Image Structure

Anything that can take a folder of Images and place in a structure at beginning of comp running word be super useful to me. It effectively means an automatic linked image updater also (which QC lacks for connivence of working with source images that are getting edits) even if the structure has just 1 element.

From memory I adapted the QuartzTV example in Developer Examples Folder with my own images ages ago and it involved some Javascript and lots of stop/start patching which I'ld be uncomfortable attempting on my own.

jersmi's picture
thanks-- good to remember "manual" techniques

really useful to point out that doing things manually can sometimes be the answer, especially for someone like me who is not a coder. lots of "old school" techniques to tap into, for ex., lfos and interpolators and cleverness can achieve a lot. i tend to get befuddled cuz i think everything is supposed to operate automagically... man, i know i'm at a disadvantage here without the coding skills... but i'm looking closely at everyone's work, tinkering, changing numbers-- it might be sinking in little by little. :)

kineme rocks!

jersmi's picture
test-- glitchy

i was excited to get this simple patch to work: SpritesFalling.qtz ...except it doesn't yet. almost. going to fullscreen and back simply does not work. feel like there's something i don't get about the accumulator? maybe it's how i have the switching setup to replace content? any help? if anyone has a look, a sprite is supposed to fall from the top of the viewer and "stick" just above the bottom edge.

chadu's picture
Re: definitely

Did you ever make a Image Structure Patch, just curious.

smokris's picture
Re: definitely

No, we never made Image Structure Patch, but I created this clip which might be useful --- http://kineme.net/composition/smokris/FileListImageStructure