Blender V4.3
blender::eevee::GBuffer Class Reference

#include <eevee_gbuffer.hh>

Public Member Functions

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

Public Attributes

Texture header_tx = {"GBufferHeader"}
Texture closure_tx = {"GBufferClosure"}
Texture normal_tx = {"GBufferNormal"}
GPUTexture * closure_img_tx = nullptr
GPUTexture * normal_img_tx = nullptr

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 127 of file eevee_gbuffer.hh.

Member Function Documentation

◆ acquire()

◆ bind()

◆ bind_resources()

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

Definition at line 196 of file eevee_gbuffer.hh.

References closure_tx, header_tx, and normal_tx.

◆ release()

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

Definition at line 185 of file eevee_gbuffer.hh.

References closure_img_tx, and normal_img_tx.

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

Member Data Documentation

◆ closure_img_tx

GPUTexture* blender::eevee::GBuffer::closure_img_tx = nullptr

◆ closure_tx

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

◆ header_tx

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

◆ normal_img_tx

GPUTexture* blender::eevee::GBuffer::normal_img_tx = nullptr

◆ normal_tx

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

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