Interpretation of X3D fields

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.

The X3D Material component

The classical X3D material component has not originaly been designed for lighting simulation, so we re-interpret some fields in a more appropriate way, as described below:

Specular, diffuse and transparent colors

The specularColor, diffuseColor and transparentColor attributes are respectively converted into spectral variables ks, kd and kt. They are limited to [0,1).

Shininess

The shininess attribute s of the material node is interpreted as a phong exponent p using the following equation:



When the shininess is 0, the material is diffuse; when it is 1, the material is pure specular, which corresponds to an infinite phong exponent into the above equation.

Textures

The 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.

BTFs

Bidirectional Texture Functions are general 6D (space x bi-directional) functions, measured in the context of te RealReflect project. BTFs are handled by the X3DTK_RR component as: See the data section for ready-to-use BTF files.

Transparency

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.

Reflectance equations

Not all combinations are handled yet by the HQR software (e.g. BTF with transparency). Three are examined, in this order: where r and s are the reflected and transmitted directions of d at the material interface.

Additional materials

Additional materials have been defined into HQR for special uses. These derive from the original X3D 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.

Fresnel glass

Fresnel glass behaves just as glass, with Fresnel reflectance/transmittance equations. Only dispersion is not accounted for. A Fresnel glass node is defined by: Attributes are:

attributerangedefault valuemeaning
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.33refractive index of the material.

Multi-lobes Lafortune reflectance

The HQRLafortuneReflectance tag contains as many CosineLobe tags as necessary to define a multi-lobe lafortune reflectance. Each cosine lobe defines a reflectance as:

...where v is the outgoing light vector and I the incoming light vector. In the example below, the first lobe is a diffuse lobe whereas the second one is a highly specular one: In each lobe, 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:
attributerangedefault valuemeaning
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.0exponent 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.

LightSource components

The user may refer to the definition of standard X3D fields of the light source component to get the full definitions of the possible attributes.

Geometry-based light sources

Geometry components in X3D may have a non null emissiveColor in their Material node. In that case the emissiveColor attribute is interpreted as radiosity, i.e directionaly integrated radiance per unit area.

IESNA light sources

IESNA light sources follow the IESNA standard as used into the RealReflect project. Such sources are handled by the X3DTK_RR extension of the X3D file format as: See the data section for ready-to-use IESNA light sources.

EnvMap light sources

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:


where envmap.exr is a HDR file containing an environment map in OpenEXR format. See the data section for ready-to-use envmaps.

Directional light sources

A directional light produces a delta distribution of incident radiance in a unique direction, which integrated value is the total power of the source. The interpretation of X3D parameters of the DirectionalLight node is that The illuminance (i.e. integrated radiance) at a point on a surface with normal n due to a directional light source is thus:


Point light sources

A point light source is a puntual emitting source X3D point light source parameters are interpreted as: The illuminance (i.e. integrated radiance) at a point X on a surface with normal n due to a point light source is thus: