Jump to content
freaq

ramp from HOM

Recommended Posts

trying to control a randomness by a ramp parameter
 
so an artist can control what spawns more often and less
my idea is to take the curve, integrate it (or via numpy .cumsum())
and then index that value. 
 
but apparantly this is not so easy in houdini,
some pointers anyone?
 
 
 
ps: also weird:

when storing a ramp as a variable the ramp cannot be adressed:

 

this works:

hou.parm('/obj/lot1/distribution2').eval().lookup(0.7)

 

this does not:

dist = hou.parm('/obj/lot1/distribution2').eval()

dist.lookup(0.3)

 

which makes it very inconveniant to do things like integrate etc.

very nasty :(

 

Share this post


Link to post
Share on other sites

not really sure what exactly you are doing and if you really need to integrate the samples as that is usually not necessary for common ramp defined distribution control, but

dist = hou.parm('/obj/lot1/distribution2').eval()

dist.lookup(0.3)

works for me, you can as well try .evalAsRamp() if that makes any difference

 

here is the full integration example, seems to work fine

import numpy
parm = hou.parm('/obj/lot1/distribution2')
ramp = parm.evalAsRamp() # even though parm.eval() works as well


nsamples = 10
samples = [ramp.lookup(s/(nsamples-1.0)) for s in range(nsamples)]
integratedsamples = list(numpy.cumsum(samples))


print "ramp raw samples  : %s" %samples
print "integrated samples: %s" %integratedsamples
Edited by anim

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

×