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

A Delta Light Propagation Volume (DLPV). More...

#include <light_propagation_volume.h>

Inheritance diagram for dune::delta_light_propagation_volume:
dune::light_propagation_volume dune::shader_resource

Public Member Functions

virtual void destroy ()
 Destroy the shader_resource and free all memory.
 
void set_direct_inject_shader (ID3D11VertexShader *ps)
 Additionally to the regular indirect injection shader, this will set the direct injection pixel shader.
 
void inject (ID3D11DeviceContext *context, gbuffer &rsm, bool clear, bool is_direct, float scale)
 Overwrites the default injection to include direct injects. More...
 
void render_indirect (ID3D11DeviceContext *context)
 Render/propagate indirect injects.
 
void propagate_direct (ID3D11DeviceContext *context, size_t num_iterations)
 Render/propagate direct injects.
 
void render_direct (ID3D11DeviceContext *context, size_t num_iterations, UINT lpv_out_start_slot)
 Render/propagate direct injects.
 
- Public Member Functions inherited from dune::light_propagation_volume
void set_inject_shader (ID3D11VertexShader *vs, ID3D11GeometryShader *gs, ID3D11PixelShader *ps, ID3D11PixelShader *ps_normalize, UINT inject_rsm_start_slot)
 Set the complete injection shader. More...
 
void set_propagate_shader (ID3D11Device *device, ID3D11VertexShader *vs, ID3D11GeometryShader *gs, ID3D11PixelShader *ps, ID3DBlob *input_binary, UINT propagate_start_slot)
 Set the complete propagation shader. More...
 
virtual void inject (ID3D11DeviceContext *context, gbuffer &rsm, bool clear)
 Inject VPLs from an RSM into the LPV. More...
 
void render (ID3D11DeviceContext *context)
 Run the normalization and propagation of the LPV.
 
void visualize (ID3D11DeviceContext *context, d3d_mesh *node, UINT debug_info_slot)
 A rendering function to visualize the LPV with colored cubes for each voxel.
 
virtual void to_ps (ID3D11DeviceContext *context, UINT 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.
 
size_t num_propagations () const
 Get/set the number of propagation steps for the LPV.
 
void set_num_propagations (size_t n)
 Get/set the number of propagation steps for the LPV.
 
void set_model_matrix (ID3D11DeviceContext *context, const DirectX::XMFLOAT4X4 &model, const DirectX::XMFLOAT3 &lpv_min, const DirectX::XMFLOAT3 &lpv_max, UINT lpv_parameters_slot)
 Set/get the world -> LPV matrix, which transforms world coordinates to LPV volume coordinates.
 
const DirectX::XMFLOAT4X4 & world_to_lpv () const
 Set/get the world -> LPV matrix, which transforms world coordinates to LPV 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 Delta Light Propagation Volume (DLPV).

This class is an implementation of [Franke 2013]. A DLPV is an LPV that extracts the difference in illumination caused by the introduction of an additional object into a scene. It can be used to correct for this difference, for instance in augmented reality applications.

The mechanic works like this: instead of injecting one RSM, two a rendered. One is rendered with a scene, the other with the same scene and an additional object. By injecting the latter first, and then injecting the former negatively, the delta is extracted and propagated in the volume.

A DLPV also injects direct light to form out rough shadow blobs. Propagation of direct and indirect injects is independend from one another.

Member Function Documentation

void dune::delta_light_propagation_volume::inject ( ID3D11DeviceContext *  context,
gbuffer rsm,
bool  clear,
bool  is_direct,
float  scale 
)

Overwrites the default injection to include direct injects.

After each clear, RSMs are injected in a toggled order: positive, negative, positive, negative ...

Parameters
contextA Direct3D context.
rsmThe GBuffer of the RSM.
clearSet to true if the injected volume should be cleared. If you inject multiple RSMs set this only at the first call to true.
is_directSpecifiy if this is a direct or indirect injection.
scaleA multiplier for injected VPL intensity

References dune::profile_query::begin(), dune::clear_rtvs(), dune::profile_query::result(), dune::set_viewport(), dune::sampler_state::to_vs(), dune::gbuffer::to_vs(), and dune::cbuffer< T >::to_vs().


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