Lighthouse3d.com

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

ZF~ 4 Xy,ox³rXRlL{E@\O66 MjbFB^WYݛ0KիkU¯ok 3=ӱHC{Qx 08K8|>\bI}(-$qҙlcFX'&1E,DCsUu˺^ͺuu%,|Ϳ6k$Z[o1XUz5y}ݫDg%4?Ou|{Q,^8(usZߛY%p`"m-\ Iԧw2Be#?j̯}"Y*xv2%H6H ? Pb3/Nهg3U0 h'fz.#1!tӱҧT $'_*H-I@Ƿ,Dir+ƷyR\ƌ>zt> bJI?yt%ҧ_ @4^C ’&^zaʼ0lɆB0I0;cru qijQЁ6Wܲ4!yx$&Ƴ4ć)BЦ Bv:yu3AO) IJ5BCR#$/x:*7E#JS :]& (d[삡jT>{J7?O h}44Ma,, IGb-t#9nv4Ck=g"nyKϷ@Ql*"&!zg*|HgU!f^#e,qﮅ S>) )B.yJ(/ "%Qh=.)[gxdq ɐ*@Jx(t. e}Jj@i_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^Kmmm57E-9",7&M @xbZ@TQgY:I!N5MAl]ҰRʇOYN F^эABzB鞈izl7NyD*Md2<o^!Pߠ‹ ~ace)xPptX1ز< ?O$ogo!YUe]/⪰"F?ԊhqM Q0=, .:6}7sY5K'(uO68?+=YjLLeBsգ7 {`>}ɞ,] DM?Js$钏{ͦz2W~"ܾ>߾m^mű *)ny̿gxZ0XeSˆ#˜-Beu}=OZ; - {8ͽ=mRNThb+Tc 7 \d4NSUB;Nq +dͻU(^#GFYwfX(z92C%N\m8VeaGFy#''##=ŇӋ˫w~OƒcЋ ڶʐnH3i1h㥙1`]ŞƬ_LTi]zIqTmctA.e_؜iV[c/Ъj/ >訸W葤X>7+yVƘ ~3ʱ+Yx,#3WeZ_V79>3&s͑?5EG7#Ҍ | +>{Qށk{ӣ: ڃS PNUT+!O-j3}zBݛG?usCXE3whdzP5~WOl8qhQhRR(IY ^4љ`FeQ,Lu/䂺2uGJ4Kd6*{r=` v)U+Mu*lxlyYXJveeB=S #X4_="6%0JQIR*啃Y J+"͉)m~Y}l * eyaL04;V=*z+-{acdWNFHGլf _N^S5Hگ1%=GTFm<(687pPJ&M9%hV|Px&2G XVoPvnZ(zuF{W2R,ԾLUղ9O6JƵrzڝ*N9 U,*ePU9Xf;Zey ]Pг'chԫaO8 ~|&|X0LN= y;h*G `+y1 qՒeE-BmU+S5|ODPJZ5jBijH\XG.QTm=;5"/o44\zTUg ޮN*_ꕬ:5SFמ\$9=?E& jpZ/:a9A9`@|p1FblPfu=\$+1DS|d)/OuQь}>؅^&Z._=}@H #M}ҬCze긡"}74X):q㍉;yH.I>}mG/%Y|ƜF v Tt~= k 1 s9RqDBsSV;oN^]#uI1t8]3s2mث{]wǫR˕w2rffb|铸'NQoD-akaýnf+{?iB9k_ض8l{@ @RK!Be. 2ja9Y1(Sqt <|{

Defining and Instancing Nodes


VRML allows you to define a a set of nodes, or a node with particular field values, as a new node type. Suppose you want to draw a set of shapes, all having the same Appearance node.

There are two ways of doing this: the hard way, which requires the Appearance node to be repeated for each shape; or the easy way in which you define the common Appearance node as being a new node type.

The latter approach is not only easier, since you don't have to rewrite the defined node over and over again, but it also guarantees that the shapes share the same Appearance node.

This has clear advantages when, for instance, you decide that the defined node should be altered. Defining the node once and using it multiple times you have to change only the node which is being defined instead of changing all occurrences of the defined node.

Two keywords are provided: DEF and USE.

Syntax:
{
DEF name node
}


where node is any of the VRML nodes, and name is the new node identifier.

Syntax:
{
USE name
}


where name is an identifier which has been previously defined using DEF.

Note: When defining nodes in a inlined file the defined identifier can only be instanciated inside the inlined file, i.e. the identifier is not recognized outside the file where it is defined.

Example: suppose that you want two red Shapes in your world. The VRML code to define this world could be something like:

Example:
Shape { appearance
DEF common_appearance Appearance {
material Material {diffuseColor 1 0 0}
}
geometry Sphere { }
}

Transform {
translation -2 0 0
children [
Shape {
appearance USE common_appearance
geometry Cone { }
}
]
}


The result of the above code is: