freaq Posted June 5, 2015 Share Posted June 5, 2015 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 Quote Link to comment Share on other sites More sharing options...
anim Posted June 7, 2015 Share Posted June 7, 2015 (edited) 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 June 7, 2015 by anim 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.