(HDK) Attribute's Incremental Increase Animation

   2934   1   0
User Avatar
Member
325 posts
Joined: July 2005
Offline
Hi, folks,

I think I have done that before, but I can’t recreate this at the moment: I need to incrementally increase a point attribute every frame, i.e. the attributes value of the previous frame must be added up with the current frame, on and on (for example to increase the color from black to white during animation). Here’s the pseudo code:

FOR_ALL_GPOINTS(gdp,ppt)
{
Attr = ppt->attr_index_name(my_attr);
*Attr += 0.1f;
}

What happens so far is my custom node cooks, the Attr’s value is increased by 0.1f, however when play button is hit – the Attr’s value doesn’t change further – looks like either the node is not re-cooked or my code/approach is wrong. Or is it possible at all?

Can you give me a hint?

Thanks.
I liked the Mustang
User Avatar
Staff
5154 posts
Joined: July 2005
Offline
You can check if your node isn't cooking by using the performance monitor. If it isn't, make sure you are making the node time dependent (by calling flags().setTimeDep(true)).

Make sure you're also grabbing the input from the previous cooktime (context.myTime - 1.0f / fps). You'll probably need a Start Frame parameter, so you can clamp the adjusted cook time so that the node doesn't try to cook the geometry at start-1 on the first frame (then again, maybe not, I'm not sure exactly what you're doing).
  • Quick Links