Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

VRML File Structure
Drawing: Shape node
Geometry Nodes:
Example: Chessboard
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Let the Music Play
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes

LOD Node

LOD stands for Level of Detail. This node lets you specify alternative representations of a graphical object, and the distance ranges to use each representation.

The following fields are defined:

  • level specifies the set of alternative representations of a graphical object
  • center specifies a 3D point to which the distance is computed.
  • range specifies a set of distances, floating point values greater than or equal to zero. There must N distances specified, if N+1 levels are specified. The distances must be ordered starting from the smaller distance, otherwise the results are undefined. If this field is left empty then this is a hint to the browser telling it that it should select a level where a constant display rate can be accomplished.

  • Syntax:
    LOD {
    level []
    center 0 0 0
    range []

    This node can have a major impact on the performance of a browser, therefore its role can't be overstated. Look at the following figure

    In it you see three cones. The left one which isn't really a cone, more like a pyramid, has only four sides, the middle one has 8 sides, the right one has 16 sides. These cones were created using Extrusionnodes.

    You can see that they are different by the way they reflect light. Now look at the next figure.

    The above figure includes the same three cones but placed further away from the user. It is becoming difficult to distinguish between the right and middle cones, although you can still clearly see the difference between the left cone and the other two.

    In the above figure the user is further away from the cones than in the previous figure and as a result it is harder to distinguish which is the more detailed, and the less detailed cone.

    This sequence of images shows that with distance the perception of the details in an object becomes harder. This is the reasoning behind the LOD node. Why draw very complex shapes when they are too far away from the user for details to be recognized? The more complex a shape is the more demanding is the task of drawing it. If an object is far away there is no benefit in drawing the object full of detail.

    The LOD node can be used in the following way:

  • if the user is close to the object draw the most detailed version
  • when the user is not close anymore, but still not to far away draw a less detailed version
  • when the user is very far away draw only a crude version of the object.
  • By selecting less detailed versions when the user is not close to a object, time is saved and the user perceives no difference due to distance. You can specify as many levels of detail as desired. The user should try to keep changes from one level of detail to the next as small as possible so that a performance break will not occur.

    The LOD can also be used to avoid drawing objects which are invisible, for instance in another room. In this case one can specify an empty object, for instance a Shape without a geometry.

    The range field specifies which version of the object is drawn. The objects should be specified in the level field by decreasing level of detail. If the distance from the user to the object is smaller than the first range specified, then the first version, the more detailed, will be drawn, if the distance is between the J-1 and J ranges, then the Jth version is drawn. If the distance is greater than the last range specified, with an index I, then the Ith version is drawn.

    The main problem is knowing how much is "close", "not to far away", and "very far away". This is perhaps something the browser developers should think about, providing coordinates for the user's position.

    If browsers did provide the user's position then one could have the several versions with different levels of detail of the object drawn at the origin, then the user would move away from the objects until no difference was perceived between the full detailed version and a slightly less detailed version. The user's position could then be used to compute the distance when the level of detail should be changed. This procedure would be repeated for all levels of detail until all versions looked the same.

    Unfortunately most browsers do not provide the user's position so it becomes a matter of trial and error.

    Source code exemplifying the use of a LOD node:

    #VRML V2.0 utf8
    LOD {
        range [20,40]
        level [
    	#full detail 16 sided cone
    		appearance Appearance {
    			material Material { 
    				diffuseColor 1.0 1.0 1.0
    		geometry Extrusion{
    			crossSection [ -1 0, 0 0, -1 -2 -1 0]
    			spine [1 0 0 , 0.866 0 0.5,
    				0.5 0 0.866, 0 0 1 ,
    				-0.5 0 0.866, -0.866 0 0.5,
    				-1 0 0, -0.866 0 -0.5,
    				-0.5 0 -0.866, 0 0 -1 ,
    				0.5 0 -0.866, 0.866 0 -0.5,
    				1 0 0
    	#intermediate detail 8 sided cone
    		appearance Appearance {
    			material Material { 
    				diffuseColor 1.0 1.0 1.0
    		geometry Extrusion{
    			crossSection [ -1 0, 0 0, -1 -2 -1 0]
    			spine [1 0 0 , 0.707 0 0.707 ,
    				0 0 1 , -0.707 0 0.707,
    				-1 0 0,-0.707
    				0 -0.707, 0 0 -1 ,
    				0.707 0 -0.707, 1 0 0
    	#low detail 4 sided cone
    		appearance Appearance {
    			material Material { 
    				diffuseColor 1.0 1.0 1.0
    		geometry Extrusion{
    			crossSection [ -1 0, 0 0, -1 -2 -1 0]
    			spine [1 0 0 , 0 0 1, -1 0 0,
    				0 0 -1 , 1 0 0