# Are there interpolation functions to be used in expressions in Houdini

## Recommended Posts

I am looking for a way to get different interpolation so from 0 to 1, instead of values increasing linearly with time, I want to get interpolated values such as this one:

Basically any value from 0 to 1 like:

easein(0.2) * value

##### Share on other sites

Located in channel editor, screen right bottom.

Is this what you are asking ?

##### Share on other sites

Thanks, no I am asking about a possible function to use inside an expression, so I can get a interpolation like the above image.

I will provide values between 0 and 1 to this function, and use the result as a multiplier.

##### Share on other sites

Thanks, no I am asking about a possible function to use inside an expression, so I can get a interpolation like the above image.

I will provide values between 0 and 1 to this function, and use the result as a multiplier.

The good old gamma is easy, newvalue = oldvalue ^ (1/gamma)

So, just raise your value to some power until it feels right

• 1

##### Share on other sites

+1 eetu

You may try out :

pow(fit(\$F,\$FSTART,\$FEND,0,1),log(0.3)/log(0.6))

I am not sure if the channel segment functions like easein easeout, etc. are available outside but you could always create an attribute with the desired interpolation between a time step and access it wherever you want.

also there is smooth() function take a look at that too.

smooth(fit(\$F,1,100,0,1),0,1)

Edited by vectorblur

##### Share on other sites

http://www.sidefx.com/docs/houdini11.1/expressions/_globals

Not sure if that helps...but interesting....

It seems you are wanting a look-up value, I often create a spare channel and lay down 2 keys 1 @ 0 and 1 @ 100, then get the curve to look just like I want. then use a chf() expression where frame is input value * 100

chf(curve_channel,value*100)

woops, double post...

Edited by 3dbeing

##### Share on other sites

For fun

x= fit(\$F,1,100,0,1)

y = 1-sqrt(1-pow(x,2))

interpolation.hipnc

##### Share on other sites

Thanks guys, I will have to check your examples, but I found what I needed.

Basically however a value is increasing, I want to multiply it with a certain interpolation curve based on normalized time.

So I will try creating my own expression functions and use them like:

backEase:

f(t) = t³ – t * a * sin(t * π)

backEase(\$LIFE)

But of course having a set of functions that can be used like this would be super useful, but also clearer as you don't have to untangle these formulas each time you see them in numeric fields.

##### Share on other sites

You can create your own expression functions in the alias and variables window

another option is writing it in python and using the hou.session module, or creating your own module.

Edited by 3dbeing

##### Share on other sites

Thanks 3dbeing, I read that one, that's why I am quite happy that Houdini allows custom expressions. I will use hscript for shortness sake though.

One thing I was wondering which doesn't seem possible is, can I have my custom expressions always loaded by Houdini? I think I would want them readily available in every session just like my custom OPs.

##### Share on other sites

One thing I was wondering which doesn't seem possible is, can I have my custom expressions always loaded by Houdini? I think I would want them readily available in every session just like my custom OPs.

look at the exread expression and put it in your 123 file, if it's .py then use the hou.hscript() as I don't think there is python equivalent...

I haven't used it so i'm not 100% sure how it works...

##### Share on other sites

look at the exread expression and put it in your 123 file, if it's .py then use the hou.hscript() as I don't think there is python equivalent...

I haven't used it so i'm not 100% sure how it works...

Man that's awesome. Will try it after I write some expression functions.

Thanks.

## Create an account

Register a new account