Particle Channels In Krakatoa MX

Applicable to Krakatoa 1.0.0 and higher

Introduction

  • Krakatoa build upon some of the existing data structures in 3ds Max and implements a much more generalized Data Channels system.
  • Some channels like Color or TextureCoord map directly to the existing Vertex Color (Mapping Channel 0) and Mapping Channel 1 3ds Max channels.
  • Other channels like Density are introduced by Krakatoa to describe particle properties needed for volumetric rendering.
  • User-defined channels can also be defined, modified and read from for intermediate data storage, but only a pre-defined number of channels are supported by the Renderer.

In the following topic, we will look at most of these channels, their purpose, their relationship with 3ds Max and Krakatoa and their flow through the scene.

Position Channel

  • The Position channel is a native Krakatoa channel which describes the particle position in 3D Space.
  • It is mapped directly to the Position channel of Legacy 3ds Max particles, Particle Flow and Thinking Particles, as well as vertex positions when converting vertices to particles.
  • When saving a PRT file, the Position channel is always present.
    • Krakatoa does not allow the saving or loading of a PRT file that does not contain a Position channel.
    • Furthermore, the Position channel is currently hard-coded to type float32[3], which means you cannot set its bit depth to 16 bit.
  • The Position channel is saved in World Space by Krakatoa, but is loaded in object space by a PRT Loader (unless the Apply Transforms is unchecked or the PRT Loader is aligned to the world origin).
    • The Object Space Position data flows up the stack through all supported modifiers including Magma and Deformation modifiers, and is then transformed into world space by the node transforms of the PRT object.
  • If a Global Channels Override modifier is applied to the scene, it will see the world space Position data and can modify it at render time also in world space.

Color Channel

  • The Color channel represents the Scatter color of the particle - this is the color that is scattered into the scene after the light hits the particle.
  • It is equivalent to the Diffuse Color of 3ds Max Materials, and is directly mapped to the 3ds Max Vertex Color Channel in both directions.
    • If saved to a PRT sequence, the Color channel will be loaded by a PRT Loader when reading the sequence.
    • If the PRT sequence does not contain a Color channel, the Wireframe Color (Object Color) of the scene node will be used for both viewport display and rendering, unless a Material is assigned.
    • If a Magma modifier is applied to the modifier stack of a PRT Loader and it is set to Input the Color and Output as Color, the wirecolor will NOT be passed through but a default Color value of pure white [1,1,1] will be produced.
    • A PRT Volume object will acquire the Vertex Color Channel of the source mesh if available, or shaow the Object Color of the PRT Volume otherwise.
    • If a Magma modifier is applied to the modifier stack of a PRT Volume and is set to Input the Color and Output as Color, the wirecolor will NOT be paqssed through but the Vertex Color channel will be applied. If it was not set previously, it will result in a value of pure black [0,0,0].
    • A Magma modifier can modify the incoming Color channel or generate a completely new Color data.
    • Once the modifier stack is evaluated, if there is a 3ds Max Material (e.g. Standard Material) assigned to the PRT object, it will override any Color channel data coming up the stack.
      • To accept the incoming Color data, a Vertex Color Map must be added to the Diffuse channel of the Material. Alternatively, a Krakatoa Material can pass through the existing Color channel by unchecking the “Scattering” checkbox.
    • There are two more global override stages beyond that level:
      • The Global Channels Modifiers applied to all particles loaded for rendering can access the Color channel and modify it.
      • Finally, the optional Color Override can replace the color of all particles in the scene with a solid color value or a texture map value.

Density Channel

  • The Density channel is a native Krakatoa channel. It is somewhat similar to the Opacity channel of 3ds Max Materials and defines the contribution of a particle to the volumetric rendering.
  • If a particle is read from a PRT sequence containing an explicit Density channel, it will be passed up the stack as loaded. If the PRT sequence does not contain a Density channel, the particle will be given the default value of 1.0.
  • When particles are generated within a voxel region of a PRT Volume or PRT FumeFX object, it will be assigned a Density value corresponding to the cubic volume of that voxel. For example, if the PRT Volume Spacing is 1.0, this means one particle generated in it will be assigned a Density value of 1.0. If the Spacing is subdivided once into 2x2x2 sub-regions, 8 particles will be generated, each with 1/8 of that Density, of 0.125. If multiple particles are created per region, each will get a respective fraction of the region’s Density, e.g each of 10 particles in a voxel with Spacing of 1.0 with 1 Subdivision will get a Density of 0.0125.
  • After the initial value is calculated, it will be multiplied (scaled) by the value of the Visibility track of the scene node. By defualt, Visibility is 1.0 so the Density is unaffected, but the Visibility track could be set to a lower value or even animated over time to change the Density as needed.
  • The Density can be loaded, modified and set using Magma modifiers on the modifier stack.
  • Once the Material is evaluated, its Opacity channel will be used to multiply the incoming Density. Note that other than the Color channel, the Density is not overwritten but only scaled.
  • As with the Color channel, there are two more global override levels - Global Channels Modifiers and Density Override with a static value or texture map grayscale value.
  • Finally, the Lighting Pass and Final Pass Density controls will scale the incoming Density at render time. Note that these global Density multipliers operate even on the cached particle channels in memory without reloading the particles.

Emission Channel

  • The Emission channel is a native Krakatoa channel similar to the Self-Illumination channel of 3ds Max materials. It describes the color of light emitted by a particle without external lighting source. It is not mapped to any 3ds Max geometry channels.
  • If a PRT sequence contains an explicit Emission channel, it will be loaded from disk, otherwise the channel will not be allocated at all. If the renderer requests an Emission channel but the particle stream does not contain one, the default value of pure black [0,0,0] will be used instead.
  • The Emission channel can be loaded, modified and set by Magma Modifiers on the stack.
  • If a 3ds Max Material is assigned to the PRT object, its Self-Illumination channel will overwrite any Emission data coming up the stack similar to how the Color channel is handled. If the existing Emission data has to be preserved in the material, a Magma modifier must be used to copy the Emission into a Mapping channel and then pass the Mapping channel to the material tree via a Vertex Color Map accessing that same Mapping channel.
  • If a Krakatoa Material is assigned to the PRT object, its Emission checkbox can be unchecked to pass through the inciming data (in fact, it is unchecked by default).
  • The Emission channel can be overriden by Global Channels Modifiers and the Emission Override which can be a single color or a map for all paritlces in the scene.

Absorption Channel

  • The Absorption channel is a native Krakatoa channel similar to the Filter channel of 3ds Max materials, but inverted.
  • While the 3ds Max Filter color defines the resulting color coming out of the object after light has passed through it, the Absorption channel is the complementary color which is subtracted from white light to produce the Filter color.
  • If a PRT sequence contains an explicit Absorption channel, it will be loaded from disk, otherwise the channel will not be allocated at all. If the renderer requests an Absorption channel but the particle stream does not contain one, the default value of pure black [0,0,0] will be used instead.
  • The Absorption channel can be loaded, modified and set by Magma Modifiers on the stack.
  • If a Material is assigned to the PRT object, its Filter color will be subtracted from White and the result will overwrite any Absorption data coming up the stack similar to how the Color channel is handled.
  • The Absorption channel can be overriden by Global Channels Modifiers and the Absorption Override which can be a single color or a map for all paritlces in the scene. When using a single color, two color swatches provide both the Krakatoa Emission color value and the inverted 3ds Max Filter complementary value.

Normal Channel

  • The Normal channel is a native Krakatoa channel similar to the Face normals channel of 3ds Max geometry.
  • It does not map directly to 3ds Max data, but is assumed to correspond to the X axis of the local orientation of a Particle Flow or Thinking Particles particle when acquiring particle data.
  • The Normal channel is required for the calculating of Phong Surface shading, Marschner Hair shading, Environment Reflections and Raytraced Reflections.
  • When creating particles using a PRT Volume, the Normal channel will be populated with the closest surface’s normal value.
  • When creating particles using a PRT FumeFX, the Normal channel will be populated with data based on the mormalized inversed Density Gradient.
  • If a PRT sequence contains an explicit Normal channel, it will be loaded by the PRT Loader and passed up the stack.
  • The Normal channel can be read, modified and set by Magma Modifiers on the stack. Dedicated Object operators like NearestPoint, IntersectRay and FaceQuery can be used to acquire face or smoothed normals from scene geometry.
  • If the PRT Loader has been set up with Culling objects and the Acquire Normals option is checked, new Normals will be assigned to the particles in world space after the whole modifier stack has been processed.

Tangent Channel

  • The Tangent channel is a native Krakatoa channel. It does not map directly to 3ds Max data, but is assumed to correspond to the Y axis of the local orientation of a Particle Flow or Thinking Particles particle when acquiring particle data.
  • The Tangent channel is required for the calculating of Marschner Hair shading and could be used together with the Normal channel to calculate the 3rd, Z axis of the particle’s orientation, or produce a Quaternion Orientation channel.
  • The Tangent channel is only loaded from PRT sequences saved from particle sources that contain Orientation (Particle Flow, Thinking Particles) and is generated procedurally by the PRT Hair object in Krakatoa MX 2.0.0 and higher.
  • It could also be extracted from the Orientation channel, if available in a PRT sequence.