Jump to content

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:



this does not:

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



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

very nasty :(


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


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
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.

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...