Jump to content

[SOLVED]A Pulse With Decay?


Atom

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
Link to comment
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

 

 

 

Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...