Hi
I am trying to write a simple python routine to test out couple things. I have done this in other apps, mostly at object level but I want to be able to it in mesh level in Houdini.
This is the very basic version that does not work.(Python SOP is at the end of cooking chain).
I also tried grabbing values via attribcreateSOP(vector point) from a TimeshiftSOP(with $F-1) in the Python code as well, but again that did not work either.
I know this is not easy to do in the Vex code well in the SOP level but I was hoping that I could do it with Python. I know I can use Particles etc, but I am just trying some ideas so I would like to make this basic premise work in SOP level.
So the code works, but the dispersing dos not work. They just jiggle. Ideally the points of the geometry should do basic random walk(it is aliased now due to using the same random number)
Any suggestions?
import random,math
PI=3.14
geo = hou.pwd().geometry()
inputPoints = geo.points()
nPoints = len( inputPoints )
scaler=1
random.seed(hou.frame())
for n in geo.points():
x,y,z=n.position()
randang=random.random()*PI*2
randang_X=math.sin(randang)/100
randang_Z=math.cos(randang)/100
x=x+randang_X
z=z+randang_Z
y=y+random.random()*scaler
n.setPosition()
Random dispersing of points with Python SOP test
3168 1 1- kursad
- Member
- 88 posts
- Joined: March 2010
- Offline
- kursad
- Member
- 88 posts
- Joined: March 2010
- Offline
I ended up implementing this in PythonSOP with file caching
You can see the result here
http://vimeo.com/20006556 [vimeo.com]
You can see the result here
http://vimeo.com/20006556 [vimeo.com]
-
- Quick Links