How do I get ShapeIndex from Pflow to Frost


#1

How can I get ShapeIndex channel directly from Pflow to Frost? Is it even possible?

I tried using a data op Birth Index->Standard Output MXS Integer, added a KCM to Frost (pretty sure I can’t do this) Input MSX Integer->Output Custom ShapeIndex, it didn’t work.

Bobo mentioned something briefly here, I guess I didn’t fully understand.
viewtopic.php?f=67&t=4793&hilit=ShapeIndex&start=10#p19572


#2

It would be possible to hack something using Box #3 or Script Operators, but it will require a bit of creativity.
As far as I know, PFlow does not have a native channel to tell you what shape is assigned to a particle. What is has is a Shape channel that contains the TriMesh of the particle.
The ShapeIndex channel in Frost defines which item from the list of Geometry Objects to assign to the particle. So you need to somehow figure out what shape was assigned in PFlow and create an Integer channel with the corresponding values.

Here is an example:
Let’s say that you have created a PFlow that uses a Shape Instance operator where a group of 3 shapes is loaded and each particle gets a random shape from the group - let’s say you have a Cone with 146 vertices, a Teapot with 530 vertices and a Torus with 288 vertices.
*Create a Data Operator and wire the following:
**Take an Input Standard subop and set to to Shape, # Vertices.
**Send the output to a Condition subop set to Integer Equal To 530.
**Create an Output Standard set to Script Integer with a Scalar Integer set to 1 as input and the Condition wired to its on/off connection.
**Copy the 3 subops and change the condition to 530 and the Scalar to 2, then copy again and change the numbers of 288 and 3 respectively.

Now save this PFlow to PRT and include the MXSInteger as output channel (together with Position, Velocity, ID, Age and Orientation, if you want)

*Create a PRT Loader and get the particles back. Turn off the PFlow.
*Drop a KCM on the PRT Loader and set the Input to MXSInteger and the Output to ShapeIndex of type Int16[1].
FROST_ShapeIndex_Example_KCM.png

*Create a Frost out of the PRT Loader.
*Change the Radius to 1.0
*Switch to Geometry meshing mode
*Switch to Custom Geometry
*Open the Group with the three shapes and pick the Cone, Teapot and Torus (in that order)
*Switch to Use ShapeIndex Channel
*Change Orientation to “Use Orientation Channel” (assuming you saved it)

You should get a Frost that looks EXACTLY like the PFlow:


#3

Aha ok, thanks, so at least I was on the write track. So if/when krakatoa gets a PRT Pflow it is not possible to keep it dynamic. I really like the approach you used :sunglasses: super easy way to identify a particle shape, by verts. That would work nicely for different crab shapes!


#4

very useful maybe should go in the frost tutorial section


#5

I added a new Knowledge Base sub-forum and moved the thread from Beta to Public.
That should do it…