9 #ifndef DUNE_LIGHT_PROPAGATION_VOLUME
10 #define DUNE_LIGHT_PROPAGATION_VOLUME
36 float time_propagate_;
37 float time_normalize_;
42 float lpv_flux_amplifier;
48 ID3D11BlendState* bs_inject_;
49 ID3D11BlendState* bs_propagate_;
53 ID3D11VertexShader* vs_inject_;
54 ID3D11GeometryShader* gs_inject_;
55 ID3D11PixelShader* ps_inject_;
57 ID3D11VertexShader* vs_propagate_;
58 ID3D11GeometryShader* gs_propagate_;
59 ID3D11PixelShader* ps_propagate_;
61 ID3D11PixelShader* ps_normalize_;
63 INT propagate_start_slot_;
64 INT inject_rsm_start_slot_;
66 ID3D11Buffer* lpv_volume_;
67 ID3D11InputLayout* input_layout_;
80 size_t iterations_rendered_;
85 DirectX::XMFLOAT4X4 world_to_lpv_;
89 DirectX::XMFLOAT3 lpv_pos;
99 DirectX::XMFLOAT3 pad;
104 struct cbs_propagation
107 DirectX::XMFLOAT3 pad;
120 void normalize(ID3D11DeviceContext* context);
121 void propagate(ID3D11DeviceContext* context);
122 void propagate(ID3D11DeviceContext* context,
size_t num_iterations);
128 virtual void create(ID3D11Device* device, UINT volume_size);
151 void set_inject_shader(ID3D11VertexShader* vs, ID3D11GeometryShader* gs, ID3D11PixelShader* ps, ID3D11PixelShader* ps_normalize, UINT inject_rsm_start_slot);
171 void set_propagate_shader(ID3D11Device* device, ID3D11VertexShader* vs, ID3D11GeometryShader* gs, ID3D11PixelShader* ps, ID3DBlob* input_binary, UINT propagate_start_slot);
183 virtual void inject(ID3D11DeviceContext* context,
gbuffer& rsm,
bool clear);
186 void render(ID3D11DeviceContext* context);
195 void visualize(ID3D11DeviceContext* context,
d3d_mesh* node, UINT debug_info_slot);
199 void set_model_matrix(ID3D11DeviceContext* context,
const DirectX::XMFLOAT4X4& model,
const DirectX::XMFLOAT3& lpv_min,
const DirectX::XMFLOAT3& lpv_max, UINT lpv_parameters_slot);
200 const DirectX::XMFLOAT4X4&
world_to_lpv()
const {
return world_to_lpv_; }
203 virtual void to_ps(ID3D11DeviceContext* context, UINT slot);
225 ID3D11BlendState* bs_negative_inject_;
226 ID3D11VertexShader* vs_direct_inject_;
230 struct cbs_delta_injection
244 virtual void create(ID3D11Device* device, UINT volume_size);
261 void inject(ID3D11DeviceContext* context,
gbuffer& rsm,
bool clear,
bool is_direct,
float scale);
269 void render_direct(ID3D11DeviceContext* context,
size_t num_iterations, UINT lpv_out_start_slot);
void render_direct(ID3D11DeviceContext *context, size_t num_iterations, UINT lpv_out_start_slot)
Render/propagate direct injects.
Definition: light_propagation_volume.cpp:698
void propagate_direct(ID3D11DeviceContext *context, size_t num_iterations)
Render/propagate direct injects.
Definition: light_propagation_volume.cpp:610
cb_gi_parameters & parameters()
Return local cbuffer parameters.
Definition: light_propagation_volume.h:133
void inject(ID3D11DeviceContext *context, gbuffer &rsm, bool clear, bool is_direct, float scale)
Overwrites the default injection to include direct injects.
Definition: light_propagation_volume.cpp:534
A Delta Light Propagation Volume (DLPV).
Definition: light_propagation_volume.h:222
void set_propagate_shader(ID3D11Device *device, ID3D11VertexShader *vs, ID3D11GeometryShader *gs, ID3D11PixelShader *ps, ID3DBlob *input_binary, UINT propagate_start_slot)
Set the complete propagation shader.
Definition: light_propagation_volume.cpp:478
const cb_gi_parameters & parameters() const
Return local cbuffer parameters.
Definition: light_propagation_volume.h:134
A Light Propagation Volume.
Definition: light_propagation_volume.h:32
A shader resource wrapper.
Definition: shader_resource.h:24
virtual void destroy()
Destroy the shader_resource and free all memory.
Definition: light_propagation_volume.cpp:203
void render_indirect(ID3D11DeviceContext *context)
Render/propagate indirect injects.
Definition: light_propagation_volume.cpp:713
virtual void to_ps(ID3D11DeviceContext *context, UINT slot)
Upload the shader resource to register slot of a pixel shader.
Definition: light_propagation_volume.cpp:398
void set_inject_shader(ID3D11VertexShader *vs, ID3D11GeometryShader *gs, ID3D11PixelShader *ps, ID3D11PixelShader *ps_normalize, UINT inject_rsm_start_slot)
Set the complete injection shader.
Definition: light_propagation_volume.cpp:468
void visualize(ID3D11DeviceContext *context, d3d_mesh *node, UINT debug_info_slot)
A rendering function to visualize the LPV with colored cubes for each voxel.
Definition: light_propagation_volume.cpp:499
A wrapper class for a sampler state.
Definition: shader_resource.h:49
size_t num_propagations() const
Get/set the number of propagation steps for the LPV.
Definition: light_propagation_volume.h:190
const DirectX::XMFLOAT4X4 & world_to_lpv() const
Set/get the world -> LPV matrix, which transforms world coordinates to LPV volume coordinates...
Definition: light_propagation_volume.h:200
virtual void destroy()
Destroy the shader_resource and free all memory.
Definition: light_propagation_volume.cpp:688
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...
Definition: light_propagation_volume.cpp:176
A GPU profiler.
Definition: d3d_tools.h:23
A render target wrapper.
Definition: render_target.h:30
void render(ID3D11DeviceContext *context)
Run the normalization and propagation of the LPV.
Definition: light_propagation_volume.cpp:455
A geometry buffer (collection of render_target objects).
Definition: gbuffer.h:30
void set_direct_inject_shader(ID3D11VertexShader *ps)
Additionally to the regular indirect injection shader, this will set the direct injection pixel shade...
Definition: light_propagation_volume.cpp:683
Main D3D mesh interface class.
Definition: mesh.h:129
void set_num_propagations(size_t n)
Get/set the number of propagation steps for the LPV.
Definition: light_propagation_volume.h:191
virtual void inject(ID3D11DeviceContext *context, gbuffer &rsm, bool clear)
Inject VPLs from an RSM into the LPV.
Definition: light_propagation_volume.cpp:254