Blender V5.0
blender::eevee::GBuffer Class Reference

#include <eevee_gbuffer.hh>

Public Member Functions

void acquire (int2 extent, int header_count, int data_count, int normal_count)
void bind (Framebuffer &gbuffer_fb)
void release ()
template<typename PassType>
void bind_resources (PassType &pass)
template<typename PassType>
void bind_optional_layers (PassType &pass)

Public Attributes

Texture header_tx = {"GBufferHeader"}
Texture closure_tx = {"GBufferClosure"}
Texture normal_tx = {"GBufferNormal"}
const uint header_fb_layer_count = GBUF_HEADER_FB_LAYER_COUNT
const uint closure_fb_layer_count = GBUF_CLOSURE_FB_LAYER_COUNT
const uint normal_fb_layer_count = GBUF_NORMAL_FB_LAYER_COUNT

Detailed Description

Full-screen textures containing geometric and surface data. Used by deferred shading passes. Only one g-buffer is allocated per view and is reused for each deferred layer. This is why there can only be temporary texture inside it.

Everything is stored inside two array texture, one for each format. This is to fit the limitation of the number of images we can bind on a single shader.

The content of the g-buffer is polymorphic. A 8bit header specify the layout of the data. The first layer is always written to while others are written only if needed using imageStore operations reducing the bandwidth needed. Except for some special configurations, the g-buffer holds up to 3 closures.

For each output closure, we also output the color to apply after the lighting computation. The color is stored with a 2 exponent that allows input color with component higher than 1. Color degradation is expected to happen in this case.

Here are special configurations:

  • Opaque Dielectric:
    • 1 Diffuse lobe and 1 Reflection lobe without anisotropy.
    • Share a single normal.
    • Reflection is not colored.
    • Layout:
      • Color 1 : Diffuse color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Roughness (isotropic)
      • Closure 1 A : Reflection intensity
  • Simple Car-paint: (TODO)
    • 2 Reflection lobe without anisotropy.
    • Share a single normal.
    • Coat layer is not colored.
    • Layout:
      • Color 1 : Bottom layer color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Roughness (isotropic)
      • Closure 1 A : Coat layer intensity
  • Simple Glass: (TODO)
    • 1 Refraction lobe and 1 Reflection lobe without anisotropy.
    • Share a single normal.
    • Reflection intensity is derived from IOR.
    • Layout:
      • Color 1 : Refraction color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Roughness (isotropic)
      • Closure 1 A : IOR

Here are Closure configurations:

  • Reflection (Isotropic):
    • Layout:
      • Color : Reflection color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Roughness
      • Closure 1 A : Unused
  • Reflection (Anisotropic): (TODO)
    • Layout:
      • Color : Reflection color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Tangent packed X
      • Closure 1 A : Tangent packed Y
      • Closure 2 R : Roughness X
      • Closure 2 G : Roughness Y
      • Closure 2 B : Unused
      • Closure 2 A : Unused
  • Refraction (Isotropic):
    • Layout:
      • Color : Refraction color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Roughness
      • Closure 1 A : IOR
  • Diffuse:
    • Layout:
      • Color : Diffuse color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Unused
      • Closure 1 A : Unused (Could be used for diffuse roughness)
  • Sub-Surface Scattering:

    • Layout:
      • Color : Diffuse color
      • Closure 1 R : Normal packed X
      • Closure 1 G : Normal packed Y
      • Closure 1 B : Thickness
      • Closure 1 A : Unused (Could be used for diffuse roughness)
      • Closure 2 R : Scattering radius R
      • Closure 2 G : Scattering radius G
      • Closure 2 B : Scattering radius B
      • Closure 2 A : Object ID

    contains persistent data.

Definition at line 130 of file eevee_gbuffer.hh.

Member Function Documentation

◆ acquire()

void blender::eevee::GBuffer::acquire ( int2 extent,
int header_count,
int data_count,
int normal_count )
inline

◆ bind()

◆ bind_optional_layers()

template<typename PassType>
void blender::eevee::GBuffer::bind_optional_layers ( PassType & pass)
inline

◆ bind_resources()

template<typename PassType>
void blender::eevee::GBuffer::bind_resources ( PassType & pass)
inline

Definition at line 235 of file eevee_gbuffer.hh.

References closure_tx, header_tx, and normal_tx.

◆ release()

void blender::eevee::GBuffer::release ( )
inline

Definition at line 223 of file eevee_gbuffer.hh.

Referenced by blender::eevee::PlanarProbeModule::set_view().

Member Data Documentation

◆ closure_fb_layer_count

const uint blender::eevee::GBuffer::closure_fb_layer_count = GBUF_CLOSURE_FB_LAYER_COUNT

Definition at line 139 of file eevee_gbuffer.hh.

Referenced by acquire().

◆ closure_tx

Texture blender::eevee::GBuffer::closure_tx = {"GBufferClosure"}

◆ header_fb_layer_count

const uint blender::eevee::GBuffer::header_fb_layer_count = GBUF_HEADER_FB_LAYER_COUNT

Definition at line 138 of file eevee_gbuffer.hh.

Referenced by acquire().

◆ header_tx

Texture blender::eevee::GBuffer::header_tx = {"GBufferHeader"}

◆ normal_fb_layer_count

const uint blender::eevee::GBuffer::normal_fb_layer_count = GBUF_NORMAL_FB_LAYER_COUNT

Definition at line 140 of file eevee_gbuffer.hh.

Referenced by acquire().

◆ normal_tx

Texture blender::eevee::GBuffer::normal_tx = {"GBufferNormal"}

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