Jump to content

Understanding Clamp Expression


cspears2002

Recommended Posts

I am going through the particle shockwave tutorial in Houdini. In the tutorial, I create a Source POP called shockwave_emitter_source. In the Birth tab, I put the following expression in the Impulse Activation parameter:

((clamp($F, 2, 3*20+20/2)%20)<=1)

What is this expression doing? Why did the author use 3*20+20/2 ? Couldn't the same result be achieved by replacing that with 70?

particle_shockwave.hipnc

Link to comment
Share on other sites

I am going through the particle shockwave tutorial in Houdini. In the tutorial, I create a Source POP called shockwave_emitter_source. In the Birth tab, I put the following expression in the Impulse Activation parameter:

((clamp($F, 2, 3*20+20/2)%20)<=1)

What is this expression doing? Why did the author use 3*20+20/2 ? Couldn't the same result be achieved by replacing that with 70?

From the help:

A clamp function clamps the value between min and max.

The input value is cut off if going over max and limited if falling below min.

I guess the 3*20+20/2 is the process of finding an appropriate value.

As there is no variable in this term you could easily replace it.

-- ---

This didn't explain the expression, though:

the clamp turn the current frame number into a number beweteen 2 and 70.

the '%20' applies the modulus operation resultung in a number between 0 and 19.

the '<=1' is a boolean term that results in a 1 if the expression so far is below or equal 0. The rest of the time it returns 0.

->

every 20th frame there is a burst of paricles, but only after frame 1 and before frame 70.

-- ---

Georg

Edited by rdg
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...