View Full Version : Pflow particles on a surface
01-30-2009, 10:38 AM
Hi, I've just tried and I don't know if this is actually possible or not yet. But I'm trying to get particles to stay on an animated mesh while moving slowly around on the surface sort of randomly while avoiding each other to some degree. I know how to get them to stick to the surface, it's the moving around and sticking on the surface as they do it thing that I haven't got yet.
I also need them to follow the surface rotationaly so the top of the particle which will be an object instance faces out of the surface.
Anyone got any tips?
01-30-2009, 11:02 AM
Lock&Bond operator in PFlow toolbox #1 does this. (Comes with max 2009 subscription)
01-30-2009, 11:19 AM
I was also going to point to lock/bond, just remember you need to check the option restrict to surface and reduce the force to let them move on the surface.
02-03-2009, 09:42 AM
You can also use speed by surface but from what I have read and seen ( no box 1 yet :( ) lock bond is a much better operator for this kind of effect.
02-03-2009, 10:17 AM
And if you want them to avoid each other try using the keep apart, and set the radius to a desired amount. I'm not sure if keep apart will retain particles attachment to surface?
03-17-2009, 02:51 PM
I realize this is a little late, but I thought I could help. For those without Box #1 or Box#3, I wrote a script operator that can align the particles to an animated surface and keep them on the surface while moving around and avoiding eachother. I set up a simple PFlow with:
Birth: 300 particles at frame 0
Position Object: Placed them all on the surface of my object
Shape Instance: I used teapots for the particles
Script Operator: I explain this below
Keep Apart: I used high amount of force (5000), but with limit on the speed (3.0) and acceleration (200.0). Also, I set it to use particle size (100% core, 200% falloff 0% variation). This keeps them apart without influencing the motion too much
Force: I used a wind force with 0.0 speed, 1.0 turbulence and 0.1 for scale and frequency. 100% influence in the PFlow operator. This makes the particles swish around the surface.
That's all it needs. The script operator requires two objects: The first is the surface that you will be placing the particles on. This must be named theSurface and it must be an Editable Mesh. Otherwise the code will break. Also, there needs to be a second object (of any type) named theLookAtObject, which will keep the particles from spinning wildly around the surface normals of theSurface. Simply copy the code below into a Script Operator and it should work.
on ChannelsUsed pCont do
pCont.usePosition = true
pCont.useSpeed = true
pCont.useTM = true
on Init pCont do
on Proceed pCont do
theSurface = $theSurface
theLooker = $theLookAtObject
count = pCont.NumParticles()
IPM = MeshProjIntersect()
IPM.IntersectRay [0,0,0] [0,0,1]
for i in 1 to count do
pCont.particleIndex = i
theCurrentSpeed = pCont.particleSpeed
theCurrentPosition = pCont.particlePosition
theClosestFaceChk = IPM.ClosestFace theCurrentPosition
theClosestFaceIndex = IPM.getHitFace() + 1
theClosestPoint = IPM.GetHitPos()
theClosestBary = IPM.GetHitBary()
theVertNormals = meshOp.getFaceRNormals theSurface theClosestFaceIndex
theCurrentNormal = normalize ((theVertNormals*theClosestBary.x + theVertNormals*theClosestBary.y + theVertNormals*theClosestBary.z))
LookAtDirection = normalize (theSurface.pivot - theLooker.pivot)
q = dot theCurrentNormal LookAtDirection
LookAtDirection = normalize (LookAtDirection - q*theCurrentNormal)
sideDir = cross theCurrentNormal LookAtDirection
theCurrentTM = matrix3 -sideDir LookAtDirection theCurrentNormal theClosestPoint
pCont.particleTM = theCurrentTM
theCurrentSpeed += pCont.randDivergeVector theCurrentSpeed 15
pCont.particlePosition = theClosestPoint + theCurrentSpeed
on Release pCont do
03-17-2009, 02:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.