The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
Public Member Functions | List of all members
dune::sparse_voxel_octree Class Reference

A sparse voxel octree (SVO). More...

#include <sparse_voxel_octree.h>

Inheritance diagram for dune::sparse_voxel_octree:
dune::shader_resource dune::delta_sparse_voxel_octree

Public Member Functions

virtual void destroy ()
 Destroy the shader_resource and free all memory.
 
void set_shader_voxelize (ID3D11VertexShader *vs, ID3D11GeometryShader *gs, ID3D11PixelShader *ps)
 Set the complete voxelization shader. More...
 
void set_shader_inject (ID3D11VertexShader *vs, ID3D11PixelShader *ps, UINT rsm_start_slot)
 Set the complete injection shader. More...
 
void voxelize (ID3D11DeviceContext *context, gilga_mesh &mesh, bool clear=true)
 Voxelize a mesh into a volume with normals and an occupied marker. If clear is true, the volume is cleared before voxelization.
 
virtual void inject (ID3D11DeviceContext *context, directional_light &light)
 Inject a bounce from directional_light into the SVO.
 
void filter (ID3D11DeviceContext *context)
 Pre-filter (i.e. mip-map) the SVO.
 
virtual void to_ps (ID3D11DeviceContext *context, UINT volume_start_slot)
 Upload the shader resource to register slot of a pixel shader.
 
cb_gi_parametersparameters ()
 Return local cbuffer parameters.
 
const cb_gi_parametersparameters () const
 Return local cbuffer parameters.
 
void set_model_matrix (ID3D11DeviceContext *context, const DirectX::XMFLOAT4X4 &model, const DirectX::XMFLOAT3 &svo_min, const DirectX::XMFLOAT3 &svo_max, UINT svo_parameters_slot)
 Set/get the world -> SVO matrix, which transforms world coordinates to SVO volume coordinates.
 
const DirectX::XMFLOAT4X4 & world_to_svo () const
 Set/get the world -> SVO matrix, which transforms world coordinates to SVO volume coordinates.
 
- Public Member Functions inherited from dune::shader_resource
virtual void to_vs (ID3D11DeviceContext *context, UINT slot)
 Upload the shader resource to register slot of a vertex shader.
 
virtual void to_gs (ID3D11DeviceContext *context, UINT slot)
 Upload the shader resource to register slot of a geometry shader.
 
virtual void to_cs (ID3D11DeviceContext *context, UINT slot)
 Upload the shader resource to register slot of a compute shader.
 

Detailed Description

A sparse voxel octree (SVO).

This class implements a sparse voxel octree (currently just a volume) filtered and uploaded to the GPU, where it can be used for Voxel Cone Tracing. The SVO contains to volume textures: v_normal_, which contains a four component 3D texture where each texel is an RGB encoded normal plus a occlusion marker, and v_rho_ which contains the injected first bounce from an RSM.

A typical SVO is handled in three steps when rendering:

After uploading both volumes to the GPU, voxel cone tracing can be performed.

Member Function Documentation

void dune::sparse_voxel_octree::set_shader_inject ( ID3D11VertexShader *  vs,
ID3D11PixelShader *  ps,
UINT  rsm_start_slot 
)

Set the complete injection shader.

This method sets the injection shader, which includes a vertex and pixel shader, and a slot at which register the shader can expect to read a gbuffer of the RSM with colors, normals and lineardepth.

Parameters
vsThe injection vertex shader.
psThe injection pixel shader.
rsm_start_slotThe slot at which the gbuffer of an RSM starts.

References dune::exchange().

void dune::sparse_voxel_octree::set_shader_voxelize ( ID3D11VertexShader *  vs,
ID3D11GeometryShader *  gs,
ID3D11PixelShader *  ps 
)

Set the complete voxelization shader.

This method sets the voxelization shader, which includes a vertex, geometry and pixel shader. The shader is an implementation of [Schwarz and Seidel 2010].

Parameters
vsThe voxelization vertex shader.
gsThe voxelization geometry shader.
psThe voxelization pixel shader.

References dune::exchange().


The documentation for this class was generated from the following files: