Previous Topic (Using PRT Loader Birth and Update) Up (Tutorials) Next Topic (Creating Thick Smoke Using Particle Flow as GeoVolume)

Mixing Additive And Volumetric Shading

 Applicable to Krakatoa v1.5.0 and higher

Introduction

Krakatoa 1.5.0 added support for per-particle Emission and Absorption data in addition to the Color channel that existed in previous versions. Since Additive Rendering is defined as fully emissive with full absence of Absorption and Scattering, this makes it possible to mix Volumetric and Additive rendering within the same image - in fact, two particles in the same system could be set to render as either volumetric, additive or somewhere in-between using the three channels mentioned above.

The following tutorial demonstrates how you can control the Volumetric and Additive rendering using MagmaFlow and Maps.

Exploring Volumetric and Additive Rendering

Creating the Base Scene

  • We will use a very simple test scene consisting of a Geosphere with Radius of 30.0 generic units lit by a single default Spot Light.
  • We create a default PRT Volume object to convert the Geosphere into a particle cloud.
  • We will be adding multiple Krakatoa Channels Modifiers to this PRT Volume and render in Voxel mode with Density of 5.0/-1, Voxel Size of 1.0, Filter Radius 2.
  • If rendered, the Sphere will look something like this (YMMV depending on the random object color):

Adding a Cellular Map To Color Channel

  • We can now add a Krakatoa Channels modifier to the PRT Volume and set the Color channel to a Cellular Map.

  • To do this, we
    • Change the default Input node from Color to TextureMap.
    • Pick a new texture map and select Cellular from the Map Browser.
    • Put the new map into the Material Editor
    • Change the Size of the Cellular map to 15.0
    • Change the first Division color to Black just like the Second Division color.
  • Rendering the same sphere now shows the cellular map as the color:

Enabling Absorption

  • If we would check the >Use Absorption option in the Main Controls rollout, we would get the following result:

  • This is because
    • When the Absorption value is not specified, it is assumed to be black.
    • Also there is no Emission yet and where the particle Color (Scatter) is also black, we get the above-mentioned conditions for Additive rendering.
    • But since there is no Emission either, the particles don't render at all!
  • Looking at the Alpha channel, we can see how the Volumetric shading transitions into Additive shading - there is no Alpha in Additive mode:

Adding Emission To The Additive Shading Areas

  • All that is left to do is adding some Emission to the areas that are currently fading off:
  • We add another Krakatoa Channels modifier and set the following flow:

  • What this flow does is
    • Loading the Color channel (containing the Cellular Map info) and blending two colors based on its magnitude.
    • The first color will be used in the areas where the Color channel contains black values - this will be the Additive color we want.
    • The second color is the color we want to add to the areas with visible Volumetric particles - in this case we want no color, so we use black.
  • We also have to enable the >Use Emission option and render:

Modulating The Density

  • As you can see from the above rendering, the density that works great for Volumetric shading does not necessarily work for Additive rendering.
  • To solve this, we can modulate the Density using a similar approach to the Emission KCM:

  • In this flow, we simply take the Magnitude of the Color channel and Clamp it between 0.15 and 1.0.
    • This ensures that the Density of fully Additive particles will be 0.15 of the Density of fully Volumetric particles.

  • If we would not clamp to 0.15 but use the raw Magnitude or set the Clamp to 0.0-1.0, we would lose the purely Additive particles because their Density will go down to 0.0 and they won't render:


Controlling The Absorption

  • So far, we used the Absorption channel while leaving it at its default value.
  • Using the above approach, we could provide an Absorption channel per particle so that Additive particles (in the areas where the Color channel is black and Emission is high) would have no Absorption at all, while Volumetric particles would absorb light based on a value specified by a KCM:
  • In the following flow, we take once again the Magnitude of the Color channel and Blend two colors - Black and a Reddish one with Complementary color of blue-greenish shade we want to produce from our white volumetric particles.

  • Rendering will now produce greenish color in the Volumetric areas while keeping the yellow-orange color in the Additive areas: