The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
|
A sparse voxel octree (SVO). More...
#include <sparse_voxel_octree.h>
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_parameters & | parameters () |
Return local cbuffer parameters. | |
const cb_gi_parameters & | parameters () 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. | |
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.
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.
vs | The injection vertex shader. |
ps | The injection pixel shader. |
rsm_start_slot | The 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].
vs | The voxelization vertex shader. |
gs | The voxelization geometry shader. |
ps | The voxelization pixel shader. |
References dune::exchange().