View Full Version : even distribution of particles on NURBS surface!
08-06-2006, 07:20 AM
Is there a way to evenly distribute partcles onto a nurbs surface using goal U and goal V. I want to creat an emitter that shoots out 100 particles and arranges them as the particle grid tool would. Right now all I know is goalU= rand (0,1), goalV= rand (0,1), but obviously that will arrange them randomly. What function would I use to space them out evenly? Reason I don't just use particle grid is I need these particles to be able to be influenced by fields while still holding an attraction to the UV coordinates.
08-06-2006, 08:43 PM
First you can create an empty group (in my example it's called "null") and add two integer attributes to it: numU and numV. They will define how many particles will be positioned along U and V respectively. And then assign the following creation expression to your particles:
goalU = (particleId % null.numU) / (null.numU-1);
goalV = floor(particleId / null.numU) / (null.numV-1);
That should work I think :)
08-07-2006, 05:34 AM
Genious Meald. Genius. You have reduced my stress level significantly!
08-08-2006, 01:27 AM
Here's a harder one, Meald. Your method works great for a plane, but what if I wanted a sphere? I cannot get an even distribution of particles on a sphere because more particles get crowded at the poles. Is there a way to evenly distribute them? Your help is greatly appreciated!
08-08-2006, 07:09 PM
The easiest way I could think of was to convert your object to polygons, use the resulting polygonal object as a goal (remember that you can hide it and still render your original NURBS geometry). And then play with UVs to get the desired result.
08-08-2006, 09:15 PM
Ya, but the problem with having a polygonal object as my goal would be that I wanted to be able to have the particles be instanced with geometry, and I wanted to have those geometry to aim in the right direction, per particle, based on the surface's normals. So basically I wanted all the evenly spaced particles to have to be instancing geometry that can aim in the direction of the normal, but I don't know how. The reason I wanted to go with NURBS was because I remember their being a way where I could use the pointOnSurface command to return normalizednormal for goalU and goalV on a per particle basis. If you know of a way to do goal onto vertices of a polygonal object and have the aimdirection for each particle work with the normals then that would just be the solution to all my problems.
08-09-2006, 11:21 PM
I think that the easiest way to achieve this is to use Maya's surface sampler to bake normal map to the color channel and then use colorAtPoint MEL command to get normal direction at specified UV coordinates. This command works with texture nodes so geometry type doesn't really matter.
There are though a few restrictions:
1. If you want to modify UVs after you've baked normals you will have to rebake them so that they will reflect topology changes relative to UV coordinates.
2. And of course you won't be able to animate the shape of your goal object. Though in this case you can have one normal map per frame and create animated texture.
3. You will need to bake normals in object space for this method to work. Thus if you want to be able to rotate your goal object with particles on it you will need to take its rotations into account in your particle expressions (which will slow down perfomance and may be a big pain in the a** if you have complex hierarchy).
08-10-2006, 03:50 PM
Just a quick hint, don't know if it suit your needs though.
To get the normal of the emitting surface you can emit the particles with only a normal speed set in the emitter and then in a creation expression you store the velocity ( wich is equal to the normal ) in a custom PP attribute.
Then you set the velocity back to 0 or something else... and voila.
08-10-2006, 03:50 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-2014, Jelsoft Enterprises Ltd.