Performs deferred rendering of a scene.
More...
#include <DeferredRenderer.hpp>
|
| DeferredRenderer (const glm::vec2 &resolution, bool ssao, const std::string &name) |
|
void | setScene (const std::shared_ptr< Scene > &scene) |
|
void | draw (const Camera &camera, Texture *dstColor, Texture *dstDepth, uint layer=0) override |
|
void | resize (uint width, uint height) override |
|
void | interface () override |
|
Texture & | sceneDepth () |
|
| Renderer (const std::string &name) |
|
virtual void | draw (const Camera &camera, Texture *dstColor, Texture *dstDepth, uint layer=0) |
|
virtual void | resize (uint width, uint height) |
|
virtual void | interface () |
|
virtual | ~Renderer ()=default |
|
| Renderer (const Renderer &)=delete |
|
Renderer & | operator= (const Renderer &)=delete |
|
| Renderer (Renderer &&)=delete |
|
Renderer & | operator= (Renderer &&)=delete |
|
Layout | outputColorFormat () const |
|
Layout | outputDepthFormat () const |
|
|
Texture | _sceneAlbedo |
| Scene albedo.
|
|
Texture | _sceneNormal |
| Scene normals.
|
|
Texture | _sceneEffects |
| Scene material parameters.
|
|
Texture | _sceneDepth |
| Scene depth.
|
|
Texture | _lighting |
| Lighting accumulation.
|
|
Texture | _indirectLighting |
| Indirect lighting accumulation.
|
|
Texture | _depthCopy |
| Lighting detph copy.
|
|
std::unique_ptr< SSAO > | _ssaoPass |
| SSAO processing.
|
|
std::unique_ptr< DeferredLight > | _lightRenderer |
| The lights renderer.
|
|
std::unique_ptr< DeferredProbe > | _probeRenderer |
| The probes renderer.
|
|
std::unique_ptr< ForwardLight > | _fwdLightsGPU |
| The lights forward renderer for transparent objects.
|
|
std::unique_ptr< ForwardProbe > | _fwdProbesGPU |
| The probes forward renderer for transparent objects.
|
|
Program * | _objectProgram |
| Basic PBR program.
|
|
Program * | _parallaxProgram |
| Parallax mapping PBR program.
|
|
Program * | _clearCoatProgram |
| Basic PBR program with an additional clear coat specular layer.
|
|
Program * | _anisotropicProgram |
| Basic PBR with anisotropic roughness.
|
|
Program * | _sheenProgram |
| PBR with sheen BRDF.
|
|
Program * | _iridescentProgram |
| PBR with iridescent Fresnel.
|
|
Program * | _subsurfaceProgram |
| PBR with subsurface scattering.
|
|
Program * | _emissiveProgram |
| Emissive program.
|
|
Program * | _transparentProgram |
| Transparent PBR program.
|
|
Program * | _transpIridProgram |
| Transparent PBR with iridescent Fresnel program.
|
|
Program * | _probeNormalization |
| Indirect lighting normalization program.
|
|
Program * | _skyboxProgram |
| Skybox program.
|
|
Program * | _bgProgram |
| Planar background program.
|
|
Program * | _atmoProgram |
| Atmospheric scattering program.
|
|
const Texture * | _textureBrdf |
| The BRDF lookup table.
|
|
std::shared_ptr< Scene > | _scene |
| The scene to render.
|
|
std::unique_ptr< Culler > | _culler |
| Objects culler.
|
|
bool | _applySSAO = true |
| Screen space ambient occlusion.
|
|
|
std::string | _name |
| Debug name.
|
|
Layout | _colorFormat = Layout::NONE |
| The preferred output format for a given renderer.
|
|
Layout | _depthFormat = Layout::NONE |
| The preferred output format for a given renderer.
|
|
Performs deferred rendering of a scene.
- See also
- DeferredLight, DeferredProbe, Material, GPUShaders::Common::Common_pbr
Objects material information is renderer in a G-buffer, packing the various parameters as efficiently as possible in a fixed number of texture channels. As many components as possible are reused between materials, and the precision of some parameters is lowered. See the Material class documentation for all parameter details.
Shared section:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
0: RGBA8 | Albedo/reflectance/emissive color | Material ID |
1: RGB10A2 | Normal octahedral XY | |
2: RGBA8 | |
Standard (& Parallax):
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | |
2: RGBA8 | Roughness | Metalness(5) | Ambient occlusion | |
- See also
- GPUShaders::Frag::Object_gbuffer, GPUShaders::Frag::Object_parallax_gbuffer
Clearcoat:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | |
2: RGBA8 | Roughness | Metal(5) Coating(3) | Ambient occlusion | Coat roughness |
- See also
- GPUShaders::Frag::Object_clearcoat_gbuffer
Anisotropic:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | Anisotropy angle | Anisotropy signs |
2: RGBA8 | Roughness | Metalness(5) | Ambient occlusion | Anisotropy |
- See also
- GPUShaders::Frag::Object_anisotropic_gbuffer
Sheen:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | Sheen color (3*4) |
2: RGBA8 | Roughness | Sheeness(5) | Ambient occlusion | Sheen roughness |
- See also
- GPUShaders::Frag::Object_sheen_gbuffer
Iridescent:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | Index of refraction | |
2: RGBA8 | Roughness | Metalness(5) | Ambient occlusion | Thickness |
- See also
- GPUShaders::Frag::Object_iridescent_gbuffer
Subsurface:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | Subsurface color (3*4) |
2: RGBA8 | Roughness | Subsurf rough(5) | Ambient occlusion | Thickness |
- See also
- GPUShaders::Frag::Object_subsurface_gbuffer
Emissive:
| _______Red_______ | ______Green______ | _______Blue______ | ______Alpha______ |
1: RGB10A2 | | Roughness | |
2: RGBA8 | Emissive intensity |
- See also
- GPUShaders::Frag::Object_emissive_gbuffer
The G-buffer is then read by each light, rendered as a geometric proxy onto the scene depth buffer and writing its lighting contribution to a lighting buffer. Ambient probes are processed similarly. Direct and ambient lighting are finally merged to generate the final image.
Transparent objects are rendered in a forward pass.
- See also
- GPUShaders::Frag::Object_transparent_forward, GPUShaders::Frag::Object_transparent_irid_forward
Inherits Renderer.
◆ DeferredRenderer()
DeferredRenderer::DeferredRenderer |
( |
const glm::vec2 & |
resolution, |
|
|
bool |
ssao, |
|
|
const std::string & |
name |
|
) |
| |
|
explicit |
Constructor.
- Parameters
-
resolution | the initial rendering resolution |
ssao | should screen space ambient occlusion be computed |
name | the debug name |
◆ draw()
void DeferredRenderer::draw |
( |
const Camera & |
camera, |
|
|
Texture * |
dstColor, |
|
|
Texture * |
dstDepth, |
|
|
uint |
layer = 0 |
|
) |
| |
|
overridevirtual |
Draw from a given viewpoint.
- Parameters
-
camera | the rendering viewpoint |
dstColor | the destination color texture (optional, see outputColorFormat) |
dstDepth | the destination depth texture (optional, see outputDepthFormat) |
layer | the layer to write to in the target |
Reimplemented from Renderer.
◆ interface()
void DeferredRenderer::interface |
( |
| ) |
|
|
overridevirtual |
Display GUI exposing renderer options.
- Note
- The renderer can assume that a GUI window is currently open.
Reimplemented from Renderer.
◆ renderBackground()
void DeferredRenderer::renderBackground |
( |
const glm::mat4 & |
view, |
|
|
const glm::mat4 & |
proj, |
|
|
const glm::vec3 & |
pos |
|
) |
| |
|
private |
Render the scene background to the G-buffer.
- Parameters
-
view | the camera view matrix |
proj | the camera projection matrix |
pos | the camera position |
◆ renderOpaque()
void DeferredRenderer::renderOpaque |
( |
const Culler::List & |
visibles, |
|
|
const glm::mat4 & |
view, |
|
|
const glm::mat4 & |
proj |
|
) |
| |
|
private |
Render the scene opaque objects.
- Parameters
-
visibles | list of indices of visible objects |
view | the camera view matrix |
proj | the camera projection matrix |
◆ renderTransparent()
void DeferredRenderer::renderTransparent |
( |
const Culler::List & |
visibles, |
|
|
const glm::mat4 & |
view, |
|
|
const glm::mat4 & |
proj |
|
) |
| |
|
private |
Render the scene transparent objects.
- Parameters
-
visibles | list of indices of visible objects |
view | the camera view matrix |
proj | the camera projection matrix |
◆ resize()
void DeferredRenderer::resize |
( |
uint |
width, |
|
|
uint |
height |
|
) |
| |
|
overridevirtual |
Handle a window resize event.
- Parameters
-
width | the new width |
height | the new height |
Reimplemented from Renderer.
◆ sceneDepth()
Texture & DeferredRenderer::sceneDepth |
( |
| ) |
|
- Returns
- the texture containing the scene depth information
◆ setScene()
void DeferredRenderer::setScene |
( |
const std::shared_ptr< Scene > & |
scene | ) |
|
Set the scene to render.
- Parameters
-
The documentation for this class was generated from the following files: