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

A full global illumination renderer. More...

Inheritance diagram for gi_renderer:
dc::rsm_renderer< dune::directional_light > dc::common_renderer dune::deferred_renderer

Public Member Functions

void reload_shader (ID3D11Device *device, ID3D11DeviceContext *context)
 A function called if the shaders should be reloaded.
 
virtual void save (dune::serializer &s)
 Saves dune objects used in the common_renderer. Overload to add more.
 
virtual void load (ID3D11DeviceContext *context, const dune::serializer &s)
 Load dune objects used in the common_renderer. Overload to add more.
 
- Public Member Functions inherited from dc::rsm_renderer< dune::directional_light >
void update_light_parameters (ID3D11DeviceContext *context, dune::directional_light &l)
 Update and upload parameters (view projection matrix, flux etc.) of a directional light.
 
- Public Member Functions inherited from dc::common_renderer
virtual void resize (UINT width, UINT height)
 Resize the deferred_renderer's output to a new width/height .
 
virtual void update_postprocessing_parameters (ID3D11DeviceContext *context)
 Upload postprocessing paraemters from the postporcessing pipeline.
 
virtual void update_frame (ID3D11DeviceContext *context, double time, float elapsed_time)
 Update function for everything called once a frame.
 
virtual void update_camera (ID3D11DeviceContext *context, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 Update function called for the camera.
 
void set_shader (ID3D11Device *device, ID3DBlob *input_binary, ID3D11VertexShader *vs_deferred, ID3D11PixelShader *ps_deferred, ID3D11PixelShader *ps_overlay, UINT start_slot, UINT overlay_slot, UINT postprocessing_slot)
 Set deferred rendering shaders. More...
 
- Public Member Functions inherited from dune::deferred_renderer
void start_capture (ID3D11Device *device, size_t width, size_t height, size_t fps)
 Capture the backbuffer and write it to an MP4 video file. More...
 
void stop_capture ()
 Stop capturing and finalize an MP4 video file.
 
const buffer_collection & buffers ()
 Returns the map containing all buffers indexed by their registers.
 
void add_buffer (gbuffer &buffer, UINT slot)
 Add a gbuffer to the deferred renderer buffer map. More...
 
void add_buffer (texture &target, UINT slot)
 Add a render_target to the buffer map.
 
void set_postprocessor (postprocessor *pp)
 Set a postprocessor to use. If this isn't called or set to nullptr, the deferred renderer output is displayed directly.
 
void show_target (ID3D11DeviceContext *context, const tstring &name)
 Select a render_target by name to display in a small overlay when rendering.
 

Protected Member Functions

void render_volume (ID3D11DeviceContext *context, float *clear_color)
 Render/compute the GI volume, whether it be LPV or SVO.
 
void render_gi (ID3D11DeviceContext *context, float *clear_color)
 Compute global illumination for the scene. More...
 
- Protected Member Functions inherited from dc::rsm_renderer< dune::directional_light >
void update_rsm_camera_parameters (ID3D11DeviceContext *context, dune::directional_light &l)
 Update and upload RSM camera parameters (i.e. light view projection matrix etc.).
 
void render_rsm (ID3D11DeviceContext *context, float *clear_color, dune::gbuffer &rsm)
 Render a scene from a directional_light position into an RSM.
 
virtual void do_render_rsm (ID3D11DeviceContext *context)
 Virtual function to render more stuff for the RSM.
 
- Protected Member Functions inherited from dc::common_renderer
virtual void do_render_scene (ID3D11DeviceContext *context)
 Derived classes can overload this method to call render() on more dune objects. Buffers etc. are all set up already.
 
void reset_omrtv (ID3D11DeviceContext *context)
 Resets all render target views to nullptr.
 
void update_bbox (ID3D11DeviceContext *context, dune::d3d_mesh &mesh)
 Upload the bounding box of a mesh to the pixel shader.
 
void update_camera_parameters (ID3D11DeviceContext *context)
 Upload camera parameters to the respective shaders.
 
void update_scene (ID3D11DeviceContext *context, const DirectX::XMMATRIX &world)
 Update the scene with a new model matrix to move/scale/... stuff.
 
void update_onetime_parameters (ID3D11DeviceContext *context, dune::d3d_mesh &mesh)
 Upload one-time parameters (really just once) such as noise textures.
 
void render_scene (ID3D11DeviceContext *context, float *clear_color, ID3D11DepthStencilView *dsv)
 Clear the GBufer and render the scene.
 
- Protected Member Functions inherited from dune::deferred_renderer
void overlay (ID3D11DeviceContext *context, ID3D11RenderTargetView *backbuffer)
 Render a selected target into a small preview window on top of the backbuffer.
 
void deferred (ID3D11DeviceContext *context, ID3D11RenderTargetView *backbuffer)
 Render the deferred pass with an optional postprocessing pass.
 

Detailed Description

A full global illumination renderer.

This class implements an rsm_renderer and enhances it to provide a full scale GI solution. This is done via Light Propagation Volumes or Voxel Cone Tracing. Because both are volumetric solutions and share almost all code, you can switch between both with a define #LPV. If #LPV is set, a Light Propagation Volume is used, otherwise a Sparse Voxel Octree will be instaniated.

Member Function Documentation

void gi_renderer::render_gi ( ID3D11DeviceContext *  context,
float *  clear_color 
)
inlineprotected

Compute global illumination for the scene.

This method first makes sure that the RSM/GI solution needs to be updated. If so, a new RSM is rendered for one directional light, which will then be injected into a volume and further processed.

References dune::profile_query::begin(), dc::rsm_renderer< dune::directional_light >::render_rsm(), render_volume(), dune::profile_query::result(), and dc::rsm_renderer< dune::directional_light >::update_rsm_camera_parameters().


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