5.5.3. RTX Shader Package

All shaders of the RTX package have the following common parameters :

The EyeLightshader uses the Lambertian shading model. The EyeLight shader generally doesn't produce very realistic rendering results but is the fastest shader in the package. It can be used for debugging purposes or for background objects of limited significance.

The Phongshader implements an extended Phong shading model. This shader can be used to simulate a broad range of materials, including plastic, painted wood, rock, tissue, and to some degree, metal. The extended Phong model takes into account diffuse illumination, glossy illumination via a Phong lobe, perfect specular reflection, and transmission. The diffuse color can be modulated by a texture.

This is the shader used to translate opaque SoMaterial SoMaterial SoMaterial instances in the scene graph. If an SoMaterial SoMaterial SoMaterial ’s transparency field has a value greater than 0., this node is translated to a Glass shader instead. SoMaterial SoMaterial SoMaterial fields are directly translated into Phong shader parameters, except for ambientColor, which is translated to ambientIntensity.

The Car Paintshader uses a physically based approach to simulate car paint effects. The most striking feature of car paint is that it is strongly reflective when viewed from a shallow angle, but has a more diffuse or glossy quality when viewed in the direction of the normal. The underlying model is that of a two-layer car paint, that has a clearcoat layer on top of a diffuse color layer.

Light that is not reflected from the clearcoat layer hits the color layer. The amount of reflectivity of the clearcoat layer is determined by computing the fresnel factor of the clearcoat. For the paint color (second layer), the extended Phong model of the Phong shader is used.

  • 1f ambientIntensity This parameter gives a minimal light intensity which is artificially added to the “real” illumination. See the section called “Phong shader (RTXPhong)” for more details.

  • color diffuseColor This is the base color of an object. See the Phong shader for more details.

  • color specularColor This is the color of the glossy illumination (Phong lobe). See the section called “Phong shader (RTXPhong)” for more details.

  • color reflective This parameter differs from its version in the Phong model! The specified reflective color is used to filter the reflection of the clearcoat layer of the paint. In most cases, the reflective color will be white. If you want to model some special clear coat paint that reflects only light of a certain color, you can specify a reflective color.

  • 1f shininess This parameter gives a measure for the size of specular highlights. To achieve a look like metallic paint, you should use a low shininess (4-12). For normal paint, try a high shininess combined with a dark specularColor (e.g., (0.5/0.5/0.5) ).

  • 1f bindex Index of refraction. The optical density (German: Brechungsindex) of the clearcoat layer. Air has an optical density of 1, so a value of 1 means that the clear coat is invisible. A typical value for clear coat paint might be between 1.3 and 1.7. Higher optical density means more reflections in the clear coat.

The shader can use three different methods to compute the fresnel term. The following parameters are only relevant when using those approximations. The default is to use Method 1.

  • 1i fresnel method The method can be 1, 2, or 3. In the following, the different methods are explained.

    • Method 1 This method is default. It is closest to physically “correct”. The fresnel term is computed via the formula:

      where

      and

      Even though the computations are quite complex, the shader achieves good performance by caching the precomputed fresnel values. As long as the optical density (bindex) is not animated, the fresnel method used has no impact on the rendering performance.

    • Method 2 This method uses the formula

      where

      to approximate the fresnel term. This computation is simpler but introduces some error. As the fresnel values are precomputed, there is not really a reason to use method 2 instead of method 1.

    • Method 3 The third method uses a rather crude approximation to compute a fresnel-like effect. This method has the advantage that it exposes three tweaking parameters that can be used to tune the appearance. The formula is:

  • 1f bias This parameter only has meaning when using fresnel method 3. The parameter is added unchanged to the reflectivity. Giving a value > 0 leads to stronger reflections on all parts of the paint.

  • 1f scale This parameter only has meaning when using fresnel method 3. The parameter is multiplied with the direction-dependent part of the fresnel term. Giving a higher value leads to stronger reflections in those parts of the paint that are viewed from a shallow angle.

  • 1f index This parameter has only meaning when using fresnel method 3. Assigning a higher value to the parameter leads to a faster fall-off of the reflections.



The most striking feature of glass is that it is highly reflective when viewed from a shallow angle, but transparent when viewed in the direction of the normal. The fresnel term describes the relation between the refractive and the reflective part.