Lighthouse3d.com

uW(.JUMLO-O)ͭKLSW(L)ɰU7TWHL(3RRl bJP< Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Box
Sphere
Cone
Cylinder
PointSet
IndexedLineSet
IndexedFaceSet
Extrusion
ElevationGrid
Example: Chessboard
Text
FontStyle
Appearance
Material
Textures
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
Group
Transform
Collision
Anchor
Billboard
Switch
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
Timers
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Interpolators
Color
Coordinate
Normal
Orientation
Position
Scalar
Example
Let the Music Play
Sound
AudioClip
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Background
Fog
Information about your world
WorldInfo
Definition for Auxiliary Nodes
Coordinate
Color
Normal

}{69`yƖ͗ӱ3cOn'{EBjڔ!~wod%H"ν'[  ƒGt}I.yx9"BiO>x>K 7Iiv+m,Bz֝Q22 Yu$#(J0hd71 r8 <7 Q\C&eA$?1yEu.,NAVh G?Y4`dx?=ޒil26-kt-dFA̹\I{ /C vtSMc9A :98xwK6ftM6*MD3 dן^‚1}C)a1=w8Kwė;4؂_ 9$i.`͑AVܭlLpҐ1&,2IAqւ&w/@o4f˴YH[t0~L)6.dJ e%ݸ[HcOpI0iP%cbnRP?}:&ЁM\kLt"YM(w9cwbSZqhZu=w}컾At900l,;u}YfPwޘF.F% T(t۶1lli<6˰ k8p J 5EGi([.3:vК0 -!P\Q8$4޷z9+vg^g7kE[vJ N3 7K%pi1۫ Z/čW1  }SC tVh~!⿸Ӂ<>/,0tx~< )DEd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!yKwl-AKӓXD1K[Zg Gn[B@ÄX ؗ)ju:\#TЛ|:.wwm̕8dJ}N F ,~i!9!-F0Q|9a_fu[&^ۀUP&°I=&FtR&0t*$^RMV?J)ܻ~|;{_Icx[Gzx1rV8_rFx[[nl¥O BWzNL\N_7 %-„I˻'ώxPz&)m&dFn~{1=WN7:isk鹠ЏބGh Aܦ{@<\oǢ k?SߖaxJk+٤D9~TfZL$Γ'֑9sϖ'}jZKzx-Hm|jPca`EEK9u!Dy׮ztQTD0a ̕>BMFa4qs'>yABa0? OI-S.Sm]gtƅeRaj-N5V巺W0QPYxc1SCs#%E:OZ}_ \.Fwŀq%/]4|') #eA+%hކ!LhD'nQ_$Ӆ/#Xsuaӓ[fA bкG 8lu6 c7.N3Tnka;NEzIͭr>X{^y.Q|7a ֺ:EȩOM2 1>-! *RMA'Ct0؟%/} [L,:g ֜o.%'?G3^`sX="1~vu\r0r.ym"j\FNh1<1M`<&wh]LRo"鴝v]C tl ,ȇ ?$}5HNOwB,lj51gs}$Q \u{6~bQMov&?wƙ.b'O2=H'U:>kMD$/'yӇB-

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:


    Example:
    #VRML V2.0 utf8
    
    LOD {
        range [20,40]
        level [
    	#full detail 16 sided cone
    	Shape{
    		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
    	Shape{
    		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
    	Shape{
    		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
    			]
    		}
    	}
         ]
    
    }