struct mrpt::opengl::TLightParameters

Overview

Unidirectional lighting model parameters for triangle shaders.

Refer to standard OpenGL literature and tutorials for the meaning of each field, and to the shader GLSL code itself.

#include <mrpt/opengl/TLightParameters.h>

struct TLightParameters
{
    // fields

    mrpt::img::TColorf color = {1.0f, 1.0f, 1.0f};
    float diffuse = 0.8f;
    float ambient = 0.2f;
    float specular = 0.95f;
    mrpt::math::TVector3Df direction = {-0.40825f, -0.40825f, -0.81650f};
    float shadow_bias = 1e-5;
    float shadow_bias_cam2frag = 1e-5;
    float shadow_bias_normal = 1e-4;
    double eyeDistance2lightShadowExtension = 2.0;
    float minimum_shadow_map_extension_ratio = 0.03f;

    // construction

    TLightParameters();

    // methods

    void writeToStream(mrpt::serialization::CArchive& out) const;
    void readFromStream(mrpt::serialization::CArchive& in);
};

Fields

mrpt::math::TVector3Df direction = {-0.40825f, -0.40825f, -0.81650f}

Light direction (must be normalized)

float shadow_bias = 1e-5

Shadow tuning parameters (“anti shadow acne”)

double eyeDistance2lightShadowExtension = 2.0

Multiplier from eye distance to the length size of the squared area in which to evaluate shadow casting by unidirectional light.

Unitless (meter/meter). (New in MRPT 2.10.0)

float minimum_shadow_map_extension_ratio = 0.03f

Minimum extension (in [0,1] ratio of the light distance) of the shadow map square ortho frustum.

Should be roughly the maximum area of the largest room for indoor environments to ensure no missing shadows in distant areas.

(New in MRPT 2.10.0)