Jump to content
Sign in to follow this  
Sourabh

Increment value by one on every frame

Recommended Posts

Hello

I want to increment value by one on every frame after frame no, x (for example 50 frame no.). I tried doing this in wrangle its not working. it stay at one after frame 50.. Its like houdini is reading this script independent on every frame.

Its working in solver node actually but i want to know any other way on sop level.

i tried this ..

if(@Frame>50)

i@a+=1;

Please share with me if you have any way out.

Thank you

 

Edited by Sourabh

Share this post


Link to post
Share on other sites

Here is another way 

int myFrame = chi("startframe");

if(@Frame >= myFrame){
    i@a = floor(@Frame - myFrame);
}

Share this post


Link to post
Share on other sites
On 12/24/2016 at 8:00 PM, Sourabh said:

Its like houdini is reading this script independent on every frame.

Exactly. You need some sort of simulation context (DOPs, SOP Solver, etc.) if you want to keep data from one frame to the next. But really, a lot of things don't need a simulation context, and then you gain the advantage that you can render your frames out of order.

Share this post


Link to post
Share on other sites

Thanks all for reply

Both ways are working but my situation was different that i didn't describe properly.I want to increment by one on every frame but for different point number on different frame. Like if random points are turning red on different frame number so increment should start from that frame number for that particular point.

I solve this using wrangle in solver node. I want to know any other way also .

 

Share this post


Link to post
Share on other sites

What if you use your points to initialize particles then @age would be the value you want. When a particle is born, it's age is 0.0 then it increments over time from it's random starting time.

Edited by Atom

Share this post


Link to post
Share on other sites
On 12/30/2016 at 2:24 AM, Sourabh said:

I want to increment by one on every frame but for different point number on different frame. Like if random points are turning red on different frame number so increment should start from that frame number for that particular point.

This still doesn't require a solver context. Your start frame for the given point just becomes a rand() expression (based on the point number) which you then use as an offset on the current frame number.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×