art3mis Posted May 7, 2017 Share Posted May 7, 2017 Trying to learn VEX. Using the following simple formula in a wrangle to create random green color values on geometry @Cd = 0; @Cd.g = rand(@ptnum); Lets say I want different random values at frame 120 and I want the values to smoothly interpolate between frame 1 and 120. How would I do this? Quote Link to comment Share on other sites More sharing options...
symek Posted May 7, 2017 Share Posted May 7, 2017 This is what noise functions were designed for: http://www.sidefx.com/docs/houdini/vex/random They are also available in VOPs (look in Tab menu under "Patterns" category). Noise function smoothly interpolates both in space domain and time domain (pseudo)random values. Quote Link to comment Share on other sites More sharing options...
rich_lord Posted May 8, 2017 Share Posted May 8, 2017 Unless I'm misunderstanding your question, you could also do this. It will interpolate between two green values over the frame range 1-120 // create first random value float value1 = rand(@ptnum); // create second random value float value2 = rand(@ptnum + 325); // interpolate between thoose two values over the frame range float current_value = fit(@Frame, 1, 120, value1, value2); // set that to the current colour @Cd = set(0, current_value, 0); Quote Link to comment Share on other sites More sharing options...
art3mis Posted May 8, 2017 Author Share Posted May 8, 2017 Szymon, thanks. I wasn't aware of this! Wow, very powerful Thanks Richard. Got it. So essentially using frame value to drive interpolation. How might you use time value to accomplish the same thing? Quote Link to comment Share on other sites More sharing options...
rich_lord Posted May 8, 2017 Share Posted May 8, 2017 @Time is the current time in seconds. So @Frame = @Time * 24. If your frame rate is set to 24frames per second. Therefore they are pretty interchangeable, and accomplish the same thing. Personally I always use @Frame and would only use @Time for sub frame stuff, which I never really need. Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 25, 2017 Share Posted May 25, 2017 (edited) Btw as you have mentioned "smooth", this VEX function came to my mind:http://www.sidefx.com/docs/houdini/vex/functions/smooth As it says: - smooth (easin and easeout) interpolation is computed - If a rolloff is specified, the inflection point of the blend will be shifted. Once I wanted just ease-in (no ease-out), Python has it (http://www.sidefx.com/docs/houdini/hom/hou/ease) but VEX probably doesn't. I have quite solved it with VEX and that biased rolloff. Edited May 25, 2017 by ikoon edit: btw Jim, I think that you will like chops, try Matt Estela's intro to chops Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.