Short Contents

7.7 Point-Based Occlusion and Color Bleeding

Point based graphics reply on a dense point set approximation of scene geometry to compute effects such as occlusion and color bleeding. It is a two pass process that consists of a rapid "geometry conversion" step followed by the main render. The following sections explain the particularities of those algorithms and show how to use 3Delight's point-based functionalities.

7.7.1 Difference with Occlusion Baking

Firstly, it is important to remember that point-based occlusion (and color bleeding) is not occlusion baking (as explained in Baking): point-based occlusion computes the occlusion during the beauty (second) pass, while the baking approach computes the occlusion during the first pass. The "baking" in the point-based method is nothing more than a simple conversion of scene's geometry into a point cloud file. That is why we will refer to the first pass in the point-based approach as the "pre-processing" or "conversion".

7.7.2 Benefits Over Ray-Traced Occlusion

Main benefits are summarized below:

The drawbacks of point-based occlusion can be summarized in the following points:

7.7.3 Point-Based Imaging Pipeline

Since point-based algorithms work on point clouds, one need to convert scene's geometry to such representation. This implies a first pass where polygons, surfaces, and other geometrical primitives are converted to a point cloud, and a second pass where the point cloud is read back and used to compute the occlusion or color bleeding effects.

Point Cloud Creation

Converting a scene into a point cloud representation is a straightforward task but care must be taken to ensure the correctness and the optimality of the operation. One should start by disabling all the culling operations to ensure that backfacing and hidden surfaces are not rejected by the renderer prior to shading:

Attribute "cull" "hidden" [0]
Attribute "cull" "backfacing [0]

Additionally, one should use a dicing method that is independent from the camera view to have correct sampling of points on objects' silhouettes:

Attribute "dice" "rasterorient" [0]

Since the quality of the image is not important during this first pass, one can lower the filter size for fast rendering:

PixelSamples 1 1
PixelFilter "box" 1 1

Since no shading is performed during this pass, all surface shaders can be removed from the scene(54) and replaced by a shader that converts micro-polygons to points. The general structure of such a shader is given below:

/* A simple surface shader to write out the micro-polygons into a 
   point cloud file. */

surface ptc_write(
    string ptc_file = "default.ptc";
    string ptc_coordsys = "world"; )
{
    bake3d( ptc_file, "", P, N,
        "coordsystem", ptc_coordsys,
        "interpolate", 1 );

    Ci = Cs;
}
Listing 7.11: An example shader to convert micro-polygons into a point cloud.


There is many points of interest in Listing 7.11:

  1. bake3d() saves the points as disks, and not dimensionless points. This is performed by taking the area of each micro-polygon using surface derivatives. If needed, it is possible to manually specify the area of a micro-polygon to bake3d():
        ...
        float A = area( P, "dicing" );
        bake3d( ptc_file, "", P, N,
            "coordsystem", ptc_coordsys,
            "_area", A,
            "interpolate", 1 );
        ...
    
    It is suggested not to specify the `_area' channel if it is equal to area(P, "dicing") (see area shadeop) since this will increase the size of the point cloud file unnecessarily (3Delight already stores that area in the point cloud file).
  2. The `interpolate' parameter passed to bake3d() is important: since we wish to convert micro-polygons to points, we are interested in micro-polygons' centers and not corners (see bake3d shadeop). Omitting this parameter may lead to unexpected results in the point-based occlusion algorithm.
  3. The normal passed to bake3d() is not a faceforward() version of the normal. This is important since we need the original surface normal and not an altered one. This also implies that scene geometry should be consistantly oriented in order to get correct results.

If one is to compute point-based color bleeding effects, an additional `_radiosity' channel should be stored in the point cloud file:

    ...
    color rad = compute_surface_radiance();
    bake3d( ptc_file, "", P, N,
        "coordsystem", ptc_coordsys,
        "_radiosity", rad,
        "interpolate", 1 );
    ...

Note that point-cloud creation should be very rapid, so there is no real problem when rendering animated sequences since a point-cloud can be created for each frame (as apposed to baking where it is a good thing to re-use baked data for many frames).

Point Cloud Use

During the main pass, only minor modifications are necessary to the occlusion() call to use previously saved point cloud files. An example call looks like this:

float occ = 1 - occlusion( P, N, 0,
    "filename", ptc_file, "pointbased", 1 );

Color bleeding is computed using the indirectdiffuse() shadeop:

color bleeding = indirectdiffuse( P, N, 0,
    "filename", ptc_file, "pointbased", 1 );

An example for point-based occlusion can be found in `$DELIGHT/ptc_occlusion'.

7.7.4 Algorithm Control Parameters

During the conversion (baking) pass, the important parameters are:

  1. Camera Placement. Camera must "see" al the elements for which the point-based occlusion is to be computed. ptcview can be used to verify that the save point cloud file contains all the necessary points.
  2. Shading Rate. This determines the total number of points in the point cloud. This is an important quality vs speed control knob: higher shading rates will lead to faster processing times and smaller point cloud files at the expense of a lower quality render.
  3. Resolution. This has the same impact as the shading rate.

During the main (beauty) pass, the important control parameters are all part of occlusion() parameter list (see occlusion shadeop):

` maxdist'
This parameter is an important look control knob in point-based occlusion. As explained below, point-based occlusion is not good when rendering very dense environments since and this parameter artificially lowers the complexity of the scene for the algorithm.
` maxsolidangle'
This is a quality vs speed control knob. A good range of values is 0.01 to 0.5.
` clamp'
Setting this parameter to 1 will force 3Delight to account for occlusion in dense environments. The results obtained with this parameter on should look similar to what a ray-traced rendering would give. Enabling this parameter will slow down the point-based algorithm by a factor of 2.

3Delight 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.