When activating DirectViz, you may notice some differences in the rendering as compared to OpenGL, which may be due to:
Built-in enhancements or differences in rendering semantics – for instance transparent objects are turned by default into truly reflective glass; shadow casting may have been activated globally – then light sources cast shadows by default and therefore can be occluded by objects.
Some features only relevant to OpenGL or actual limitations are listed below.
![]() | |
The following Open Inventor features are not currently supported, i.e., ignored or not rendered as they would be with OpenGL:
|
One of the most stunning effects of ray-tracing is the realistic rendering of glass. The SoMaterial SoMaterial SoMaterial and SoVRMLMaterial SoVRMLMaterial SoVRMLMaterial nodes with transparency value greater than zero are automatically rendered using a glass shader, so that all transparent objects of an Open Inventor or VRML scene appear as if they were made of glass. Glass rendering is discussed in further detail later in this chapter.
A scene can be greatly enhanced by adding an environment, a “background” surrounding the geometry of the scene, nicely reflected on the scene objects.
DirectViz allows you to easily specify environments by adding an SoDirectVizEnvironmentShader SoDirectVizEnvironmentShader SoDirectVizEnvironmentShader node to the scene graph. Only one environment can be used in a scene. This node contains two fields:
textureURLs: list of texture files which may be selected with the textureId field as the environment. The following formats are supported by Open Inventor SoTexture2 SoTexture2 SoTexture2 – BMP, GIF, JPEG, JPEG2000, PGX, PNG, PNM, SGI RGBA, Sun, and TIFF.
textureId: index of the selected texture file within the list in textureURLs field.
DirectVizEnvironmentShader { textureURLs [ "environment0.ppm", "environment1.jpg"] textureId 1 }
![]() | |
SoDirectVizEnvironmentShader SoDirectVizEnvironmentShader SoDirectVizEnvironmentShader should not be confused with the SoEnvironment SoEnvironment SoEnvironment class. SoEnvironment SoEnvironment SoEnvironment describes global environmental attributes such as ambient lighting, light attenuation, and fog for OpenGL rendering. |
When an Environment shader is specified, DirectViz allows extracting fake lights from the environment texture. Thus, the lighting is performed with additional lights coming directly from the environment. When combined with accumulation, the fake lights are taken at different environment texture positions at each accumulation step. Thus, lights from the entire environment can be used for illumination, giving a fast and accurate approximation of ambient occlusion.
The number of environment lights to extract from the environment texture is controlled with the SoPreferences SoPreferences SoPreferences parameter DIRECTVIZ_NUM_ENV_LIGHTS or the SoDirectVizManager SoDirectVizManager SoDirectVizManager numEnvLights field.
The intensity scale applied to environment lights is controlled with the SoPreferences SoPreferences SoPreferences parameter DIRECTVIZ_ENV_LIGHTS_SCALE or the SoDirectVizManager SoDirectVizManager SoDirectVizManager envLightIntensityScale field.
A key feature of the ray-tracing of DirectViz compared to OpenGL capabilities is the accurate rendering of true reflections within arbitrary scenes.
The SoMaterial SoMaterial SoMaterial and SoVRMLMaterial SoVRMLMaterial SoVRMLMaterial nodes have been extended with a new field, reflectiveColor, for easily enabling this feature in Open Inventor scenes (no need to change the scene structure with insertion of new property nodes):
If set to black (0, 0, 0), the corresponding shape is not reflective.
Otherwise, the higher the reflectiveColor, the more the shape appears reflective. To simulate a perfect mirror, the reflectiveColor should be set to white (1, 1, 1), and all other color field values to black (0, 0, 0).
While the specularColor and shininess fields control the glossy illumination of shape highlights (degree of shininess of an object), the reflectiveColor field controls perfect specular reflections. For more details, see the section called “Phong shader (RTXPhong)”.
DirectViz allows light sources that illuminate a scene to be deflected, which produces fuzzy effects.
This can be achieved globally by enabling the SoPreferences SoPreferences SoPreferences parameter DIRECTVIZ_FUZZY_LIGHTS or the DirectVizManager fuzzyLights field.
Enabling fuzzy light effects implicitely causes the shadows to be smoothed, as the shadow rays are deflected also.
Alternatively fuzzy light effects can be achieved on a per shader basis by the shader parameter fuzzyLights.
DirectViz allows reflections and refractions to be deflected, which produces glossy surfaces effects, which simulate more realistic material behaviors, and offer nonuniform effects. The glossiness of a reflective surface is controlled by the shininess parameter of the current Material node.
Glossy surfaces effects can be achieved globally by enabling the SoPreferences SoPreferences SoPreferences parameter DIRECTVIZ_GLOSSY_SURFACES or the DirectVizManager glossySurfaces field.
Alternatively glossy surfaces effects can be achieved on a per shader basis by the shader parameter glossySurfaces.
Figure 5.15. No Glossy Surfaces Effects, Glossy Surfaces Effects, accumulated Glossy Surfaces Effects
A further degree of realism is achieved by enabling shadow casting in the scene. It is possible to control the shadowing per shape with the receiveShadow field of SoMaterial SoMaterial SoMaterial nodes. If the receiveShadow field of an SoMaterial SoMaterial SoMaterial node is set to true, the affected shapes will receive shadows from other shapes.
![]() | |
Enabling shadows for the entire scene is possible via the SoDirectVizManager SoDirectVizManager SoDirectVizManager globalShadowing field, or via the DirectViz control dialog. No change in the scene is required. |
By default DirectViz shadows have a sharp edge – as if cast from a point-source light. Realistic shadows look more blurred as the actual light source is wider. This can be achieved globally by enabling the SoPreferences SoPreferences SoPreferences parameter DIRECTVIZ_SOFT_SHADOWS or the DirectVizManager softShadows field.
Bump mapping is a way of simulating fine surface details such as bumps or wrinkles. This is a normal-perturbation rendering technique for simulating lighting effects caused by patterned irregularities on an otherwise locally smooth surface. The surface patterns are encoded in a normal maptexture.
An SoDirectVizGeneralShader SoDirectVizGeneralShader SoDirectVizGeneralShader node can be used to set bump mapping effects. This property node is further detailed in the section about DirectViz shaders. Here, the name field can be simply set to “Phong” to select the appropriate shader. The options field is used to set the texture bumpMap parameter defining the normal map texture file (see the section called “Phong shader (RTXPhong)” for details).
DirectVizGeneralShader { name "Phong" options "bumpMap normal.jpg" }
DirectViz normal map textures can use any native Open Inventor RGB image format, with x, y, and z components of the normal corresponding to red, green, and blue color components respectively. You can find tools for creating normal maps, for instance plug-ins for Photoshop or Gimp.