Jump to content
Atom

[SOLVED]A Pulse With Decay?

Recommended Posts

Hi All,

I am looking for a python or Houdini function that will give me a pulse to 1.0 with a decay every so many frames. So it would kind of be like a modulus integrated with a decay. Does anyone know how to code something like this?

A typical output might look like this...

0.0 0.0 0.0 0.0 0.0 1.0 0.8 0.6 0.4 0.2 0.0 0.0 0.0 0.0

 

Edited by Atom

Share this post


Link to post
Share on other sites

Why not just write your own? Give it a couple of parameters like start frame, decay amount/time, maybe add a type like linear/quadratic etc. Or you could use SciPy.

Share this post


Link to post
Share on other sites

My goal is control the eye blink on a character.

The ramp is an interesting idea, but I still need to feed it a lookup value between 0.0 and 1.0 which needs to be the percentage along the modulus of the blink rate in frames.

node = hou.pwd()
geo = node.geometry()

my_ramp = node.parm("ramp").eval()
n = my_ramp.lookup(0.5)
print n

 

 

 

Share this post


Link to post
Share on other sites

I guess with a little fixup I think this kind of approach works and I can still use the ramp for shaping the decay of the eye blink.

node = hou.pwd()
geo = node.geometry()

def returnFramesPastLastModulus(current_frame, current_modulus):
    cf = current_frame
    while(cf > current_modulus): cf -=current_modulus
    return cf
    
frame_current = hou.frame()    
blink_rate = 120    #Blink every 120 frames.

f = returnFramesPastLastModulus(frame_current, blink_rate)
v = float(f)/float(blink_rate)
my_ramp = node.parm("ramp").eval()
n = my_ramp.lookup(v)
print n

Thanks for the insight.

Edited by Atom

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

×