Support Forum       G3D Web Page     
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
G3D::LightingEnvironment Class Reference

Lighting environment (not just "environment map") intended for hardware rendering using screen-space approximations of indirect light. More...

Public Member Functions

 LightingEnvironment ()
 
 LightingEnvironment (const Any &any)
 
void copyScreenSpaceBuffers (const shared_ptr< Framebuffer > &framebuffer, const Vector2int16 colorGuardBand, const Vector2int16 depthGuardBand)
 
void getIndirectIlluminationProducingLights (Array< shared_ptr< Light > > &array) const
 Appends onto the array. More...
 
void getNonShadowCastingLights (Array< shared_ptr< Light > > &array) const
 Appends onto the array. More...
 
int numShadowCastingLights () const
 
void removeShadowCastingLights ()
 Changes the order of the remaining lights. More...
 
const Vector2int16 screenColorGuardBand () const
 For screenColorTexture(). More...
 
const shared_ptr< Texture > & screenColorTexture () const
 An image of the color buffer. More...
 
const Vector2int16 screenDepthGuardBand () const
 
const shared_ptr< Texture > & screenDepthTexture () const
 Used for screen-space reflection and refraction effects. More...
 
void setShaderArgs (UniformTable &args, const String &prefix="") const
 Binds: More...
 
void setToDemoLightingEnvironment ()
 Creates a default lighting environment for demos, which uses the file on the noonclouds/noonclouds_*.jpg textures. More...
 
AnysourceAny ()
 Intended for scene editors. More...
 
Any toAny () const
 

Public Attributes

shared_ptr< AmbientOcclusionambientOcclusion
 
AmbientOcclusionSettings ambientOcclusionSettings
 
Array< shared_ptr< DDGIVolume > > ddgiVolumeArray
 
Array< DDGIVolumeSpecificationddgiVolumeSpecificationArray
 
Array< shared_ptr< Texture > > environmentMapArray
 All environment map contributions are summed. More...
 
Array< float > environmentMapWeightArray
 If the array is empty, all elements are treated as 1.0. More...
 
Array< shared_ptr< Light > > lightArray
 
shared_ptr< UniformTableuniformTable
 Additional arguments passed when setShaderArgs() is invoked (if notNull). More...
 

Protected Member Functions

void maybeCopyBuffers () const
 

Protected Attributes

Any m_any
 
Vector2int16 m_copiedScreenColorGuardBand
 
shared_ptr< Texturem_copiedScreenColorTexture
 
Vector2int16 m_copiedScreenDepthGuardBand
 
shared_ptr< Texturem_copiedScreenDepthTexture
 

Detailed Description

Lighting environment (not just "environment map") intended for hardware rendering using screen-space approximations of indirect light.

If enabled, uses DDGI for ray-traced diffuse global illumination.

Constructor & Destructor Documentation

◆ LightingEnvironment() [1/2]

G3D::LightingEnvironment::LightingEnvironment ( )

◆ LightingEnvironment() [2/2]

G3D::LightingEnvironment::LightingEnvironment ( const Any any)

Member Function Documentation

◆ copyScreenSpaceBuffers()

void G3D::LightingEnvironment::copyScreenSpaceBuffers ( const shared_ptr< Framebuffer > &  framebuffer,
const Vector2int16  colorGuardBand,
const Vector2int16  depthGuardBand 
)

◆ getIndirectIlluminationProducingLights()

void G3D::LightingEnvironment::getIndirectIlluminationProducingLights ( Array< shared_ptr< Light > > &  array) const

Appends onto the array.

◆ getNonShadowCastingLights()

void G3D::LightingEnvironment::getNonShadowCastingLights ( Array< shared_ptr< Light > > &  array) const

Appends onto the array.

◆ maybeCopyBuffers()

void G3D::LightingEnvironment::maybeCopyBuffers ( ) const
protected

◆ numShadowCastingLights()

int G3D::LightingEnvironment::numShadowCastingLights ( ) const

◆ removeShadowCastingLights()

void G3D::LightingEnvironment::removeShadowCastingLights ( )

Changes the order of the remaining lights.

◆ screenColorGuardBand()

const Vector2int16 G3D::LightingEnvironment::screenColorGuardBand ( ) const
inline

◆ screenColorTexture()

const shared_ptr<Texture>& G3D::LightingEnvironment::screenColorTexture ( ) const
inline

An image of the color buffer.

This is a copy of the previous buffer; it is never the Texture currently being rendered to.

Commonly used for screen-space reflection and refraction effects.

Returns the all-black texture if not currently allocated

◆ screenDepthGuardBand()

const Vector2int16 G3D::LightingEnvironment::screenDepthGuardBand ( ) const
inline

◆ screenDepthTexture()

const shared_ptr<Texture>& G3D::LightingEnvironment::screenDepthTexture ( ) const
inline

Used for screen-space reflection and refraction effects.

Currently nullptr, likely to be replaced with a linear camera-space Z value in a future release.

See also
screenColorTexture

◆ setShaderArgs()

void G3D::LightingEnvironment::setShaderArgs ( UniformTable args,
const String prefix = "" 
) const

Binds:

prefix+light$(I)_ ... [See G3D::Light::setShaderArgs]
uniform samplerCube prefix+environmentMap$(J)_buffer;
uniform float prefix+environmentMap$(J)_scale;
uniform float prefix+environmentMap$(J)_glossyMIPConstant;
prefix+ambientOcclusion_ ... [See G3D::AmbientOcclusion::setShaderArgs]

◆ setToDemoLightingEnvironment()

void G3D::LightingEnvironment::setToDemoLightingEnvironment ( )

Creates a default lighting environment for demos, which uses the file on the noonclouds/noonclouds_*.jpg textures.

The code that it uses is below. Note that this loads a cube map every time that it is invoked, so this should not be used within the rendering loop.

◆ sourceAny()

Any& G3D::LightingEnvironment::sourceAny ( )
inline

Intended for scene editors.

◆ toAny()

Any G3D::LightingEnvironment::toAny ( ) const

Member Data Documentation

◆ ambientOcclusion

shared_ptr<AmbientOcclusion> G3D::LightingEnvironment::ambientOcclusion

◆ ambientOcclusionSettings

AmbientOcclusionSettings G3D::LightingEnvironment::ambientOcclusionSettings

◆ ddgiVolumeArray

Array<shared_ptr<DDGIVolume> > G3D::LightingEnvironment::ddgiVolumeArray

◆ ddgiVolumeSpecificationArray

Array<DDGIVolumeSpecification> G3D::LightingEnvironment::ddgiVolumeSpecificationArray

◆ environmentMapArray

Array< shared_ptr<Texture> > G3D::LightingEnvironment::environmentMapArray

All environment map contributions are summed.

Environment maps are scaled by a factor of PI when sampled because most environment maps are authored too dark, since legacy shaders often dropped that factor from the Lambertian denominator.

◆ environmentMapWeightArray

Array<float> G3D::LightingEnvironment::environmentMapWeightArray

If the array is empty, all elements are treated as 1.0.

◆ lightArray

Array< shared_ptr<Light> > G3D::LightingEnvironment::lightArray

◆ m_any

Any G3D::LightingEnvironment::m_any
protected

Referenced by sourceAny().

◆ m_copiedScreenColorGuardBand

Vector2int16 G3D::LightingEnvironment::m_copiedScreenColorGuardBand
protected
See also
GBuffer:colorGuardBandThickness

Referenced by screenColorGuardBand().

◆ m_copiedScreenColorTexture

shared_ptr<Texture> G3D::LightingEnvironment::m_copiedScreenColorTexture
protected

Referenced by screenColorTexture().

◆ m_copiedScreenDepthGuardBand

Vector2int16 G3D::LightingEnvironment::m_copiedScreenDepthGuardBand
protected
See also
GBuffer:depthGuardBandThickness

Referenced by screenDepthGuardBand().

◆ m_copiedScreenDepthTexture

shared_ptr<Texture> G3D::LightingEnvironment::m_copiedScreenDepthTexture
protected

Referenced by screenDepthTexture().

◆ uniformTable

shared_ptr<UniformTable> G3D::LightingEnvironment::uniformTable

Additional arguments passed when setShaderArgs() is invoked (if notNull).

This helps when prototyping new shader-based effects that require new uniform arguments. This is a pointer because it may contiain significant state and many renderers clone the lighting environment.


documentation generated on Wed Nov 24 2021 08:01:57 using doxygen 1.8.15