PDA

View Full Version : Count node

Limbus
03-30-2010, 09:50 AM
Hi,
I am looking for a way to add the ouptut values of node to a variable and use that variable value later on.

I have a distance node that outputs the (doh) distance of an object between frame n and n-1. Now I want to add up those numbers.

It sounds like Poms Counter Node would do this but it only outputs 0. Maybe it does not work in the displacement node editor.

Any help on how this could be resolved would be appreciated.

Cheers, Florian

Lightwolf
03-30-2010, 10:09 AM
How do you want to add them up, and what do you mean by later on?

Cheers,
Mike

Limbus
03-30-2010, 10:14 AM
How do you want to add them up, and what do you mean by later on?

Hi Mike,
I basically want the value to increase as long as the null object moves so I can drive the rotation of an object via the Part move node with it.

If I just use the distance, the object rotates ahead and back but I only want it to rotate ahead. That why I need the number to increase.

So I basically want a way to calculate the distance traveled by the null.

Cheers, Florian

Lightwolf
03-30-2010, 10:28 AM
So I basically want a way to calculate the distance traveled by the null.

Bingo, gotcha. Hm, I can't think of a simple way.
You might be able to use relativity to drive another null by the distance travelled of your null, then use the relativity nulls position in your set-up.
Not pretty, but it ought to work as displacements get evaluated after motions.

Edit: "might" as in: I think Relativity has a function for that, but I don't remember using it myself.

Cheers,
Mike

Limbus
03-30-2010, 10:34 AM
Sounds like the typical LW hack way of doing things ;-)

Thanks, I'll check that out. Guess I could just hand animate the rotation instead but thats no fun.

Cheers, Florian

Sensei
03-31-2010, 06:20 AM
You know of course that things like that won't work on renderfarm? Not even when you press F9.. You must use full image sequence F10, to render it correctly, each time..

serge
03-31-2010, 07:25 AM
I'm not sure, and Dpont might be gone for a while, but maybe Mike, Sensei or somebody else could say if Dpont's "Motion Info" node might help, it has a "Use parent" option. Check out this post: link (http://www.newtek.com/forums/showpost.php?p=1000120&postcount=27).

(Mind you, it's the latest update of the plugin, and Dpont's website is not available right now.)

Lightwolf
03-31-2010, 07:32 AM
I'm not sure, and Dpont might be gone for a while, but maybe Mike, Sensei or somebody else could say if Dpont's "Motion Info" node might help, it has a "Use parent" option. Check out this post: link (http://www.newtek.com/forums/showpost.php?p=1000120&postcount=27).

(Mind you, it's the latest update of the plugin, and Dpont's website is not available right now.)
Not by the looks of it, it only computes the speed, not the distance travelled.

Basically (beware, pseudo code!):

speed (per frame) = current position - position at previous frame
speed (per second) = current position - position one second ago

Distance travelled would be:

distance = 0
for every frame from the current to the first
distance = distance + (current position - position at previous frame)

Which can be quite slow to compute at later frames in the animation.

Cheers,
Mike

probiner
03-31-2010, 07:45 AM
Or... you can try this... :D

http://i153.photobucket.com/albums/s202/animatics/Foruns/count-node.png

serge
03-31-2010, 09:42 AM
Ah, now I get it, duh. LOL :)

Thanks for the info Mike!

Reading Limbus's post again, he says:

"I basically want the value to increase as long as the null object moves ...".

To get info for whether or not the null object moves is simple: use two of Dpont's Item Info nodes (with time input), of which one has a time delay of 1 frame (time input = -0.0333). Plug the position outputs into a Logic node which says: A is equal to B, if True 0, if False 1.0. Now you have an output of 1.0 if the null object is moving.
But this is where I get stuck. The object (part) needs to rotate every frame based on this info, but it needs to rotate on top of the rotation of the previous frame.

Sensei
03-31-2010, 09:47 AM
To get info for whether or not the null object moves is simple: use two of Dpont's Item Info nodes (with time input), of which one has a time delay of 1 frame (time input = -0.0333).

dpont
03-31-2010, 10:57 AM
...So I basically want a way to calculate the distance traveled by the null.

If your Null has keyed motion,
the Distance output of Motion Info node
does it, if you don't apply expressions to
the NULL, there's also an option to store
this motion, this avoids recalculation for
each frame.

Denis.

Captain Obvious
03-31-2010, 01:37 PM
And then deleting two thirds of your images and reducing the subdivision level to one, because it only runs in 32-bit mode. ;)

serge
03-31-2010, 03:39 PM
Thanks Sensei. :thumbsup:

If your Null has keyed motion,
the Distance output of Motion Info node
does it, if you don't apply expressions to
the NULL, there's also an option to store
this motion, this avoids recalculation for
each frame.

Denis.
Thanks Denis! :)

Yeah this works. In case of this nodal setup (see attachment), the parts will rotate in pitch direction, based on the distance the null (Motion Info) has covered.

Limbus
04-15-2010, 02:33 AM
Thanks Denis. I just found this node and it works as advertised.

If your Null has keyed motion,
the Distance output of Motion Info node
does it, if you don't apply expressions to
the NULL, there's also an option to store
this motion, this avoids recalculation for
each frame.

Hieron
06-14-2010, 04:13 PM
Afaik Worley has a plugin "Drive" or something in his pack that rotates wheels based on total distance covered. Gets real slow with long scenes though... not sure if it works with LWSN.

Does the Motion Info node work well with lwsn?

Sensei
06-14-2010, 04:19 PM
Such plug-ins always should be baked before using on renderfarm..

dpont
06-14-2010, 11:59 PM
...Does the Motion Info node work well with lwsn?

Easy to test, yes it works,
for long scene, path reference can't
be stored at the first frame to avoid
useless re-calculations.

Denis.