Most X3D fields are interpreted using an obvious what-you-write-is-what-you-get scheme. However, some parameters make an exception, especially those who has somethong to do with lighting simulation. Indeed, X3D parameters sometimes have to tight a range and most of the time are designed to be used into an OpenGL-like lighting scheme, which is not suitable for general lighting simulation.
specularColor
, diffuseColor
and
transparentColor
attributes are respectively converted into
spectral variables ks, kd and kt.
They are limited to [0,1).
The shininess attribute s of the material node is interpreted as a phong exponent p using the following equation:
ImageTexture
and PixelTexture
components are
interpreted as diffuse reflectance maps acting in the (r,g,b) domain.
We note t(x) the value of the texture at a point x.
<Shape>
<Appearance>
...
</Appearance>
<RRTexture url="AluDC_64x64_mm_cl32_cp8.lpc"/>
</Shape>
In the Material node, the transparency attribute may be set to values greater than 0. In this case the material is transparent and the given value indicates the index of refraction of the material.
Material
node, which means that they should
take place under an Appearance
node. Note that putting more
than one different material nodes under the same Appearance
is not
conform to the X3D specification. In such a case, only the last node is accounted for.
<Appearance>
<HQRFresnelGlass absorbance="0.01 0.01 0.01" refractiveIndex="1.33"/>
</Appearance>
attribute | range | default value | meaning |
absorbance | [0,+infinity] | (0.0,0.0,0.0) | absorbance of the material expressed in metters^{-1} for the red, green and blue wavelengths. |
refractiveIndex | [0,+infinity] | 1.33 | refractive index of the material. |
HQRLafortuneReflectance
tag contains as many
CosineLobe
tags as necessary to define a multi-lobe lafortune
reflectance. Each cosine lobe defines a reflectance as:
<Appearance>
<HQRLafortuneReflectance>
<CosineLobe cx="-1" cy="-1" cz="1" n="0.0" color="0.0939 0.28 0.14"/>
<CosineLobe cx="-0.8" cy="-0.7" cz="0.58" n="1.52e+3" color="0.939 0.128 0.174"/>
...
</HQRLafortuneReflectance>
</Appearance>
color
stands for .
Note: mind the sign in the first two components of vector c. This sign is not mandatory but forgotting it
may produce unexpected results. Attributes are:
attribute | range | default value | meaning |
color | [0,1]^3 | (0.0,0.0,0.0) | reflectance color of the lobe for the red, green and blue wavelengths. |
n | {0} U [1,+infinity] | 0.0 | exponent for the lobe. Note that exponents in ]0,1[ are not allowed. |
cx,cy,cz | [-infinity,+infinity]^3 | (-1,-1,1) | Vector c (See above explaination). Need not be normalized. |
emissiveColor
in their Material
node. In that case the emissiveColor
attribute is interpreted as
radiosity, i.e directionaly integrated radiance per unit area.
<Scene>
...
<RRLight url="IESNA_file.ies" />
...
</Scene>
Although X3D does not handle environment map light sources, these are handled by the RREnvMapLight
node
of the X3DTK_RR extension library. In practice, this means that an envmap can be declared as:
<Scene>
<RREnvMapLight url="envmap.exr"/>
...
</Scene>
envmap.exr
is a HDR file containing an environment map
in OpenEXR format.
See the data section for ready-to-use envmaps.
DirectionalLight
node is that
ambientIntensity
attribute is not accounted forintensity
attribute is a multipling factor
i and is not limited to [0,1]direction
is the direction d into which the light source is seen
color
attribute is directly converted into the spectrum
S of the light sourceambientIntensity
, attenuation
and radius
attributes are not accounted forintensity
attribute is a multipling factor
i and is not limited to [0,1]color
attribute is directly converted into the spectrum
S of the light sourcelocation
attribute is the position P of the light source