

VRML Script Tutorial
Full list
VRML Interactive Tutorial
Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Appearance
Let there be Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Interpolators
Let the Music Play
Bindable Nodes
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes




[}8{)0
~Cv٫{Uf*%``'{{>`ml.51RwZVK"[?ftyO{x#fڢ{pj8T?މ<7q2by(9\c{yFKg~˒7rbžР =vv*=ڵ$65~oFª37/{= S[lt/0#ps,Jv96HbGg1rOF~GS,(
]WZh_ط,"I;Qx)p{L=1R
>nPA֔8ďh
(Ngx=I=/M(3&=&@1EPF yr]ʞm9oI4hr+h=L?x1
b>y0alc]O(q/b<;L)D8A Hq{^"2yX':gͮfh{o={]TDP8C4L0ri]&(%G+R:ݳN1
U0jmxi=1خ%I4R8]fΖuWBy)ǛvdJ8Nh2
!?S4GR X֞P$ {i
"owGK(Dey
qfn`0հPء
<EqdhQ`>%
<致mHZJXM&莚\ bKWro<&$ v^*ĶmOaN7N>3?P;Q8>um>=}zS(\~"$?QkWXʄ䛛VUN::~U}H:[qkrZ)ȳC6m?1'bM$uo3,(Bm=?4Y*<_h;'MOCЩ%{σq;6נĻe@3Oeل9[VAp+*P0B)QXJdKHct?`McF
<Şam+~~$>
@zy͋W'`S ),
;Q֟%=5JS`P
e(J}
U
,y B{R,Y?f2L7+2ߓhiU7va:`RjӶدfy]x3:1{&o}ZZ691
ĕmA 1FUG}'E0G ;,,9zwZLlQH;3&#!jd`jx$x^s]0H0C3{`'
[@E0@ھSjaue3`t0cu0$/jO"˪X4)TߑAc]6Cʞ3i.\Mi 8,\)vpwE 7?CUFDg9Pw}}BEMHg:k@mP4ڃ1~nAf#QR=]!uFQ#HhD#Y:g!ӇGɆ@8٫q۫0Q0#8Ka'3uJM&`NLʦlM̌?pQɇdKǳbt^N3zCê Sd,0[Vu&ck>R6LvM9&Lmm`N28%qHcd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ݕi\f&+HOһm#6Rs~RIĻzastZo6onU^PQq9#I"_<+yVOxgﭛsy"ң{Q*ejU#s#=hR2לj3^STtӆ*8{ܻ[N=_ VbDYL]ZuCOGy8[8 j$exbFO{sg3xjY,^Љ+k,*لdW煰N\x4kZM^Rj(\z# 5YkJՐ9+Xu8,^)@c`e7Zٍ9ՅH
P8^y&pZ:aA95`@T q1a+YD)jfz($ @Wq7W*F~y77M(ƆxA_ՠ{uwz@T'H{Ͽv+QI`
+]iwA$<fyhg'R{*ׁx^/̶lS'" 㤋pdϞ1ͺ%Ƴ`>1X<gpx@C9^]rgчwE
Yd,7G
)"X+vwAZd4 Bbn5uvMRrs BEB<klCZ9lFJHcOܪa1l8<])q36mnzCUwTxE*d%?p!ՔC#c]
eОV6`f7};WLqc4;9<<
7;yb4MBY!ONx[is};FS]]&i'i
/W>Y7)2?iIvvOBJ;tP"yҭli7:O=ߓH]
Extrusion Node
The IndexedFaceSet node although
a very powerful node, requires you to define all the faces in
the shape. For certain shapes this requires loads of points and faces.
For other shapes this is almost impossible. For instance consider designing
a sphere with an indexed face set.
Extrusion is a very powerful node which allows you to define very complex
shapes using only a small amount of points.
Syntax:

Extrusion { 
beginCap TRUE
endCap TRUE
ccw TRUE
convex TRUE
creaseAngle 0
crossSection [1 1,1 1, 11, 1 0, 1 1]
orientation 0 0 1 0
scale 1 1
solid TRUE
spine [0 0 0, 0 1 0]

} 

The basis of an extruded shape is a 2D cross section of the final
shape. For example, consider a cube. The cross section is a square.
Cross sections are defined in the XZ plane. The cross section
for a cube could be defined using the following points:
Note the Z axis orientation, the Z axis is positive downwards, not upwards.
In 3D, using the default View Point
this means that points closer to you have a higher Z value than points
further away.
Another concept needed in an extrusion is the spine. The spine
defines the path that the cross section will travel to create the
shape. In the above example, trying to build a cube, one could start with
the cross section at (0,1,0) and move it upwards to (0,1,0). The following
figures shows this spine for the cube, and the respective path for the
cross section.
The spine in the above figure is defined by two points, (0,1,0)
and (0,1,0). The list of steps that the browser does to draw an extruded
shape with two spine points are:
Translate the cross section to the first spine point
Reorient the cross section, defined in the XZ plane so that
the Y axis coincides with the direction obtained with the two spine
points (in the example above this step is not necessary).
Move the cross section to the last spine point.
When executing the last step the browser will create the side
walls of the cube. The end result is presented in the following figure.
Source code for the above figure (without the axes)
Example:

#VRML V2.0 utf8

Transform {

Shape{ appearance Appearance { material Material {}}

geometry Extrusion{

crossSection [ 1 1, 1 1, 1 1, 1 1, 1 1]

spine [0 1 0 , 0 1 0 ]}

}

}
The fields beginCap and endCap specify if the extruded shape
is open or closed at the ends. For instance if in the above example both
endCap and beginCap were set to false the following figure
would be produced
Notice that you can only see two sides of the cube, the ones that face
you. This is because the field solid is set to TRUE by default.
Setting this field to false yields the following result
In the above examples the spine had only two points. That is the
simplest spine you can have. However there is nothing preventing
you from having more spine points, for example to draw a V shape,
or even something more complicated.
The principle is always the same however there is something which deserves
to be mentioned. As mentioned before, when using a two point spine,
the cross section is oriented so that the Y axis coincides with
the direction defined by the two spine points. When using more spine
points this is only valid for the first spine point. The remaining
spine points behave slightly differently.
The second and subsequent spine points orient the cross section
so that is perpendicular to the tangent of the spine. The following
figure, presented in 2D for simplicity reasons, shows the cross section
orientation in a 3 point spine.
The points in the figure are the spine points. The dotted lines
show the path defined by the spine. At each spine point the
cross section's orientation is presented. Note that the cross
section's orientation for the second point is perpendicular to the
spine's tangent.
A V shaped spine, defined by the points: (3,5,0), (0,0,0), (3,5,0),
with the square cross section produces the following result:
Source code for the above figure (without the axes)
Example:

#VRML V2.0 utf8

Transform {

Shape{ appearance Appearance { material Material {}}

geometry Extrusion{

crossSection [ 1 1, 1 1, 1 1, 1 1, 1 1]

spine [3 5 0 , 0 0 0, 3 5 0]}

}
}
Extrusion can also be used to create surfaces of revolution using a circular
spine. The following example describes how to build a cone by using
extrusion as a surface of revolution.
The cross section is defined by the following points: (1,0), (0,0),
(2,1), (1,0). Note that the cross section repeats the first point,
if you don't do that then you may end up with a nonsolid shape. The spine
is defined by selecting eight equally spread points in a unitary circle.
The following figure depicts the cross section (note that the Z
axis points downwards), and a circular spine defined in the XY plane.
Please take notice of the cross section points. The point (0,0)
is the point that coincides with the spine's point. The end result
is the following figure:
Source code for the example above (without the axes):
Example:

#VRML V2.0 utf8

Transform {

children

Shape{ appearance Appearance { material Material { }}

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]

}

}

}
Wait, there's still more, you can scale and orient the cross
section for each spine point specified. In the cube example
presented above, you can scale the cross section for the
second spine point by (0,0), thereby reducing it to a point, to
obtain a pyramid as in the following figure.
When using the field scale you either specify one scale for the
whole shape, or a list of scale factors for each spine point
( note that scales are provided in 2D because they relate to the
cross section).
Source code for the above figure (without the axes)
Example:

#VRML V2.0 utf8

Transform {

Shape{ appearance Appearance { material Material {}}

geometry Extrusion{

crossSection [ 1 1, 1 1, 1 1, 1 1, 1 1]

spine [0 1 0 , 0 1 0 ]

scale [1 1, 0 0]

}

}

}
Or you could twist the spine's path using rotations
to obtain the following picture
Similarly to the scale field, when using the field orientation
you either specify one orientation for the whole shape, or a
list of orientation factors for each spine point. Orientations require four
values each: three to define the axis of rotation and one to define the angle.
Source code for the above figure (without the axes)
Example:

#VRML V2.0 utf8

Transform {

Shape{ appearance Appearance { material Material {}}

geometry Extrusion{

crossSection [ 1 1, 1 1, 1 1, 1 1, 1 1]

spine [0 1 0 , 0 1 0 ]

orientation[0 1 0 0, 0 1 0 3.14]

}

}

}
The ccw field specifies if the points which define the cross
section are present counterclockwise, TRUE, or clockwise or unknown
order, FALSE.
The convex field specifies if the cross section is convex
or not. When presented with concave cross sections, the browser
splits the cross section into smaller convex cross sections.
This is a time consuming task. If you are sure that the cross section
is convex then setting this field to TRUE tells the browser not to worry
splitting the cross section therefore saving time.
The creaseAngle specifies an angle threshold. If two adjacent faces
make an angle bigger than the creaseAngle then you'll see clearly
where the two faces meet, the edge linking the two faces is sharp. Otherwise
the edge linking the two faces will be smooth.
