Frame-rate dependent effects/timing

psonice's picture

Anybody happen to know of a good way of mixing time and frame rate dependent effects? I'm thinking of stuff like the feedback composition I did here: http://kineme.net/Discussion/GeneralDiscussion/flatshading#comment-4172

The issue: the particle effect is animated by time, i.e. if the frame rate slows down, the particles move at the same speed but get jerky. The feedback effect is animated per frame, so if the frame rate slows down the animation slows down too. You can see in that composition, that the 'zoom speed' will change when the effect changes.

For comparison, the original composition: http://kineme.net/files/feedback.qtz (plays fine in safari) and a quartz crystal capture:

So, any suggestions on how to make the two effects work together better? I think it's the frame-rate dependent stuff that needs to change, so that the speed can stay constant.. is there a way to measure the frame time somehow? Perhaps with javascript? Then adjust the zoom amount per frame based on that.. but I think there would be a 1 frame lag, which could look nasty..

gtoledo3's picture
Maybe you could hook the

Maybe you could hook the whole thing up to external time base, and use timelines to drive it? Just a thought... don't know if it would come off in practice.

I think the feedback in "frame sample" (for lack of a better term) render works depending on how much other stuff your computer is "doing". I dunno... I'd be interested if anyone has any ideas as well.

kristopf's picture
measuring frame time is

measuring frame time is easy! I've even built a Interpolation patch on steroids with JS in quartz.

var lastTime=0;
function (__number FrameTime) main (__number PatchTime)
{
   var result = new Object();
   result.FrameTime = PatchTime - lastTime;
   lastTime = 0 + PatchTime; //have to add zero or QC stores this as a refrence
 
   return result;
}

You could force this to execute last by adding another input port to the javascript patch and plugging in the last image in your filter chain (or the last one before feedback)

gtoledo3's picture
This probably belongs back

This probably belongs back where you originally posted it, but I would love to see "pop art" type images attached to the particle system... smiley faces, logo's, cartoon dialogue bubbles, etc... it would fit with your filter approach I think.

psonice's picture
Now the hard part..

Thanks, I'll give it a go when I get some time (too busy to catch up with anything lately!).

The challenge will be getting from a known frame duration to stable zoom speed/distortion though.. The zoom effect works by making the feedback frame x% bigger than the original image, so actually if it takes 2x longer to create the frame it should just be 2x% bigger.. but I'm using a sprite and moving it on Z to achieve the effect, so it's not linear. And to add some distortion I'm rotating the sprite in 3d.. some experimenting is required to see what works I think.

Well, worst case it'll improve it a lot :)

psonice's picture
Modify at will

Feel free to change it however you want. I'd love to see some remixes :) Actually, it's probably better to discuss it here, and derail the other thread a bit less.

Btw, the particle system was based on your wreath thing, just to get some kind of action going :) I'll use the feedback effect for something a bit more interesting at some point, with better effects and perhaps my 'videoball' effect in the centre. I've attached a pic of another quick effect test, doing the traditional 'black and white stripes' feedback (managed to get it running without strobing \o/ )

PreviewAttachmentSize
feedbackpic.jpg
feedbackpic.jpg122.01 KB

gtoledo3's picture
That is so cool! Man, I

That is so cool!

Man, I wish that this feedback could be built into GL Read Pixels or something... and we could pop these patches on a macro level. I think that is probably a kite dream though.

QC Painting/Doodling :o) This is so simple, yet I am enamored by it.

This was me trying to get some apple logo/turtle like stuff going :o)

psonice's picture
painting

Nice stuff. How is that second one done, doesn't look freehand :)

I'm making a paint app partly based on QC.. it's endlessly fun just messing around with it. Although I've got huge problems with tablet input.. QC seems to have some kind of serious lag with tablets (or perhaps it's just my bamboo one, anyone else tried it?) The pen works but very badly, and it seems that when you stop drawing QC still thinks the button is down for a few more seconds. Impossible to draw with :(

Speaking of impossible, I also did a quick app a while back called impossipaint.. it's simple black + white painting, with feedback like yours, but the feedback is animated like in my QC composition above. So as you paint, the canvas is rotating, zooming in and out, the paint blurs.. It's in 3d too with a displacement map. Totally impossible to paint with :D I tried to do a screenshot, but by the time I switch to grab and press the right buttons the paint has gone off the edge of the screen.. is there a faster way to screenshot?

gtoledo3's picture
Yeah, go to the developer

Yeah, go to the developer folder and build the movie exporter plug in, and link it up to your image chain. It will suck for you if your images are being made by layering billboards or sprites. It can get hairy trying to get that to transfer... you may wind up putting everything inside of an additional render or do some kind of blend mode or something. Haven't crossed that bridge yet (and actually never have because Quartz Crystal came along right around when I was getting irritated with that issue and rendering filtered video that involved stacked sprites).

Then you could just take a screengrab of your movie, or export image, or whatever. The caveat about the movie exporter is that it will suck with many of the codecs, and you probably should keep your render area kind of small, and probably don't use anything besides medium quality. The default setting, mp4, medium quality, is probably the most consistently useable. With a feedback comp, the other codecs will actually screw up the way that the feedback renders, because it makes the computer groan a little more... smooth lines get "dotty".

I don't know how quick you fingered you are, but you might also just try clicking the render in image off... if that applies to your scenario. It usually "locks" the image output to whatever it was when you disable it. Then you could take your screengrab?

You could also attempt value historian, and replay in Quartz Crystal. That's probably the least "direct" way of achieving a simple screengrab.

What you are describing with impossipaint sounds really cool... the 3D/displacement map thing- I would love to see it!

It's funny you say that about the tablet... I use the same one, and did the second clip with it, freehand.

Joking.

The autodraw thing is lfo's and interpolation.

psonice's picture
Feedback sphere

Simple animated feedback, plus spherical distortion.

Next up, mixing this effect with live video + motion detection.

mitchellcraig's picture
just a little note following

just a little note following the comment on video you posted there... could you maybe post how (if successful) you manage to mix the feedback sphere with motion detection? I am really struggling to create some sort of motion detection patch....Effectively all i need is an IF statement in the form of a QC patch; if there is movement in the frame (of the camera lens - DV cam as video input) then apply my custom effect, IF NOT continue to capture live video without applying my effect to it. Im pretty new to QC and currently this is beyond me!

Thanks

gtoledo3's picture
arrrgh, lol...

So, I guess neither of the examples I posted regarding the "psychotic" you were asking about punched your button? On your system, do they not work?

Remember that there actually ALWAYS is motion, even if you are trying to keep completely still. So then it becomes a matter of defining the threshold.

mitchellcraig's picture
yeh i couldnt get your

yeh i couldnt get your patches to work properly so i kind of gave up on that! Sorry, but thanks for your help. I have moved on to another project that i am working on, this time involving sensory input to QC - a whole new kettle of fish for me to explore! Expect a question in another forum soon...!