AWS Thinkbox Discussion Forums

Banking particles in frost

Hello, so I was trying to bank these bees using frost as I was having difficulty, doing that in pflow.

So I set the the Orientation to vector channel , and set it to use the use velocity . It all works well for my test cylinder but when i use the bees they are coming in face down as seen on the right side of the image. I have checked that the pivots are aligned properly but it seems that its changing to Y up rather than Z when I use the orientation set to velocity.

Thanks!
beeflipped.jpg

Create a standard PFlow, replace the Shape with Shape Instance and switch the Rotate op to Speed Space Follow. Create a Teapot and pick it as the shape. In PFlow, a Shape Instance operator assumes that the mesh object’s X axis is the one that should follow the Velocity, so the Teapot points with the Spout in the direction of motion.

Now make a Frost, pick the same PFlow, switch Frost Meshing to Geometry, change the Particle Size > Radius to 1.0, switch to Custom Geometry and pick the same Teapot. Set the Orientation to Use Vector Channel > Velocity. Frost assumes that the Z axis of the object should follow the Vector (this is to make it easier to align objects like missiles, cones and cylinders to a Normal).

So if your bee mesh was modeled as shown on the left, and your particle is moving left to right, the right bee would be pointing with the top of its body (+Z axis) along the Velocity. To change this, you would have to apply an XForm modifier to the mesh and rotate the bee to look “up” along the Z axis to produce the desired alignment.

If you would switch the above Frost example to use the Orientation channel, suddenly the Teapots of the Frost will align with the Teapots of the PFlow because the Orientation channel of the PFlow would direct the particles to point with the X axis along the Velocity.

Now if you want to calculate Speed Space Follow using Magma, you will have to save the PFlow to PRT first. Then, to calculate your own Quaternion value for the Orientation,
*Add a Magma to a PRT Loader with the PFlow data.
*Create an Orientation output and plug a Convert>VectorsToQuat operator. It defaults to identity matrix, so if Frost is set to use the PRT Loader and is switched to using Orientation channel, the objects would stay aligned to the world.
*Now plug in the Velocity input channel as the X component. Insert a Vector>Normalize operator to make it unit length.
*Create a Vector Value [0,0,1] and plug it into the third component. This is the UP vector.
*Connect a CrossProduct operator to the second socket and connect the Up vector into the first socket and the normalized Velocity into the second socket. Insert a Normalize after the CrossProduct to ensure the Y axis is also unit length.

At this point, your teapots would move EXACTLY like the Speed Space Follow PFlow Orientation would dictate, using the X axis as the Velocity axis, with the Z axis of the mesh pointing up along the World Z.

Now you need to figure out the Banking. For this, you would have to rotate the UP vector according to the change in the Velocity direction which is the tricky part. The Y axis will also follow since it will always remain perpendicular to the other two based on the CrossProduct… The problem is that there is no easy way to calculate the Banking since Magma cannot peek back in time and find out what the Velocity was a frame earlier (and we need this to understand the curvature of the trajectory). You can either calculate this in a DataOp (but then it would be easier to directly perform the whole calculation there anyway and directly set the Orientation), or you could use a second PRT Loader set to read a frame earlier (but this will only work if the number of particles is not changing over time, or if you look up particles based on distance as you cannot currently look up by ID).

Hope this gives you a push in the right direction… (pun intended)

Thanks Bobo, I was looking for the simple way out but I guess if I want proper banking then i should look into creating a DataOp.

Privacy | Site terms | Cookie preferences