| Previous Topic (Cameras and Lights) | Up (Contents) | Next Topic (Casting Shadows On Geometry) |
Ambient PME Feature
- 1 Ambient PME Feature
One of the advanced rendering features in Krakatoa is the Ambient Participating Medium Extinction (APME or PME for short).
Introduction
The APME feature simulates the physical effect of light energy being affected by the ambient medium it passes through, for example air or water. The typical case and the main reason APME was added to Krakatoa in first place was to simulate particles underwater.
In the case of the movie "Superman Returns", both the camera and the particles were submerged, so the calculation took the complete distance from the camera to each particle and calculated an extinction to the Red, Green and Blue channel based on measurements that are available in underwater photography books and online. Krakatoa provides a couple of presets based on such data.
Using Basic APME

To enable this basic type of APME, simply check the >Use... option in the Ambient PME Rollout. To specify an extinction, enter values in the Red, Green and Blue value spinners - these values define how much energy would be absorbed as light passes through the medium. This extinction is exponential, meaning that if 50% are absorbed after a meter, 50 more percent would be absorbed from the remaining energy after the next meter, then again 50 percent from the remaining light after the third meter and so on.
NOTE that the extinction values in the GUI are not in any particular units, but have been calibrated so that a value of 50.0 will cause extinction of 50% at 1 meter distance. ANY other values will NOT necessarily represent an extinction of the same percentage since the function is not linear.
In order to visualize what is happening to a particle of a certain color at a certain distance based on the specified extinction values, a gradient will be drawn in the GUI.
The color swatch on the left is set by default to white, so assuming your particles are white and lighting is off, the gradient will show the exponential extinction of the Red, Green and Blue channels over distance. You can also enter the Start and the Distance of the range to be visualized - both spinners show User Units so you can enter the values in the system of your liking, like meters, feet, inches, miles and so on.
You can copy the particle color from your material or the Main Controls rollout to the left color picker in the PME GUI if you want to know how your particles would change over distance. To do so, right click the color picker in the Main Controls rollout or the Material Editor, select Copy, then right-click the left color picker in the Ambient PME rollout and select Paste.
The color on the right side of the gradient shows the color a particle would have when seen through that amount of medium. If you would visualize the gradient at 100m distance and place particles at the same distance to the camera in the scene, the color the particles would render in would match the color of the right side of the gradient.
REMEMBER that high Red Extinction values cause more red color to be removed as light travels, so increasing the red value actually reduces the red in the color and turns particles green-blue. Typically, red color is lost underwater after very short distance, followed by the green color, which explains why the depths of the ocean are deep blue.
The source and target colors and the percentage of change at the given distance will be written around the color gradient, giving you a numeric feedback of the changes to the colors.
Using the Inverse APME Solver
This might appear slightly counter-intuitive in the beginning. If you want to work with more familiar controls, you could use the right color swatch to define the desired color instead of trying to figure out the correct extinction values to achieve it - Krakatoa will calculate the inverse of the extinction function and actually adjust the extinction values necessary to achieve the specified color based on the initial color (left swatch) and the specified depth. Note that you cannot specify values the would be impossible to achieve using the laws of physics. For example, you cannot produce more red than there is in the source color using this method - the right color swatch will reset itself to a valid color automatically.
Non-Physical APME For Utility Passes
If you DO want to achieve such non-physical behavior, you would need to use negative exponential values which would PRODUCE more energy than there is in the initial color. Since Krakatoa was developed to be used in a visual effects pipeline and such behavior can be desired when generating utility passes where the color has to increment with distance instead of being reduced, the PME GUI features a [--] button which enables this non-physical mode. When checked, negative extinction values can be entered in the Red, Green and Blue spinners, but the right color swatch will be disabled because calculating a valid inverse solution in this mode is not always possible.
Using Geometry Volumes for Advanced APME
A more advanced mode supported by Krakatoa allows you to define the volumes of the medium using regular geometry objects similar to the way Matte Objects are defined. Instead of hiding particles though, these meshes will define a volume of medium. The object could be an open mesh like a plane - if for example you want to simulate particles underwater while the camera is above water, you could create a water surface using a plane with a noise modifier and specify the mesh as APME Volume by adding it to the corresponding Named Selection Set. Now if you would render particles that are below the surface, their color will be changed according to the Extinction settings. Use a preset from the GUI and the particles will turn blueish with increasing depth and increasing distance from camera.
You can also use closed volumes like spheres or other geometry objects to define the medium - Krakatoa will trace the path of light through each volume and take into account the combined influence of all volumes. NOTE that currently, different volumes cannot have unique APME settings, all volumes define the SAME medium.
The behavior of the feature differs depending on whether the camera and the particle are in the same medium or not:
- Particle and Camera are in the same volume (for example, both underneath the plane and thus below water) - the Basic APME rules apply, the full distance from camera to particle is used.
- Particle is inside a volume, camera is outside, or vice-versa - the distance the view ray travels through the volume is measured and used for the extinction.
- Particle and Camera are outside of the volume with direct visual contact and no volumes between them - no extinction will be calculated. If you want for example to delete particles that are above water, you can use the same mesh as the culling volume in the PRT Loader that provides the particles.
- Particle and Camera are outside of the volume and there is a closed volume between them - the extinction will be based on the distance the view ray travels in the volume.
For example:
- Create a Particle Flow system, set to Box emitter, set Viewport % to 1, Birth Operator to emit 2M particles on frame 0, disable speed, rotation and shape operators.
- Create a 300x300 plane with 30x30 segments above the PFlow
- Add a Noise modifier with Scale 200, Fractal on, Z Strength 300.
- Leave some distance between the plane and the particle system - the particles are "submerged" below the "waves"
- In Krakatoa GUI, open the Ambient PME rollout and check the >Use Ambient Participating Medium Extinction option.
- Press the [>>] button next to it and select Polluted Oceanic Water
- Check the >Link Values option and enter 200.0 into the Red Extinction value spinner - all other extinction values will follow.
- Enter 100.0 into the Distance from Start spinner.
- Select the Plane in the viewport and hit the Create/Update APME Selection Set button - a new Named Selection Set "KrakatoaAPMEObject" will appear in the right listbox.
- Set Density to 5.0, -2.
- Render from a perspective or camera view above the plane
The resulting image will look something like this:
APME and Lighting
Another thing to keep in mind is that the GUI only represents self-illuminated particles. The moment you enable Lighting, the particle illumination will change significantly because the light from the light source will ALSO be affected by the same exponential extinction and its color reaching every particle will depend on the distance the light has to travel through the medium.
This means that a white particle inside a water medium will be hit by light that has already lost a large part of its red component, then the reflected light would travel through even more water to reach the camera, so the effect would be much darker particles than without the PME effect. You might have to increase your light intensity to do "underwater renderings"...
Using APME Presets
You can use the Presets system accessed via the [>>] button to save your extinction settings to disk for future use, edit the values of existing presets (except for the built-in ones) and remove your own presets (again except the factory ones).
To Save an APME Preset
- Set up the APME settings (Red, Green and Blue Extinction) to the desired values.
- Enter a descriptive name in the Preset Name text field, like "My New Ocean Settings"
- Click the [>>] button and select the first menu item Save "My New Ocean Settings"
Result: If you click the [>>] button again, you will see your settings at the bottom of the list, including the name and the extinction values.
To Load an APME Preset
- Click the [>>] button and select the preset from the list - its name will be shown in the Preset Name field and the Extinction values will be restored.
To Update an APME Preset
- Click the [>>] button and load the existing preset as described above.
- Change the Extinction values
- Click the [>>] button and select the top item Update "My New Ocean Settings"
Result: The existing preset will be changed to the new values.
To Delete an APME Preset
- Click the [>>] button and load the existing preset (if not loaded yet)
- Click the [>>] button again and select the last item Remove "My New Ocean Settings"
Result: The preset will be removed permanently from the INI file.
Advanced Tip: These settings are saved in the file KrakatoaPreferences.ini found in the Plugcfg\Krakatoa folder accessible via the Presets and History rollout > Explore Folder... button. The settings are under the [PMEPresets] category where the key name is the preset name and the key value is a Point3 value with the RGB extinctions as components.