All shaders of the RTX package have the following common parameters :
bool receiveShadow (false by default) Activate or deactivate shadowing for the affected objects. If switched off, the objects affected by this shader will no longer receive shadows, i.e., will always appear lit, even if an occluder is in between. The objects still cast shadows though.
bool softShadows (false by default) Activate or deactivate soft shadows for the affected objects.
bool glossySurfaces (false by default) Activate or deactivate glossy surfaces for the affected objects.
bool fuzzyLights (false by default)Activate or deactivate fuzzy light effects for the affected objects.
bool wireframe (false by default) Activate or deactivate wireframe rendering for the affected objects.
1f thickness This parameter specifies the thickness of the wires when wireframe parameter is set to true.
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.
color diffuseColor This is the base color of an object. The diffuseColor specifies the color of the illuminated part of the surface. The diffuseColor is modulated by the texture, if given.
color emissiveColor This parameter specifies the color for a “glowing” object. By default, the emissiveColor is black. If shadows appear too dark, you can assign a color other than black.
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.
1f ambientIntensity This parameter specifies a minimal light intensity which is artificially added to the “real” illumination. ambientIntensity is modulated by the diffuse color. If shadows appear too dark, you can try setting ambientIntensity to a non-zero value; 0.1 to 0.4 to might be good choices.
color emissiveColo r This parameter specifies a color for a “glowing” object. The color is always added to the visible color of the object, independent of illumination. For most objects, emissiveColor is black. If you want to model an object that glows from within (or an artificial object like a coordinate axis that should not be lit) it might be a good idea to assign an emissiveColor.
color diffuseColor This is the base color of an object. The diffuseColor gives the color of the diffuse and the ambient component of the illumination. The diffuseColor is modulated by the texture, if given.
color specularColor This is the color of the glossy illumination (Phong lobe), giving the degree of shininess of an object. In most cases specular highlights are white; exceptions are possible for simulating, for example, metal.
color transparent Opaque objects must have their transparent color set to black. If you want to model an object that is partially transparent, you can set a color to filter the light coming though. By assigning a color other than black, the object automatically becomes transparent. Note that the transparent component is added to the object color. So assigning white as a transparent color does not render the object invisible, unless all other components are set to black.
color reflective This parameter gives a value for the perfect specular reflection of an object. When set to black, the object is not reflective. Note that just as for the transparent parameter, the reflective component is added to the overall color of the object. So in order to build a perfect mirror, you must set the reflective parameter to white, and set all other components to black.
1f shininess This parameter gives a measure for the size of specular highlights. Surfaces with a low shininess (0 to 1) have very fuzzy, plastic-like highlights. Surfaces with a high shininess (5 to ) have smaller, sharper highlights, and appear more like metal.
texture This parameter specifies the texture path file on disk.
The data format of the texture must be supported by Open Inventor. Most common image file formats are supported :BMP, GIF, JPEG, JPEG2000, PGX, PNG, PNM, SGI RGBA, Sun, and TIFF. If the texture contains transparency, it overrides the shader transparency value.
bumpMap This parameter specifies the normal map texture path file on disk. If specified, the shader uses a normal map to simulate a structured surface. The data format of the normal map is a 3-component RGB image, using one of the file formats supported by Open Inventor: BMP, GIF, JPEG, JPEG2000, PGX, PNG, PNM, SGI RGBA, Sun, and TIFF. See Figure 5.18, “ Floor texture and corresponding normal map” for an example of a normal map 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.
DirectVizGeneralShader { file "libRTX" name "RTXFresnelPhong" options [ "1f ambientIntensity 0.2", "color diffuseColor 1 1 1", "color specularColor 1 1 1", "color reflective 1 1 1", "1f shininess 64", #Range 0. 512. "1i fresnelMethod 1", #Range 1 3 (see above) "1f bindex 1.2", #Range 1. 10. "1f bias 0.000", #Range -1. 1. "1f scale 1.000", #Range 0. 10. "1f index 1.000" #Range 1. 10. ] }
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.
1f bindex Index of refraction. The optical density of the glass. Air has an optical density of 1, so a value of 1 means that the glass is invisible. A typical value for window glass is 1.5 to 1.6. Glass with an optical density around 1 is almost invisible, while glass with higher optical density is more reflective and thus more clearly visible.
1f reflectivity The reflectivity is a tweaking parameter to make glass appear more reflective than it should be. The default value of this parameter is zero (which is physically correct). If a non-zero value is assigned, this value is added to the reflectivity based on the fresnel term.
1f reflectionFilterAmount and color reflectionFilter These parameters allow simulation of glass that only reflects light of a certain color. If a reflectionFilterAmount other than zero is set, the reflected light is filtered by the given color.
1f refractionFilterAmount and color refractionFilter These parameters allow simulation of colored glass. In contrast to reflectionFilter, the transmissive part of the glass is filtered, not the reflective part. If a refractionFilterAmount other than zero is set, the transmitted light is filtered by the given color.
1f refractionFilterScale This parameter specifies the rate at which light is scattered inside the medium. A low value of scale means that the scattering takes place only slowly, i.e., only very thick glass appears colored. A higher value for scale means that the scattering takes place more rapidly, i.e., even thinner glass appears noticeably colored.
1i oneSidedGlass This is a tweaking parameter that allows modeling of glass panes with only one layer of geometry. If set to one, the shader assumes that the object is not solid glass, but a hollow shape with panes of very thin glass. If you try to render an object and the refraction appears much too strong for the given optical density, you can try setting oneSidedGlass to one. Note that colored glass (realized via 1f refractionFilterAmount and color refractionFilter) is not possible with oneSidedGlass.
DirectVizGeneralShader { file "libRTX" name "RTXGlass" options [ "1f bindex 1.517", #Range 1. 10. "1f reflectivity 0.1", "1f reflectionFilterAmount 0.0", "color reflectionFilter 1.0 1.0 1.0", "1f refractionFilterAmount 0.0", "color refractionFilter 1.0 1.0 1.0", "1f refractionFilterScale 1", #Range 0.0001 1000. "bool oneSidedGlass false" ] }