XML3D Standard Light Shader Documentation

Point-Light

Example:
                <lightshader id="myPointLight" script="urn:xml3d:lightshader:point">
                  <bind semantic="intensity">
                        <float3>10.0 4.0 4.0</float3>
                  </bind>
                  <bind semantic="castShadow">
                        <bool>true</bool>
                  </bind>
                  <bind semantic="attenuation">
                        <float3>0 0 1</float3>
                  </bind>
                  <bind semantic="position">
                        <float3>2 0.5 5</float3>
                  </bind>
                </lightshader>

Parameters

Name Type Default Value Description
position <float3> 0 0 0 Determines the initial light position.
intensity <float3> 0 0 0 Specifies the light color (red, green, blue) where each component value usually ranges between 0 and 1.
attenuation <float3> 1 0 0 Sets up the square law attenuation where each component (a0, a1, a2) influences the attenuation according to the formula
1 / (a0 + a1 * d + a2 * d²)
Note that d states the distance in meter.
castShadow <bool> true Turns on/off shadow cast. Specify true to activate shadow cast and false otherwise.
castShadow <int> ≥1 Turns on/off shadow cast. Specify a value ≥1 to deactivate shadow cast and 0 otherwise.

Spotlight

Example:
                <lightshader id="myPointLight" script="urn:xml3d:lightshader:spot">
                  <bind semantic="intensity">
                        <float3>10.0 4.0 4.0</float3>
                  </bind>
                  <bind semantic="castShadow">
                        <bool>true</bool>
                  </bind>
                  <bind semantic="attenuation">
                        <float3>0 0 1</float3>
                  </bind>
                  <bind semantic="position">
                        <float3>2 0.5 5</float3>
                  </bind>
                  <bind semantic="beamWidth">
                        <float> 45.0 </float>
                  </bind>
                  <bind semantic="cutOffAngle">
                        <float> 45.0 </float>
                  </bind>
                  <bind semantic="direction">
                        <float3> 0 1 0 </float3>
                  </bind>
                </lightshader>

Parameters

Name Type Default Value Description
position <float3> 0 0 0 Determines the initial light position.
intensity <float3> 0 0 0 Specifies the light color (red, green, blue) where each component value usually ranges between 0 and 1.
attenuation <float3> 1 0 0 Sets up the square law attenuation where each component (a0, a1, a2) influences the attenuation according to the formula
1 / (a0 + a1 * d + a2 * d²)
Note that d states the distance in meter.
castShadow <bool> true Turns on/off shadow cast. Specify true to activate shadow cast and false otherwise.
castShadow <int> ≥1 Turns on/off shadow cast. Specify a value ≥1 to deactivate shadow cast and 0 otherwise.
direction <float3> 0 1 0 Determines the the aim of the light.
cutOffAngle <float> 45.0 Specifies the angle of the cone within which the light rays are constrained.
beamWidth <float> 45.0 Specifies the angle of the inner cone within which the light rays have a uniform intensity.

Directional Light

TODOs