View Full Version : Multiple particle meshes in one birth event

09 September 2008, 07:21 PM
Hello all, quick question-

I'm using Pflow to place tree objects over a terrain, and it works great except for the fact that I am having to make a different birth event per different tree object. (for trees, bushes, etc) The problem I'm having is avoidance, I do not want overlapping objects anywhere, and different birth events have completely different distribution settings that aren't related.

Is there a way to distribute different mesh objects on terrain in one birth event so they never overlap? (or some other means of acheiving this)

P.S. I am just using standard Pflow in Max 9.

09 September 2008, 07:44 PM
Take all of your objects but one that you want scattered and link them to the last one... then select the last one (the parent) in your shape instance, and check "object and children"

09 September 2008, 01:11 AM
Excellent, thank you, but let me go a step further with this:

I'm also using bobo's script to bake out the mesh objects to geometry. My problem now is that bobo's script bakes out all the different mesh objects wonderfully, but they are all named the same and have random color materials assigned to them. In the end, I will need to be able to select every instance of one of the types of baked meshes. Selecting the different meshes by hand is not feasable since I have thousands of instances. I cannot select by material since they are all randomly colored, and I can't select by name since they all have the same name. I do not seem to be able to 'turn off' or 'hide' any meshes as it messes up the distribution in Pflow and I need it to stay consistent.

The only option I can think of is selecting by vert or face count on bobo's baked meshes but I do not know a way of doing this. Any ideas?

09 September 2008, 03:50 AM
You'd have to do some scripting for it to work that way... What'd I'd suggest is maybe using the particles as placement only, by using bobo's script here:

-Change $SphereGizmo* to $objectname* (make your trees have a similar name, and duplicate the trees to as many trees as you have particles)

-delete the line My_Athmospheric_Gizmos_01[i].radius = 10 + pCont.ParticleAge*2

This should do good enough for you. I'd change the script a little bit, but it should do ya fine.

Good Luck!

09 September 2008, 06:11 AM
The only option I can think of is selecting by vert or face count on bobo's baked meshes but I do not know a way of doing this. Any ideas?

That is actually how I have done this in the past. Good thinking!
Assuming that each of your source meshes has a slightly different vertex or face count, you could easily select all objects with the same count using a single line of code.

Let's assume you have selected one representative object of the baked ones and want to select all other objects that have exactly the same number of vertices.

Just execute this:

select (for o in geometry where (try(o.numverts == selection[1].numverts)catch(false)) collect o)

In plain English, it means: "For every geometry object, try to compare its number of vertices to the number of vertices of the first selected object and if the two are the same, collect the object. Then select all collected ones".

You can do the same with both vertices and faces, the .numfaces property returns the number of faces.

The try()catch() is there to guard against objects that are not meshes and have no valid .numverts property, for example geometry primitives, camera and light target objects etc.

Since my script generates an Editable Mesh for each particle, the above expressions should work for your baked stuff.

09 September 2008, 08:14 PM

Thank you bobo and the others for your input, this workflow is exactly what I needed.

CGTalk Moderation
09 September 2008, 08:14 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.