9 #ifndef DUNE_SPARSE_VOXEL_OCTREE
10 #define DUNE_SPARSE_VOXEL_OCTREE
54 ID3D11BlendState* bs_voxelize_;
55 ID3D11SamplerState* ss_visualize_;
57 ID3D11VertexShader* vs_voxelize_;
58 ID3D11GeometryShader* gs_voxelize_;
59 ID3D11PixelShader* ps_voxelize_;
61 ID3D11VertexShader* vs_inject_;
62 ID3D11PixelShader* ps_inject_;
64 INT inject_rsm_rho_start_slot_;
66 ID3D11Texture3D* v_normal_;
67 ID3D11Texture3D* v_rho_;
69 ID3D11ShaderResourceView* srv_v_normal_;
70 ID3D11ShaderResourceView* srv_v_rho_;
72 ID3D11UnorderedAccessView* uav_v_normal_;
73 ID3D11UnorderedAccessView* uav_v_rho_;
75 ID3D11RasterizerState* no_culling_;
79 DirectX::XMFLOAT4X4 world_to_svo_;
80 DirectX::XMFLOAT3 svo_min_, svo_max_;
85 DirectX::XMFLOAT4 bb_min;
86 DirectX::XMFLOAT4 bb_max;
99 virtual void clear_ps(ID3D11DeviceContext* context);
102 float time_voxelize_;
116 virtual void create(ID3D11Device* device, UINT volume_size);
129 void set_shader_voxelize(ID3D11VertexShader* vs, ID3D11GeometryShader* gs, ID3D11PixelShader* ps);
142 void set_shader_inject(ID3D11VertexShader* vs, ID3D11PixelShader* ps, UINT rsm_start_slot);
151 void filter(ID3D11DeviceContext* context);
155 void set_model_matrix(ID3D11DeviceContext* context,
const DirectX::XMFLOAT4X4& model,
const DirectX::XMFLOAT3& svo_min,
const DirectX::XMFLOAT3& svo_max, UINT svo_parameters_slot);
156 const DirectX::XMFLOAT4X4&
world_to_svo()
const {
return world_to_svo_; }
159 virtual void to_ps(ID3D11DeviceContext* context, UINT volume_start_slot);
181 ID3D11Texture3D* v_delta_;
182 ID3D11ShaderResourceView* srv_v_delta_;
183 ID3D11UnorderedAccessView* uav_v_delta_;
185 INT inject_rsm_mu_start_slot_;
188 virtual void clear_ps(ID3D11DeviceContext* context);
194 virtual void create(ID3D11Device* device, UINT volume_size);
197 void set_shader_inject(ID3D11VertexShader* vs, ID3D11PixelShader* ps, UINT mu_start_slot, UINT rho_start_slot);
200 virtual void to_ps(ID3D11DeviceContext* context, UINT volume_start_slot);
void set_shader_voxelize(ID3D11VertexShader *vs, ID3D11GeometryShader *gs, ID3D11PixelShader *ps)
Set the complete voxelization shader.
Definition: sparse_voxel_octree.cpp:269
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.
Definition: sparse_voxel_octree.cpp:284
const cb_gi_parameters & parameters() const
Return local cbuffer parameters.
Definition: sparse_voxel_octree.h:113
virtual void destroy()
Destroy the shader_resource and free all memory.
Definition: sparse_voxel_octree.cpp:165
A shader resource wrapper.
Definition: shader_resource.h:24
void set_shader_inject(ID3D11VertexShader *vs, ID3D11PixelShader *ps, UINT rsm_start_slot)
Set the complete injection shader.
Definition: sparse_voxel_octree.cpp:276
virtual void to_ps(ID3D11DeviceContext *context, UINT volume_start_slot)
Upload the shader resource to register slot of a pixel shader.
Definition: sparse_voxel_octree.cpp:258
void filter(ID3D11DeviceContext *context)
Pre-filter (i.e. mip-map) the SVO.
Definition: sparse_voxel_octree.cpp:242
virtual void inject(ID3D11DeviceContext *context, directional_light &light)
Inject a bounce from directional_light into the SVO.
Definition: sparse_voxel_octree.cpp:198
A simple directional light source with an RSM.
Definition: light.h:28
Default implementation of assimp_mesh (pun intended).
Definition: assimp_mesh.h:113
cb_gi_parameters & parameters()
Return local cbuffer parameters.
Definition: sparse_voxel_octree.h:112
virtual void destroy()
Destroy the shader_resource and free all memory.
Definition: sparse_voxel_octree.cpp:434
A differential directional light source.
Definition: light.h:82
virtual void to_ps(ID3D11DeviceContext *context, UINT volume_start_slot)
Upload the shader resource to register slot of a pixel shader.
Definition: sparse_voxel_octree.cpp:391
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...
Definition: sparse_voxel_octree.cpp:125
A GPU profiler.
Definition: d3d_tools.h:23
A Delta Radiance Field of an SVO necessary for Delta Voxel Cone Tracing (DVCT)
Definition: sparse_voxel_octree.h:178
Basic interface of a mesh.
Definition: mesh.h:102
A sparse voxel octree (SVO).
Definition: sparse_voxel_octree.h:42
const DirectX::XMFLOAT4X4 & world_to_svo() const
Set/get the world -> SVO matrix, which transforms world coordinates to SVO volume coordinates...
Definition: sparse_voxel_octree.h:156