PDA

View Full Version : Expressions Based On Speed Not Working?



B_Free
10-21-2009, 03:44 PM
:cursin: :compbeati :cursin: :bangwall: :cursin:

I apologize, the above has been my day so far. :o

I'm trying to animate a typical field of stars with a handheld camera motion. I'm using Photorealistic Motion Blur, but I don't want the stars to disappear. (I know that's what they should be doing, I just don't want them to.)

I thought about trying to manually brighten the stars every time my camera moves, but I decided to try something more masochistic...

I tried writing an Expression that would control the Stars' Intensity channel based on the Speed of the Camera's Rotation. (I'm getting my hand-held look by subtly rotating the Camera's Heading and Pitch.)

First I tried using Expression Builder to make what I need. However, when I select the "Speed(Description)" from the drop down menu, it says
"* The speed function will need to be created by hand in the Graph Editor due to a current limitation in the expression builder"

Does this mean that you can't base any channel off an object's speed at all? or just that there's no pre-built expression for it? :question:

I tried writing an expression for the speed of my camera's rotation, here's what I applied to my stars' intensity channel:

(sqrt( (([Camera.Rotation.H,Time+0.5]-[Camera.Rotation.H,Time - 0.5])*([Camera.Rotation.H,Time+0.5]-[Camera.Rotation.H,Time - 0.5]) )+( ([Camera.Rotation.P,Time+0.5]-[Camera.Rotation.P,Time - 0.5])*([Camera.Rotation.P,Time+0.5]-[Camera.Rotation.P,Time - 0.5])) ))

It's really just a formula to compute the distance the camera rotates between -0.5 seconds and 0.5 seconds of the current time. I treat H & P like Cartesian X & Y axis... I find how far the camera has moved along each vector (H & P), and then use the Pythagorean Therom to find the hypotenuse of the movement vectors with the result being the distance traveled.

Since speed = distance/time... if I have the distance traveled over 1 second, the forumla becomes distance/1 which is just the distance.

Anyway, when I plugged that expression in the resulting graph made no sense. Somehow it was giving me values in 5000 range, and my camera wasn't rotating anywhere near that fast.

Am I doing something wrong or is this expression just not currently feasible?
Many Many Thanks in Advance!!! :thumbsup:

B_Free
10-21-2009, 05:28 PM
:foreheads

I think I finally figured out what the problem was... I was using "Time" + or - 0.5 in each channel reference... and time is measured in seconds.

Therefore when I wrote "Time + 0.5" that meant that Expression was using that channel's value 15 frames in the future (0.5 seconds), rather than that channe's value half a frame in the future.

When I used the expression given above, but replaced "Time" with "Frame" it seems to work! :)

Apologies for answering my own post, but I thought I'd share the answer just in case anyone else experiences something similar.

Cheers!