PRT Surface (or any PRT) Position on Geo Vertices

I’m trying to take a PRT Surface in this instance and only position them onto a selected geometry’s vertices. For example, when using Frost and selecting a mesh as a source and then Geometry as a mesh type, you will see that it chooses the selected geo’s vertices for position. I am trying to do exactly what Frost is doing in that case, but with a PRT.

Basically choosing the vertiex positions and count then pipe that through Magma. I tried a Mesh Query and Vertex ID, but it put it at what I’m guessing was the first vertex ID. I’m sort of stuck on how to select all Vertex ID’s at once. I’m still coming to grips with Magma, but even the small stuff is making my life easier :slight_smile:

Thanks guys!

The PRT Surface was made for quick random distribution on meshes, but you can do what you asked for using Magma. You can use either the PRT Surface or the PRT Maker to produce a specific particle count.

Here is the theory:
*Create more particles than there are vertices in the mesh. E.g. if the mesh has 1000 vertices, make more than 1000 particles.
*Drop a Magma modifier on the PRT object
*Create an Output Position. Use InputGeometry to get the mesh, and use the VertexQuery operator to read vertex data. Leave the ObjIndex at 0 and pipe in Index InputChannel as the Index. So each particle will go to the corresponding vertex, if any. Connect the Position output of the VertexQuery to the Position output and convert FromWorld, and the first N particles (where N is equal to the Vertex Count) will be distributed on the mesh, the rest will stay at 0,0,0.
*Now you need to delete the excess particles - create a MeshQuery operator, pipe in the same InputGeometry, and test whether the Index inputChannl value is GreaterOrEqual to the VertexCount value. (Index is 0-based, so the last particle will have 1 less than the count).
*Create an output channel set to Selection and output the result of the GreaterOrEqual to it.
*Drop a Krakatoa Delete modifier on the stack and the particles that did not have corresponding vertices will be deleted.
*Now you need to check the Vertex Selection to also delete the particles that ended up on unselected vertices.
*Simply add the Selection channel to the list of output sockets in the VertexQuery, and compare that value using Equal to 0.0. Insert a LogicalOr behind the existing GreaterOrEqual node and pipe in the result of the Equal operator to it. So now the particles will be selected and deleted if they have no vertices, or if the Vertex Selection is 0. (Soft-selection that is slightly more than 0.0 will be assumed selected. You can change the test to NotEqual to 1.0 if you want solf-selection below 1 to be considered unselected).

The attached MAX 2012 file has this implemented using a PRT Surface and a Teapot with some selected vertices.
KMX2_PRTM_ParticleToSelVertex_2012_v002.zip

You can go even farther by adding the Normal and TextureCoord/Mapping channels of the VertexQuery operator and output their results as Normal or TextureCoord so the particles will carry even more mesh information in their channels. You could use the Normal to orient meshes in Frost for example.
Here is a screenshot of the advanced setup with Normals and Frost, feel free to implement it yourself. I also used the PRTViewportVector channel to display the particles as lines, showing the scaled Normals…
KMX2_PRTM_ParticleToSelVertex_2012_v002.zip (16.1 KB)

Thanks Bobo, I’ll give this a try. I’m actually thrilled because I’ve been using Magma more and more each day and I’m loving it. I’m just trying to get used to the way it works. I’m using it to do A LOT of tasks at Pixomondo that are saving me tons of time. It’s automated so much for me because once I set everything up, it’s pretty much just reloading in a cache and everything just runs.

I had some spare time today to figure out something regarding the question I asked you. Because I couldn’t figure out what it was I asked, I just used a Pflow setup to birth the number of particles at the vertices. My goal was to not use anything but Krakatoa’s tools and Frost. Besides the Pflow setup, everything else was done using strictly nothing but Krakatoa.

Once I get some spare time, probably tonight, I will render out what I made and post it to vimeo and then I’ll re-visit this and post it. Again, thanks for the help! :smiley: