PDA

View Full Version : emitting from surface vertex, with normal speed


daddyo
02-03-2011, 10:28 PM
I'm trying to emit particles from a NURBS surface's vertex points, to emit out either with positive or negative speed along normal. The intent is to use a plane or 'ribbon' mesh to emit particles in a grid pattern from either side of the mesh. The grid look would be achieved by emitting from the vertices on the mesh. This will give me the visual control I need to layout a grid that will give the desired look with my camera move into this field of particles...

I pick my surface to 'emit from object' and if you select 'omni' or 'directional' as emitter type, particles only emit from the surface vertices as needed. Great, BUT, there is no attribute for normal velocity, and I need them to move out from the surface normal direction, either positively or negatively (so that they emit on both sides of the surface. If I set my emitter type as surface, I get the normal speed component, and I could figure out an expression to give the particle a normaVelocity PP component so that they emit and move in either direction. But now, they emit at random parts of the surface and I don't get that grid effect I need.

Any suggestions on what to do? I was thinking making the emitter type directional and somehow creating a velocityPP expression to set that veloicty along the normal. I guess I need to sample the normal at each emitting vertex, assign a velocity value that is either positive or negative (50% chance) and then use that as a velocity vector for my particle? Thing is I don't know the expressions to make any of this happen... I know there's someone out there who can make minced meat out of this simple problem :)

gmask
02-03-2011, 11:05 PM
add this to the particle expression

float $normal[]=`polyNormalPerVertex -q -xyz pPlaneShape1.vtx[id%121]`;
particleShape1.velocity=<<$normal[0],$normal[1],$normal[2]>>;

Note that id%121 is specific to the number of verts in the surface you are emitting from..( if you have 0-120 verts in this case) since the particle id usually matches the vert it was born from until there are more particles than verts so you use the modulus function to restart the count from zero.

daddyo
02-03-2011, 11:34 PM
Hey man!

I plugged your expression velocity attribute as a creation expression... It didn't change anything. Not sure what I'm missing. Also, since velocity is a per particle attribute, I don't need to create a custom attribute called Velocity PP, right?

gmask
02-03-2011, 11:40 PM
velocity by default is per particle..

In my test scene I create a polyplane and put an animated wave deformer on it so that I could see that when new particle are born that they are go in the direction of the normal.

Also remember to edit the %121 part of the expression.. without it particle with id's higher than your vert numbers won't inherit the normal.

daddyo
02-03-2011, 11:45 PM
Warning: Nucleus evaluation skipped, frame change too large //
// Error: No object matches name: ribbonExtrudeShape.vtx[20] //
// Error: An execution error occurred in the creation expression for nParticleShape1. //


Yeah thats what I get... I replaced the 'variables' in your expression with the ones in my scene, but I think you may be working off a poly plane and I from NURBS... Not sure what the error comes from.
Not sure if it still works that way. I'm using NURBS that I extrude along a path, for animation. That way I keep construction history, can rebuild my curves to control the vertex density on my surface, and can use ramps to shade the ribbon later as well (although I guess a duplicate surface could be used for that).

If that sounds confusing I can send you or post the scene, its only a couple mb.

gmask
02-04-2011, 12:15 AM
Warning: Nucleus evaluation skipped, frame change too large //
// Error: No object matches name: ribbonExtrudeShape.vtx[20] //
// Error: An execution error occurred in the creation expression for nParticleShape1. //


Well the name of the command does have poly in the name.. you're probably going to have to convert the ribbon to polys in order to do this easily.

daddyo
02-04-2011, 02:12 AM
Yeah, thanks for the help man... The NURBS thing may be an issue, I am going to work out the shader stuff first to see if I can extrude as polys.

CGTalk Moderation
02-04-2011, 02:12 AM
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.