Previous Topic (None) Up (Contents) Next Topic (File PFlow Operators)

Krakatoa Options

  Available in: Krakatoa v1.0.0 and higher

The Krakatoa Options operator can be used to transfer data from the scripted float channel and the scripted vector channels into the density and color channels respectively. This effectively allows for scripted control of the shading of Krakatoa particles.

  • Add a Script Operator to the flow.
  • Enable the scripted float in the on ChannelsUsed event handler by: pCont.useFloat = true
  • Enable the scripted vector in the on ChannelsUsed event handler by: pCont.useVector = true
  • In the on Proceed event handler, set the particle's scripted float values using pCont.particleFloat = X
  • In the on Proceed event handler, set the particle's scripted vector values using pCont.particleVector = [X,Y,Z]
  • Add a Krakatoa Options operator in the event.
  • Select MXSFloat->Density to scale the particle's density channel by the value in that particle's scripted float channel.
  • Select MXSVector->Vertex Color to set the particle's vertex color channel to the value in that particle's scripted vector channel.

You can also get the same effects using the Data Operator supplied by Orbaz Technologies as component of the PFlow Toolbox #3. This is the recommended approach because it is orders of magnitude faster than running a script to fill in the data in the Scripted Float and/or Scripted Vector channels. When using a Data Operator, it is more efficient to write directly into the Vertex Color channel than to use the Scripted Vector channel. In that case, the Krakatoa Options Operator is not necessary or the option MXSVector->Vertex Color should at least be unchecked. When writing to the Density channel which is not a native Particle Flow channel, you still have to use the Data Operator to write to the Scripted Float channel and use Krakatoa Options with MXSFloat->Density checked to copy the data for Krakatoa to see.

IMPORTANT!: Remember to disable any material operators if you are intending to render the colors stored in the Vertex Color channel directly.

The material is the ultimate color source in Krakatoa, followed by the vertex color channel, then by the node's wireframe color (ie. the Display Operator).

If you do use a material, the colors from the Vertex Color channel can be accessed within the material by adding a Vertex Color Map (Channel 0) to the diffuse map channel. This requires each particle to evaluate the material in the shading context which is a lot slower than writing the Vertex Color data directly into the Krakatoa Color channel. On the other hand, you can use the Vertex Color Map in combination with other Maps to blend the particle colors of multiple sources, so the Material approach, while slower, is a lot more flexible.