Volumetric Shading¶
Applicable to Krakatoa v.1.5.0 and higher
Overview¶
- Krakatoa was developed as a volumetric particle renderer, but its first versions used a simplified Isotropic shading model with an alternative non-volumetric Additive shading mode.
- With the introduction of Krakatoa v1.5.0, significant changes were made to the volumetric shading and the previously separate Additive mode was removed and made a special case of Volumetric shading.
- The features introduced in Krakatoa v1.5.0 are supported by both the Particle and Voxel Rendering modes.
- All of them provide per-particle data access for a much higher level of control over the shading of every individual particle in the scene.
Scattering, Density, Emission and Absorption¶
- Krakatoa implements the full volumetric shading equation with Scatter (controlled by the Color channel), Density, Emission and Absorption terms.
- In versions prior to v1.5.0, the Emission was generally assumed zero so particles could not emit light, only scatter and attenuate it, and the Absorption was uniform in R,G and B, always producing gray shadows.
- The Scattering of light can now be controlled by one of several Shaders (also known as Phase Functions) which allow per-particle values to be defined for the highest level of control possible.
- In versions prior to v1.5.0, there were only two phase functions - Isotropic and Phong Surface (>Use Normals on).
- An optional Emission particle data channel can be enabled to make particles appear illuminated in addition to or even without any external light sources.
- It can be set using Materials, Krakatoa Channel Modifiers and Overrides
- An optional Absorption particle data channel can be enabled to allow for independent attenuation of the R, G and B channels as light passes through dense particles.
- It can be set using Materials, Krakatoa Channel Modifiers and Overrides
Shading Channel Data Sources¶
The various shading channels can be populated with data from various sources.
Color Channel¶
- The Color Channel can be provided by one of the following sources:
- The Color Channel of PRT or CSV file loaded using a PRT Loader.
- The Wireframe (Object) Color of the source object (like PRT Loader, PRT Volume, Geometry Vertices) - this is used when no Color Channel can be loaded and no material has been assigned to the object.
- A Magma Modifier applied to the source PRT object (PRT Loader, PRT Volume etc.) - the Magma can read, modify and set the Color channel of the incoming particle stream.
- Multiple KCMs can be stacked on top of each other and perform operations on the color data coming from the previous Magma.
- This is the most flexible and powerful method for specifying the Color Channel and allows for custom shading including completely new shading models.
- The results can be previewed interactively in the viewports.
- The Object Material of the source object - either Standard Material (Diffuse Color or Diffuse Map) or Krakatoa Material (Scattering Color or Map)
- A Global Krakatoa Channels Modifier (KCM) applied to all scene objects via a Global Channel Override Set in the Global Render Values rollout. The KCM will be applied globally to the Color channel of all scene particles regardless of their source at render time. The results CANNOT be previewed in the viewports.
- Override Color and/or Map in the Global Shading Channel Overrides rollout - either the solid color provided by the color picker, the color map provided by the map slot or a mixture of both based on the Blend Amount spinner will overwrite the Color Channel of all scene particles regardless of their source at render time.
- Color sources lower on the list above have higher priority, overriding possible sources from top of the list.
- For example, if a particle gets its color from the Object Color, the color will be visible in the Color Channel Input of a KCM and can be overwritten by the KCM with a Color Channel Output, which in turn would be overwritten by a Material. That color could be modified or overwritten by a Global KCM but finally overwritten by a Global Color Override.
- The following examples show a PRT Volume with 2.8MP rendered in Voxel mode (0.5/1) with Density 3.0/-2:
- The image on the left shows the PRT Volume using its Object (Wireframe) pink color [225,87,143].
- The second image shows the same PRT Volume with a Standard Material using a Cellular Map in Chips/Fractal with Size 10.0, Spread 0.5, Adaptive Iterations 3.0 and colors [155,250,80], [0,198,91] and [0,150,0].
- The third image shows the same PRT Volume with a Krakatoa Channels Modifier wired to copy the Normal Channel to the Color Channel - only the X and Z visible here, Y (green) is on the back.
- The fourth image shows the same PRT Volume with a KCM wired to blend the colors red and green based on the Z coordinate of the particle Position channel:




Emission Channel¶
- In order to be allocated and used by the renderer, the Emission Channel MUST be enabled explicitly by checking >Use Emission in the Main Controls rollout or alternatively using the >Use checkbox next to the >Override Emission checkbutton in the Global Render Values rollout.
- The Emission channel can be populated with data from one of the following sources:
- The Emission Channel of a PRT or CSV file loaded using a PRT Loader.
- A Krakatoa Magma Modifier applied to the source object PRT (PRT Loader, PRT Volume, etc.) - the Magma can read, modify and set the Emission channel of the incoming particle stream.
- The result CANNOT be seen in the viewport, unless the same value is output to the Color channel, or better to the ViewportPRTColor channel which only displays in the viewport but not in the renderer.
- The Self-Illumination color or map of a Standard Material or the Emission color or map of a Krakatoa Material.
- A Global KCM applied via a Global Channel Override Set in the Global Render Values rollout. The KCM will be applied globally to the Emission channel of all scene particles regardless of their source at render time.
- Override Emission color and/or map in the Global Shading Channel Overrides rollout - either the solid color provided by the color picker, the color map provided by the map slot or a mixture of both based on the Blend Amount spinner will overwrite the Emission Channel of all scene particles regardless of their source at render time.
- The following examples show the same PRT Volume with 2.8 MP rendered in Voxel mode (0.5/1) with Density 3.0/-2 as in the Scatter/Color channel:
- The image on the left shows the PRT Volume using its Object (Wireframe) pink color [225,87,143] and no Emission.
- The second image shows the same PRT Volume with >Use Emission enabled and >Override Emission checked; Emission color set to [50,50,50] gray.
- The third image shows the same PRT Volume with a Standard Material applying the same Cellular map as in the Scatter/Color example, but in the Self-Illumination channel and with Map Amount set to 33.0 to reduce the intensity.
- The fourth image shows the same PRT Volume with the same KCM wired to blend the colors red and green based on the Z coordinate of the particle Position channel seen in the Scatter/Color examples above, but applied to the Emission channel.




Absorption Channel¶
- In order to be allocated and used by the renderer, the Absorption Channel MUST be enabled explicitly by checking >Use Absorption in the Main Controls rollout or alternatively using the >Use checkbox next to the >Override Absorption checkbutton in the Global Render Values rollout.
- The Absorption channel can be populated with data from one of the following sources:
- The Absorption Channel of a PRT or CSV file loaded using a PRT Loader.
- A Krakatoa Magma Modifier applied to the source PRT object (PRT Loader, PRT Volume, etc.) - the Magma can read, modify and set the Absorption channel of the incoming particle stream.
- The Filter color or map of a Standard Material (internally subtracted from white).
- The Absorption color or map of a Krakatoa Material.
- A Magma Modifier applied via a Global Channel Override Set in the Global Render Values rollout.
- The Magma will be applied globally to the Absorption channel of all scene particles regardless of their source at render time.
- Override Absorption color and/or map in the Global Shading Channel Overrides rollout - either the solid color provided by the color picker, the color map provided by the map slot or a mixture of both based on the Blend Amount spinner will overwrite the Absorption Channel of all scene particles regardless of their source at render time.
- The following examples show the same PRT Volume with 2.8MP rendered in Voxel mode (0.5/1) with Density 3.0/-2 as in the Scatter/Color and Emission channel examples:
- The image on the left shows the PRT Volume using its Object (Wireframe) pink color [225,87,143] and no Absorption.
- The second image shows the same PRT Volume with >Use Absorption enabled and >Override Absorption checked; Absorption color set to [0,0,0] black. Note that if no Override color is provided, black would be used by default anyway.
- The third image shows the same PRT Volume with a Standard Material applying a Cellular map like in the Scatter/Color and Emission examples, but in the Filter channel and with colors of [20,0,50], [100,50,0] and [50,0,0].
- The fourth image shows the same PRT Volume with the same KCM wired to blend the colors red and green based on the Z coordinate of the particle Position channel seen in the Scatter/Color and Emission examples above, but applied to the Absorption channel. Material had to be removed (by assigning NONE) from the PRT Volume since a Standard Material would always provide its Filter Color subtracted from white as the Absorption if assigned.




Density Channel¶
- The Density channel controls the contribution of a particle to the density of the rendering and modulates the influence of the Scatter (Color), Emission and Absorption Channels. The Density Channel is ALWAYS allocated by the Krakatoa Renderer.
- The Density channel can be populated by the following sources:
- If no source of Density data is found, the Density of a particle will start as 1.0.
- This is the case of PRT files not containing a Density channel, Geometry Vertices, Legacy Particles, Particle Flow and Thinking Particles particles etc.
- An exepction is the PRT Volume which will calculate per-particle density based on the level set’s voxel size and the number of particles per voxel it creates.
- The Density Channel loaded from a PRT, CSV or BIN file. Note that a BIN file might contain a Density Channel with a value of 0.0 since it is used differently by RealFlow. In that case, the Density Channel MUST be reset to 1.0 or another non-zero value using a KCM.
- A Krakatoa Magma Modifier applied to the source PRT object (PRT Loader, PRT Volume, etc.) can read, modifiy and write to the Density Channel.
- The Density Channel will be modulated by the Object Visibility track found in the Object Properties dialog of 3ds Max. That value can be animated and generally keyframed even outside of the 0-1 range in TrackView to increase or decrease density.
- The Density Multiplier of a Krakatoa Material will modulate (multiply) the incoming Density Channel value.
- The Opacity value or map of a Standard Material will also modulate the incoming Density Channel value.
- A Global Magma Modifier applied via a Global Channel Override Set in the Global Render Values rollout. The KCM will be applied globally to the Density channel of all scene particles regardless of their source at render time.
- Override Density color and/or map in the Global Shading Channel Overrides rollout - either the solid color provided by the color picker, the color map provided by the map slot or a mixture of both based on the Blend Amount spinner will overwrite the Densiy Channel of all scene particles regardless of their source at render time. NOTE that since Density is a Floating Point value, only the Value of the Color expressed as HSV color model will be taken.
- If no source of Density data is found, the Density of a particle will start as 1.0.
- The following examples show the same PRT Volume with 2.8MP rendered in Voxel mode (0.5/1) with Global Density 3.0/-2 as in the Scatter/Color, Emission and Absorption channel examples above:
- The image on the left shows the PRT Volume using its Object (Wireframe) pink color [225,87,143] and the original Density of 3.0/-2.
- The second image shows the same PRT Volume with a Standard Material assigned, applying the same Cellular map as in the examples above but with colors [40,40,40], [100,100,100] and [255,255,255]. Since the Material Opacity is always multiplied with the Density specified in the Main Controls rollout, the original density is modified with some solid veins and less solid cells.
- The third image shows the same PRT Volume with a KCM wired to normalize the Z coordinate of the particle Position channel by the height of the model, the result subtracted from 1.0 and applied to the Density channel. This causes the particles to fade off in the head area as the density channel approaches zero. The Material Opacity Map was disabled to remove the effect of the map.
- The fourth image shows the same PRT Volume with the same KCM AND the Standard Material from the second image and >Scale Density By Material Opacity checked. As you can see, the Opacity Map of the Standard Material is multiplied with the Density provided by the KCM instead of overwriting the channel, so we get both mixed automatically.




Additive Rendering¶
- In Krakatoa v1.1.x, Additive Rendering was performed in an exclusive mode. In fact, it used a separate code path independent from the volumetric rendering.
- In Krakatoa v1.5.x and higher, Additive Rendering is a special case of Volumetric Rendering with Emission channel set to the desired Color and the Color and Absorption channels set to black.
- As a side effect, it is possible to blend gradually between Volumetric and Additive mode within the same particle cloud and mix the two modes within the same image.
- For details, see the topic Mixing Additive And Volumetric Rendering.
- A >Force Additive Mode option was added to the Main Controls rollout of Krakatoa to allow the quick rendering of all particles with additive shading.
- When this option is checked,
- The Emission and Absorption channels will be enabled implicitly (their checkbuttons will be grayed out in the UI to denote that they are controlled internally)
- The content of the Color channel will be copied into the Emission channel
- The Color and the Absorption channels will both be set to black
- As result, all particles will render additively using the Color channel as Emission.
- When this option is checked,
SEE ALSO¶
- Krakatoa Shaders (Phase Functions)
- Environment Reflection Maps
- MagmaFlow and the Krakatoa Channel Modifiers (KCMs)
- Voxel Rendering Mode