Skip to content

GPU Voxelization and Its Related Effects

Yaochuang edited this page Apr 9, 2020 · 7 revisions

GLOBAL ILLUMINATION

  • How to handle dynamic scene real-time ?
  • How to handle Compute power constraint to make it "Real Time" ?
  • How to make it "Physically real" ?
  • There are well established off-line solutions for accurate global-illumination computation such as path tracing, or photon mapping . They cannot achieve real-time performance even with optimizations.
  • Fast, but memory-intensive relighting for static scenes is possible, but involves a slow preprocessing step.
  • Anti-radiance allows us to deal with visibility indirectly by shooting negative light, and reaches interactive rates for a few thousand triangles.
  • To achieve higher framerates, the light transport is often discretized.
    • The bounced direct light is computed via a set of virtual point lights(VPL).
    • For each such VPL, a shadow map is computed, which is often costly.
      • Laine et al.proposed to reuse the shadow maps in static scenes. While this approach is very elegant, fast light movement and complex scene geometry can affect the reuse ratio.
      • Walter et al. use lightcuts to cluster VPLs hierarchically for each pixel
      • Hasan et al. push this idea further to include coarsely sampled visibility relationships.
      • a costly computation of shadow maps cannot be avoided and does not result in real-time performance.

GPU Voxelization

Voxel Representation

According to [email protected], Voxel Representation has following advantages.

  • A voxel representation holds spatial data as opposed to conventional rasterization which just has depth value.
  • A voxelized scene can be easily traversed spatially. It enables rendering techniques requiring spatial data such as indirect illumination, ambient occlusion and volumetric light shafts.
  • It is also possible to utilize voxel information to make other effects.
  • For any ideas which could make use of coarse spatially organized information of a scene, voxel representation is worth considering.

Visualize Voxel

This post is a good material to read. It uses DrawIndexedInstanced() to visualize all "non-empty" voxel by a single draw call. So it can also be regarded as an usage demo for DrawIndexedInstanced().

  • Create D3D11 buffer with flag D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS.
  • Create a UAV for draw indirect argument buffer, in order to access it in Compute Shader.
    • Compute Shader update draw indirect argument buffer by atomic add InterlockedAdd().
    • Compute Shader generate per-instance data.
  • After Compute Shader finished, Draw all instances by a single "indirect draw call".
  • Indirect Draw Arguments need to be updated in Compute Shader
struct DrawArgs
{
   uint IndexCountPerInstance;
   uint InstanceCount;
   uint StartIndexLocation;
   int BaseVertexLocation;
   uint StartInstanceLocation;
};

Note about Paper "Interactive Indirect Illumination Using Voxel Cone Tracing"

Indirect illumination is an important element for realistic rendering. It is expensive and highly dependent on the complexity of the scene and BRDFs of surfaces in the scene.

  • Two Elements of the algorithms:
    • hierarchical voxel octree representation generated and updated on the fly from a regular scene mesh
    • approximate voxel cone tracing that allows for a fast estimation of the visibility and incoming energy
  • Additional properties of the algorithms:
    • almost scene-independent performance
    • octree-voxelization scheme can handle complex scenes with dynamic contents
    • voxel cone tracing can efficiently estimate Ambient Occlusion
    • avoid costly pre-computation steps
    • not restricted to low-frequency illumination

overview

  • The approach is built upon a pre-filtered hierarchical voxel representation of the scene geometry. It is stored in GPU in form of dynamic sparse voxel octree.
  • Voxel cone tracing use the representation to quickly estimate visibility and integrate incoming indirect energy splatted in the structure from the light sources.
  • It is a combination of real-time mesh voxelization, octree building and filtering algorithm that efficiently exploit GPU rasterization to handle dynamic scenes.
    • This octree is built once for the static part of the scene, and then updated interactively with moving objects or dynamic modifications.

contribution of paper

  • An adaptive scene representation by fast GPU-based mesh voxelization and octree-building.
  • An efficient splatting scheme to inject and filter incoming radiance information into our voxel structure.
  • An efficient approximate cone-tracing integration.

Alogrithm Summary

  1. Inject incoming radiance(energy and direction) from dynamic light sources into leaves of sparse voxel octree hierarchy.
    • By rasterizing the scene from all light sources and splatting a photon for each visible surface fragment.
  2. Filter incoming radiance values into the higher levels of the octree (mipmap)
    • How to fileter?
    • Filter what?
    • Why Filter?
  3. Render scene from the camera.
    • For each visible surface fragment, combine direct and indirect illumination.
    • Employ an approximate cone tracing to perform final gathering.
      • Sending out a few cones over the hemisphere to collect illumination distributed in the octree.
      • For Phong-like BRDFs, a few large cones (~5) estimate the diffuse energy coming from the scene
      • A tight cone in the reflected direction with respect to the viewpoint captures the specular component.
      • The aperture of specular cone is derived from the specular exponent of material, for glossy reflections.

Hierarchical Voxel Structure

  • A hierarchical structure allows to avoid using geometric mesh and leads to indirect illumination in arbitrary scenes at an almost geometry-independent cost.
  • Both semi-static and fully dynamic objects are stored in the same octree structure for an easy traversal and a unified filtering.
    • A time-stamp mechanism is used to differentiate both types.
    • fully-dynamic objects need a per-frame voxelization.
  • structure construction algorithm performs in two steps: octree building and mip-mapping .
  • It is possible to improve precision near observer and to abstract energy and occupancy information farther away by this structure.
  • Hierarchical Structure Property
    • The root node of the tree represents the entire scene.
    • Its children each represent an eighth of the parent’s volume and so forth.
    • This structure allows to query filtered scene information(energy intensity, direction, occlusion, and local normal distribution functions - NDFs) with increasing precision by descending the tree hierarchy.

How to quickly voxelize arbitrary triangle-based scene

  • Exploit GPU rasterizer, fast enough to perform in each frame to handle fully dynamic scenes
  • In many scenes, large parts of the environment are usually static or updated locally upon user interaction.
    • most updates are restricted and only applied when needed
    • fully-dynamic objects need a perframe voxelization.
  • first create the octree structure itself by using the GPU rasterization pipeline.
  • disabling the depth test to prevent early culling
    • we generate at least one fragment shader thread for each potentially-existing leaf node in the tree.
    • Each thread traverse the octree from top-to-bottom and directly subdivide it when needed.
    • Once the correct leaf node is found the surface attributes (texture color,normal,material) are written.

Reference Resources