Ocean
Ocean::Rendering::GlobalIllumination::Lighting Class Reference

This class implements object lighting functions. More...

Public Types

enum  LightingModes {
  LM_UNLIT = 0 , LM_SHADING_LAMBERT = (1 << 0) , LM_SHADING_SPECULAR = (1 << 1) | LM_SHADING_LAMBERT , LM_TRANSPARENCY = (1 << 2) ,
  LM_REFLECTION_SPECULAR = (1 << 3) , LM_REFRACTION_SPECULAR = (1 << 4) | LM_TRANSPARENCY , LM_SHADOWS = (1 << 5) , LM_SHADOWS_SUPERSAMPLE = (1 << 6) | LM_SHADOWS ,
  LM_SHADOWS_TRANSLUCENT_LIGHT = (1 << 7) | LM_SHADOWS , LM_SHADING_FULL = LM_SHADING_LAMBERT | LM_SHADING_SPECULAR , LM_REFLECTION_REFRACTION_FULL = LM_REFLECTION_SPECULAR | LM_REFRACTION_SPECULAR , LM_SHADOWS_FULL = LM_SHADOWS | LM_SHADOWS_SUPERSAMPLE | LM_SHADOWS_TRANSLUCENT_LIGHT ,
  LM_LIGHTING_FULL = LM_SHADING_FULL | LM_REFLECTION_REFRACTION_FULL | LM_SHADOWS_FULL
}
 Definition of individual lighting modes. More...
 

Static Public Member Functions

static bool dampedLight (const Vector3 &viewPosition, const Vector3 &viewObjectDirection, const Vector3 &objectPosition, const Vector3 &objectNormal, const Vector2 &textureCoordinate, const GIMaterial *material, const GITextures *textures, const LightSources &lightSources, const TracingObject &object, const TracingGroup &root, const unsigned int bounces, const LightingModes lightingModes, RGBAColor &color)
 Determines the light (the color) for a specified viewing ray, intersection point, appearance information and light sources, including damped light from translucent objects between the intersection object and all light sources. More...
 
static bool directLight (const Vector3 &viewObjectDirection, const Vector3 &objectPosition, const Vector3 &objectNormal, const Vector3 &lightObjectDirection, const RGBAColor &materialLightDiffuse, const RGBAColor &materialLightSpecular, const Scalar materialSpecularExponent, const LightingModes lightingModes, RGBAColor &diffuse, RGBAColor &specular)
 Determines the direct lighting for a specific location and light source using the Lambert shading with optional additional specular shading. More...
 
static RGBAColor lightDampingFactors (const Vector3 &lightPosition, const Vector3 &lightObjectDirection, const Scalar lightObjectDistance, const RGBAColor &lightColor, const TracingGroup &root, const LightingModes lightingModes)
 Determines the light damping factors for a specific position and light source. More...
 

Static Protected Member Functions

static Scalar pointLightAttenuationFactor (const Vector3 &lightAttenuation, const Scalar lightObjectDistance, const Scalar intensity)
 Returns the attenuation factor for a given point light. More...
 
static Scalar pointLightAttenuationFactorSqr (const Vector3 &lightAttenuation, const Scalar lightObjectDistanceSqr, const Scalar intensity)
 Returns the attenuation factor for a given point light. More...
 
static Scalar spotLightAttenuationFactor (const Vector3 &lightAttenuation, const Scalar lightObjectDistance, const Scalar intensity, const Vector3 &lightDirection, const Vector3 &lightObjectDirection, const Scalar coneAngleCos, const Scalar spotExponent)
 Returns the attenuation factor for a given spot light. More...
 

Detailed Description

This class implements object lighting functions.

Member Enumeration Documentation

◆ LightingModes

Definition of individual lighting modes.

Enumerator
LM_UNLIT 

No lighting is applied.

LM_SHADING_LAMBERT 

Lambert lighting is applied.

LM_SHADING_SPECULAR 

Lambert and specular lighting is applied.

LM_TRANSPARENCY 

Transparency is supported.

LM_REFLECTION_SPECULAR 

Specular reflection is supported.

LM_REFRACTION_SPECULAR 

Transparency and specular refraction is supported.

LM_SHADOWS 

Shadows are supported.

LM_SHADOWS_SUPERSAMPLE 

Supersample shadows are supported.

LM_SHADOWS_TRANSLUCENT_LIGHT 

Translucent shadows and light damping is supported.

LM_SHADING_FULL 

Full shading is supported.

LM_REFLECTION_REFRACTION_FULL 

Full reflection and refraction is supported.

LM_SHADOWS_FULL 

Full shadows are supported.

LM_LIGHTING_FULL 

Entire lighting functions are supported.

Member Function Documentation

◆ dampedLight()

static bool Ocean::Rendering::GlobalIllumination::Lighting::dampedLight ( const Vector3 viewPosition,
const Vector3 viewObjectDirection,
const Vector3 objectPosition,
const Vector3 objectNormal,
const Vector2 textureCoordinate,
const GIMaterial material,
const GITextures textures,
const LightSources lightSources,
const TracingObject object,
const TracingGroup root,
const unsigned int  bounces,
const LightingModes  lightingModes,
RGBAColor color 
)
static

Determines the light (the color) for a specified viewing ray, intersection point, appearance information and light sources, including damped light from translucent objects between the intersection object and all light sources.

Parameters
viewPositionThe start position of the viewing ray
viewObjectDirectionThe direction of the viewing ray
objectPositionThe intersction location of the viewing ray with any kind of object
objectNormalThe normal at the intersection location of the object
textureCoordinateThe texture coordinate at the location of the intersection
materialThe material information of the object which is intersected
texturesThe textures of the object
lightSourcesThe light sources defining the entire amount of light in the scene
objectThe tracing object which is intersected
rootThe root of all tracing objects defining the entire scene
bouncesThe number of reflection bounces to be used, with range [0, infinity)
lightingModesThe lighting modes defining lighting technique to be applied
colorThe resulting color/light for the defined viewing ray
Returns
True, if succeeded

◆ directLight()

static bool Ocean::Rendering::GlobalIllumination::Lighting::directLight ( const Vector3 viewObjectDirection,
const Vector3 objectPosition,
const Vector3 objectNormal,
const Vector3 lightObjectDirection,
const RGBAColor materialLightDiffuse,
const RGBAColor materialLightSpecular,
const Scalar  materialSpecularExponent,
const LightingModes  lightingModes,
RGBAColor diffuse,
RGBAColor specular 
)
static

Determines the direct lighting for a specific location and light source using the Lambert shading with optional additional specular shading.

The light as distributed from the light source is expected to be not attenuated by any obstacle between light and object.
However, the resulting color/light can be adjusted by any kind of adjustment factor e.g., to integrate any kind of attenuation.

Parameters
viewObjectDirectionDirection starting at the viewing position (the center of projection) and pointing to the object intersection location, with unit length
objectPositionThe location on the object where the viewing ray intersects the object
objectNormalThe normal on the object where the viewing ray intersects the object
lightObjectDirectionDirection starting at the light source and pointing to the object intersection location, with unit length
materialLightDiffuseCombination of diffuse light and material components
materialLightSpecularCombination of specular light and material components
materialSpecularExponentSpecular material exponent
lightingModesThe lighting modes defining lighting technique to be applied
diffuseResulting diffuse color
specularResulting specular color
Returns
True, if succeeded

◆ lightDampingFactors()

static RGBAColor Ocean::Rendering::GlobalIllumination::Lighting::lightDampingFactors ( const Vector3 lightPosition,
const Vector3 lightObjectDirection,
const Scalar  lightObjectDistance,
const RGBAColor lightColor,
const TracingGroup root,
const LightingModes  lightingModes 
)
static

Determines the light damping factors for a specific position and light source.

Parameters
lightPositionPosition of the light source
lightObjectDirectionDirection starting at the light source pointing to the object intersection position, with unit length
lightObjectDistanceDistance between the object's intersection point and the light source
lightColorColor of the light source
rootRoot tracing object
lightingModesThe lighting modes defining lighting technique to be applied
Returns
Resulting damping factors

◆ pointLightAttenuationFactor()

Scalar Ocean::Rendering::GlobalIllumination::Lighting::pointLightAttenuationFactor ( const Vector3 lightAttenuation,
const Scalar  lightObjectDistance,
const Scalar  intensity 
)
inlinestaticprotected

Returns the attenuation factor for a given point light.

Parameters
lightAttenuationConstant, linear and square light attenuation factors
lightObjectDistanceDistance between the object's intersection point and the light source
intensityIntensity of the light source, with range [0, 1]
Returns
Resulting attenuation factor

◆ pointLightAttenuationFactorSqr()

Scalar Ocean::Rendering::GlobalIllumination::Lighting::pointLightAttenuationFactorSqr ( const Vector3 lightAttenuation,
const Scalar  lightObjectDistanceSqr,
const Scalar  intensity 
)
inlinestaticprotected

Returns the attenuation factor for a given point light.

Parameters
lightAttenuationConstant, linear and square light attenuation factors
lightObjectDistanceSqrSquare distance between the object's intersection point and the light source, with range [0, infinity)
intensityIntensity of the light source, with range [0, 1]
Returns
Resulting attenuation factor

◆ spotLightAttenuationFactor()

Scalar Ocean::Rendering::GlobalIllumination::Lighting::spotLightAttenuationFactor ( const Vector3 lightAttenuation,
const Scalar  lightObjectDistance,
const Scalar  intensity,
const Vector3 lightDirection,
const Vector3 lightObjectDirection,
const Scalar  coneAngleCos,
const Scalar  spotExponent 
)
inlinestaticprotected

Returns the attenuation factor for a given spot light.

Parameters
lightAttenuationConstant, linear and square light attenuation factors
lightObjectDistanceDistance between the object's intersection point and the light source
intensityIntensity of the light source, with range [0, 1]
lightDirectionDirection of the spotlight starting at the light source pointing into the scene, with unit length
lightObjectDirectionDirection starting at the light source pointing to the object intersection position, with unit length
coneAngleCosCosine of the spont light cone angle
spotExponentLighting exponent of the spot light, with range [0, 128]
Returns
Resulting attenuation factor

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