Support Forum       G3D Web Page     
Classes | Public Member Functions | Public Attributes | List of all members
glsl::Light_glsl Class Reference


Defines helper functions to calculate the light contribution to a specified point. More...

Classes

struct  Light
 
struct  ShadowMap
 

Public Member Functions

void addLightContribution (in vec3 n, in vec3 glossyN, in vec3 w_o, in vec3 wsPosition, in float glossyExponent, in vec4 light_position, in vec4 light_attenuation, in float light_softnessConstant, in vec3 light_look, in vec3 light_upVector, in vec3 light_rightVector, in bool light_rectangular, in float light_radius, in vec3 light_color, in float light_shadowMap_bias, in Matrix4 light_shadowMap_MVP, in sampler2DShadow light_shadowMap_texture_buffer, const in bool light_shadowMap_texture_notNull, in vec2 light_shadowMap_texture_invSize, in sampler2D light_shadowMap_vsmTexture_buffer, const in bool light_shadowMap_vsmTexture_notNull, in float light_shadowMap_vsmLightBleedReduction, in vec3 tan_Z, in float backside, inout vec3 I_lambertian, inout vec3 I_glossy, out vec3 w_i)
 
Computes the contribution of one light to I_lambertian and I_glossy, factoring in shadowing, distance attenuation, and spot light bounds. More...
 
float computeAttenuation (in vec3 n, in vec4 lightPosition, in vec4 lightAttenuation, in float lightSoftnessConstant, in vec3 wsPosition, in vec3 lightLook, in vec3 lightUpVector, in vec3 lightRightVector, in bool lightRectangular, in float lightRadius, out vec3 w_i)
 Computes attenuation due to angle and radial falloff. More...
 
void computeShading (in vec3 wsN, in vec3 wsGlossyN, in vec3 wsE, in float attenuation, in float glossyExponent, in vec3 lightColor, inout vec3 I_lambertian, inout vec3 I_glossy, in vec3 wsL)
 
float linstep (float minV, float maxV, float v)
 
float reduceLightBleeding (float p_max, float amount)
 
float shadowFetch (sampler2DShadow shadowMap, vec3 coord, vec2 invSize)
 
float shadowMapVisibility (vec3 lightDirection, vec4 lightPosition, vec4 lightAttenuation, vec4 shadowCoord, sampler2DShadow shadowMap, vec2 invSize, const bool highQualityFiltering)
 Returns a number between 0 = fully shadowed and 1 = fully lit. More...
 
float spotLightFalloff (vec3 w_i, vec3 lightLookVector, vec3 lightRightVector, vec3 lightUpVector, bool rectangular, float cosHalfAngle, float lightSoftnessConstant)
 Returns a number between 0 and 1 for how the light falls off due to the spot light's cone. More...
 
float varianceShadowMapVisibility (vec4 shadowCoord, float lightSpaceZ, sampler2D varianceShadowMap, float lightBleedReduction)
 Returns a number between 0 = fully shadowed and 1 = fully lit. More...
 

Public Attributes

const float attenuationThreshold = 2e-17
 Below this value, attenuation is treated as zero. More...
 

Detailed Description


Defines helper functions to calculate the light contribution to a specified point.

If HAS_NORMAL_BUMP_MAP is defined, then this file must have tan_Z and backside in scope

Member Function Documentation

◆ addLightContribution()

void glsl::Light_glsl::addLightContribution ( in vec3  n,
in vec3  glossyN,
in vec3  w_o,
in vec3  wsPosition,
in float  glossyExponent,
in vec4  light_position,
in vec4  light_attenuation,
in float  light_softnessConstant,
in vec3  light_look,
in vec3  light_upVector,
in vec3  light_rightVector,
in bool  light_rectangular,
in float  light_radius,
in vec3  light_color,
in float  light_shadowMap_bias,
in Matrix4  light_shadowMap_MVP,
in sampler2DShadow  light_shadowMap_texture_buffer,
const in bool  light_shadowMap_texture_notNull,
in vec2  light_shadowMap_texture_invSize,
in sampler2D  light_shadowMap_vsmTexture_buffer,
const in bool  light_shadowMap_vsmTexture_notNull,
in float  light_shadowMap_vsmLightBleedReduction,
in vec3  tan_Z,
in float  backside,
inout vec3  I_lambertian,
inout vec3  I_glossy,
out vec3  w_i 
)
inline


Computes the contribution of one light to I_lambertian and I_glossy, factoring in shadowing, distance attenuation, and spot light bounds.

◆ computeAttenuation()

float glsl::Light_glsl::computeAttenuation ( in vec3  n,
in vec4  lightPosition,
in vec4  lightAttenuation,
in float  lightSoftnessConstant,
in vec3  wsPosition,
in vec3  lightLook,
in vec3  lightUpVector,
in vec3  lightRightVector,
in bool  lightRectangular,
in float  lightRadius,
out vec3  w_i 
)
inline

Computes attenuation due to angle and radial falloff.

◆ computeShading()

void glsl::Light_glsl::computeShading ( in vec3  wsN,
in vec3  wsGlossyN,
in vec3  wsE,
in float  attenuation,
in float  glossyExponent,
in vec3  lightColor,
inout vec3  I_lambertian,
inout vec3  I_glossy,
in vec3  wsL 
)
inline

◆ linstep()

float glsl::Light_glsl::linstep ( float  minV,
float  maxV,
float  v 
)
inline

◆ reduceLightBleeding()

float glsl::Light_glsl::reduceLightBleeding ( float  p_max,
float  amount 
)
inline

◆ shadowFetch()

float glsl::Light_glsl::shadowFetch ( sampler2DShadow  shadowMap,
vec3  coord,
vec2  invSize 
)
inline

◆ shadowMapVisibility()

float glsl::Light_glsl::shadowMapVisibility ( vec3  lightDirection,
vec4  lightPosition,
vec4  lightAttenuation,
vec4  shadowCoord,
sampler2DShadow  shadowMap,
vec2  invSize,
const bool  highQualityFiltering 
)
inline

Returns a number between 0 = fully shadowed and 1 = fully lit.

Assumes that the shadowCoord is already within the spotlight cone.

◆ spotLightFalloff()

float glsl::Light_glsl::spotLightFalloff ( vec3  w_i,
vec3  lightLookVector,
vec3  lightRightVector,
vec3  lightUpVector,
bool  rectangular,
float  cosHalfAngle,
float  lightSoftnessConstant 
)
inline

Returns a number between 0 and 1 for how the light falls off due to the spot light's cone.

◆ varianceShadowMapVisibility()

float glsl::Light_glsl::varianceShadowMapVisibility ( vec4  shadowCoord,
float  lightSpaceZ,
sampler2D  varianceShadowMap,
float  lightBleedReduction 
)
inline

Returns a number between 0 = fully shadowed and 1 = fully lit.

Assumes that the shadowCoord is already within the spotlight cone.

Member Data Documentation

◆ attenuationThreshold

const float glsl::Light_glsl::attenuationThreshold = 2e-17

Below this value, attenuation is treated as zero.

This is non-zero only to avoid numerical imprecision.


documentation generated on Wed Nov 24 2021 08:02:04 using doxygen 1.8.15