Krakatoa
RSS< Twitter< etc

Rendering A PRT Volume As Points In Krakatoa MY

Last Edited 2013/02/20 @ 2:30 pm PST. 

Introduction

The following tutorial looks at the basic steps involved in setting up a particle cloud from a polygon mesh object and rendering the resulting particles in Krakatoa MY using Particle mode (points rendering).

The Base Scene

In this example, we will use the ubiquitous Stanford Univeristy Buddha statue scan as the source volume for our PRT Volume object. 

We will illuminate the scene with a single Spot light.

Click here to download the base scene file (Maya 2012, ZIP, 7.86 MB)

To Create the PRT Volume 

  1. Select the Buddha mesh in the scene.
  2. Click the VOL icon in the Krakatoa shelf to create a new PRT Volume object. It will be automatically connected to the selected mesh, aligned to it, renamed to match the source object's name and its viewport spacing will be adjusted to the size of the mesh's bounding box.
  3. Change the Spacing value of the PRT Volume to 1.0.

Alternative PRT Volume Creation Workflow (Old School)

  1. Deselect all scene objects.
  2. Click the VOL icon in the Krakatoa shelf to create a new PRT Volume object. It will be placed at the world origin and will become selected.
  3. Change the Spacing value of the PRT Volume to 1.0 and the Viewport Spacing to 2.0
  4. Press the "Attach PRTVolume Mesh" button in the Attribute Editor, then click the Buddha mesh to pick it. The PRT Volume will generate particles within the volume of the mesh instanteneously. 
  5. In this particular scene, the mesh is aligned to the origin, but in the general case, you would have to align the PRT Volume to the source mesh or check the World Space option to produce the particles inside the actual source. PRT Volume provides some buttons in the Mesh Input Advanced Tools panel to help with the alignment, naming, spacing etc.

The PRT Volume converts the input mesh to a LevelSet. The resulting voxel grid can be further subdivided to produce sub-regions. Then one or more particles are placed in each of these sub-regions as long as the particle's position is still inside the volume.

First Steps In Krakatoa Rendering

Rendering With Default Settings 

  1. Click the Open Render View icon of Maya. The Render View will open. 
  2. Make sure Krakatoa is selected as the current renderer. If it is not, select it from the list of installed rendering engines.
  3. Click the Redo Previous Render (Krakatoa) icon in the Render View's toolbar, or the Render the Current Frame (Krakatoa) button in the Maya toolbar. In less than a seconds, the PRT Volume will generate over 350,000 particles and render them:

Obviously, there are not enough particle to represent the volume of the mesh correctly. In the above image, a voxel size of 1.0 unit was used and only one particle was placed in the center of each voxel.

Instead of reducing the voxel size and thus increasing both memory usage and processing time, we can subdivide the existing voxels.

Increasing The Particle Count

  1. Check the Use Multiple Subdivisions Per Region checkbox. The default Number Of Subdivisions value is 1, which means that each voxel will be subdivided one in each plane, producing 2x2x2 sub-regions. Each one will get one particle, thus producing 8 times more particles. Note that the PRT Volume will compensate for the increased particle count and give each particle 1/8th of the per-particle density, so the final result will look approximately the same, just smoother.
  2. Click the Redo Previous Render (Krakatoa) icon to re-render. In a few seconds, the PRT Volume will generate nearly 3 million particles (8 times more than in the previous attempt) and render them:

As you can see, the image is a bit dark. This is caused by the high density of the particles. Although the whole volume of the mesh and not just the surface is filled with particles, each particle has such a high density that it blocks almost all the light and there is no light left to reach the following particles along the light ray. Reducing the density would allow more light to pass through the volume and produce a more pronounced sub-surface scattering effect.

Tweaking The Global Density Multipliers

To solve this, we can tweak the global Final Pass Density controls which are an overal multiplier applied to all particles in the scene. 

  1. Press the Open Render Settings Window (Krakatoa) icon. The Render Settings dialog will open.
  2. Locate the Lighting and Drawing Pass Density and Filtering panel.
    "Final Pass Density" is the Density as seen through the "camera" when drawing the particles into the frame buffer, but by default it also affects the Density as perceived by the Light sources. You will notice that there are two controls for Final Pass Density which  The default Final Pass Density is 5.0 and the Final Pass Density Exponent is -1. The two controls apply to the same value and are taken as 5.0 * 10 ^ -1, or 0.5. 
  3. Change the Final Pass Density Exponent to -2. This will change the value from 0.5 to 0.05.
    The idea is that in order to specify a very high or very low value, you can simply increase or decrease the Exponent and step by whole orders of magnitude. So instead of entering 0.000000000001 which Maya may or may not accept, you can enter 1.0 and Exponent -12.
  4. Click the Redo Previous Render (Krakatoa) icon again. This time, the Density of the particles will be 10 times lower and more light will pass through the cloud: 

The lighting looks better, there is indeed more light penetrating the volume, but now the statue itself looks like a ghost - the Alpha channel shows the object is now semi-transparent:

In addition, some artefacts became obvious when using these settings - pay close attention to the arms of the statue - there are some lines caused by the grid nature of the default particle distribution:

Jittering The PRT Volume Particles

These lines are approximately at eye level - the camera can see between the rows of particles. Lets' randomize the positions of the particles inside the mesh volume to remove this problem: 

  1. In the Attribute Editor, check the Enable Random Jitter checkbox. This will cause each particle to be placed at a random position within its voxel instead of the center of the voxel. As result, the voxel grid will not be obvious in renders anymore.
  2. Click the Redo Previous Render (Krakatoa) icon again.   

And here is the RGB pass with Jitter on:

Back to the Density, it would be better if we could keep the latest Density settings only for the lighting pass, but use the higher density from the previous test render for the camera (final drawing) pass. 

Decoupling Lighting Pass Density From Final Pass Density 

Thankfully, Krakatoa provides this option.

  1. Check the Use Lighting Pass Density checkbox. The Lighting Pass Density controls on the left side of the panel will become available.
  2. Set the Lighting Pass Density to 5.0 and Lighting Pass Density Exponent to -2.
    These are the values we used in the last test render.
  3. Set the Final Pass Density Exponent back to -1.
    This is the value we used in the eralier test render. This time, the valye will apply to the Final Pass only. The light will "see" the particles as 10 times less dense than the camera will perceive them. This is a non-physically-correct behavior, but in computer graphics, control and flexibility are more important the real world concepts.
  4. Click the Redo Previous Render (Krakatoa) icon again. 

Changing The Background Color

Let's change the background color from black to sky-blue to get a better idea about the shadow areas of the rendering. 

  1. In the Render Settings dialog, locate the Global Render Values panel.
  2. Check the Override Background Color checkbox. The Background Color to the right of the checkbox defaults to blue and will now be used by the renderer.
  3. Click the Redo Previous Render (Krakatoa) icon again. 

Further Improving The Quality

Looking closer at the rendered image, especially under magnification, there is still some sponginess to it because the volume is made of discrete points.

We could simply increase the Number of Subdivisions from 1 to 2 to produce 3x3x3 = 27 times more particles per voxel than in the very first render, and 3.375x more particles than in the above image.

Below is a comparison between the two images saved as animated GIF, magnified 3 times to make the per-pixel difference more obvious:

 

Exploring The Surface Shell Option

The PRT Volume object provides an option to populate only a user-defined region of particles relative to the surface of the mesh. The Region is defined by an offset from the surface with positive values moving inwards, and a Thickness parameter which defines the world units thickness of the region measured from the start. Both values can be animated for interesting growing and solidifying effects.

Enabling The Surface Shell Option 

  1. In the Attribute Editor, with the PRT Volume object selected, locate the Misc Settings panel.
  2. Check the Use Surface Shell checkbox
  3. Leave the Surface Shell Start value at default 0.0 and Surface Shell Thickness at default 5.0.
  4. Click the Redo Previous Render (Krakatoa) icon again. 

The result is a hollow statue which thickness of 5.0 units from the surface of the mesh measured inwards. A lot more light reaches the back side of the statue because there are no particles to absorb it at the core of the volume.

 

Next Tutorial

Rendering PRT Volume As Voxels