Given by Geoffrey C. Fox, Alvin Leung, Meryem Ispirli at CPS616 Basic Information Track for Computational Science on Winter-Spring Semester 96 and 97. Foils prepared 7 April 1997
Abstract * Foil Index for this file
VRML 1.0 resource is http://vrml.wired.com/vrml.tech/ |
This presentation illustrates many but NOT all the VRML 1.0 nodes using some simple examples taken from |
http://www.npac.syr.edu/users/gcf/vrmldemo/vrml1.0demo.html |
where there is a car and 8 variants on a pyramid defined |
We juxtapose formal definitions of nodes with snippets of VRML from these exemplars |
Note VRML1.0 is a dead language as VRML2.0 has changed nearly all detailed syntax. However design of these two dialects are similar |
This table of Contents
Abstract
Instructor: Geoffrey Fox |
Aided by Alvin Leung for online resource |
Version 8 April 96 -- Some April 97 Updates for VRML2 Context |
Syracuse University |
111 College Place |
Syracuse |
New York 13244-4100 |
VRML 1.0 resource is http://vrml.wired.com/vrml.tech/ |
This presentation illustrates many but NOT all the VRML 1.0 nodes using some simple examples taken from |
http://www.npac.syr.edu/users/gcf/vrmldemo/vrml1.0demo.html |
where there is a car and 8 variants on a pyramid defined |
We juxtapose formal definitions of nodes with snippets of VRML from these exemplars |
Note VRML1.0 is a dead language as VRML2.0 has changed nearly all detailed syntax. However design of these two dialects are similar |
VRML was conceived in the spring of 1994 at the first annual World Wide Web Conference in Geneva, Switzerland. |
Tim Berners-Lee and Dave Raggett organized a Birds-of-a-Feather (BOF) session to discuss Virtual Reality interfaces to the World Wide Web. |
Several BOF attendees described projects already underway to build three dimensional graphical visualization tools which interoperate with the Web. |
Attendees agreed on the need for these tools to have a common language for specifying 3D scene description and WWW hyperlinks -- an analog of HTML for virtual reality. |
The term Virtual Reality Markup Language (VRML) was coined, and the group resolved to begin specification work after the conference. |
The word 'Markup' was later changed to 'Modeling' to reflect the graphical nature of VRML. |
VRML defines scene graphs which are defined hierarchically as a set of nodes |
Nodes fall into one of 36 types arranged into broad classes -- shape, geometry/material, transformation, camera, lighting, group and WWWInline |
The state of a graph (color, position, rotation etc.) are "advanced" (e.g. transformation matrices are multiplied) when each node is encountered
|
Node instances can be given names to allow them to be replicated or otherwise referenced |
Nodes have attributes (properties or parameters if you prefer) which are called fields |
Fields have names for specific node types which have mnemonic value |
However there are a set of global field types ( single or multiple(vector), floating or integer etc.) and each field is assigned a particular type and this implies format that must be used |
Comments begin with # and all characters after this in line are ignored -- just like PERL |
VRML 1.0 files are currently ascii and stored as name.wrl
|
The MIME type for VRML is defined as x-world/x-vrml
|
A VRML file contains one and only one scene graph defined by ONE VRML node at top level
|
We will stick at VRML 1.0 and not discuss 1.1 as this is an intermediate stopping point to be overtaken by VRML 2.0 and so unlikely that set of VRML 1.1 browsers will exist before 2.0 takes over! |
After an Interesting "competition", a new standard VRML2.0 was adopted in May 1996. After some uncertainty, it appears that this standard will be accepted by major players
|
Conceptually it is in most areas similar to VRML1.0 but there are many changes in detail and VRML1.0 is NOT a subset of VRML2.0 (MOST of language is changed) |
Major goal of VRML2.0 was to support dynamic 3D worlds where components of world move relative to each other and interact together
|
VRML uses a cartesian, right-handed, 3-dimensional coordinate system. |
By default, objects are projected onto a 2-dimensional device by projecting them in the direction of the positive Z axis, with the positive X axis to the right and the positive Y axis up. |
A camera or modeling transformation may be used to alter this default projection. |
The standard unit for lengths and distances specified is meters. |
The standard unit for angles is radians. |
Types of fields can be: |
Single Valued -- type name begins with SF
|
Multiple Valued -- type name begins with MF
|
MF types are written
|
SFBitMask, SFBool, SFColor, SFEnum, SFFloat, SFImage, SFlong, SFMatrix, SFRotation, SFString, SFVec2f, SFVec3f
|
MFColor, MFLong, MFVec2f, MFVec3f |
SFColor e.g. 0. .5 .5 -- R G B written with blank separators
|
SFLong -- A field containing a single long (32-bit) integer.
|
SFFloat -- A field that contains one single-precision floating point number.
|
SFMatrix -- A field containing a classic graphics 4 by 4 transformation matrix specifying 3 by 3 orthogonal transformation and a translation in 3 space. (Not in VRML2.0) |
SFMatrices are written to file in row-major order as 16 floating point numbers separated by whitespace. |
For example, a matrix expressing a translation of 7.3 units along the X axis is written as: |
1 0 0 0 0 1 0 0 0 0 1 0 7.3 0 0 1 |
SFRotation -- A field containing an arbitrary rotation. |
SFRotations are written to file as four floating point values separated by whitespace. |
The 4 values represent an axis of rotation followed by the amount of right-handed rotation about that axis, in radians. |
For example, a 180 degree rotation about the Y axis is: |
0 1 0 3.14159265 |
x y z angle |
SFEnum -- A single-value field that contains an enumerated type value. (Removed in VRML2.0)
|
SFString -- A field containing an ASCII string (sequence of characters). Stored as UTF-8 International Character Set in VRML2.0 (Only relevant for general languages)
|
For example valid strings are:
|
SFVec2f -- Field containing a two-dimensional vector e.g. 3.72 7.6 |
SFVec2f's are written to file as a pair of floating point values separated by whitespace. |
Note whitespace used as separator in SF field types and commas in MF field types |
SFVec3f -- Field containing a three-dimensional vector. |
SFVec3fs are written to file as three floating point values separated by whitespace. |
SFImages are written to file as three integers nxpixel nypixel numcomponents=1..4
|
A one-component image will have one-byte hexadecimal values representing the intensity of the image.
|
A two-component image puts the intensity in the first (high) byte and the transparency in the second (low) byte. |
Pixels in a three-component image have the red component in the first (high) byte, followed by the green and blue components (so 0xFF0000 is red). |
Four-component images put the transparency byte after red/green/blue (so 0x0000FF80 is semi-transparent blue).
|
Note: each pixel is actually read as a single unsigned number,
|
Pixels are specified from left to right, bottom to top. The first hexadecimal value is the lower left pixel of the image, and the last value is the upper right pixel. |
For example, 1 2 1 0xFF 0x00 |
is a 1 pixel wide by 2 pixel high greyscale image, with the bottom pixel white and the top pixel black. |
2 4 3 0xFF0000 0xFF00 0 0 0 0 0xFFFFFF 0xFFFF00 |
is a 2 pixel wide by 4 pixel high RGB image |
shown in diagram |
MFColor -- A multiple-value field that contains any number of RGB colors. |
MFColors are written to file as one or more RGB triples of floating point numbers in standard scientific notation. |
When more than one value is present, all of the values must be enclosed in square brackets and separated by commas. |
For example: [ 1.0 0.0 0.0, 0 1 0, 0 0 1 ] represents the three colors red, green, and blue. |
MFLong -- A multiple-value field that contains any number of long (32-bit) integers. Becomes MFInt32 in VRML2.0 |
MFLongs are written to file as one or more integer values, in decimal, hexadecimal or octal format. |
When more than one value is present, all the values are enclosed in square brackets and separated by commas; |
For example: [ 17, -0xE20, -518820 ] |
MFVec2f e.g. [ x1 y1, x2 y2, x3 y3, .... xn yn] -- A multiple-value field that contains any number of two-dimensional vectors. |
MFVec2fs are written to file as one or more pairs of floating point values separated by whitespace. |
When more than one value is present, all of the values are enclosed in square brackets and separated by commas; |
For example: [ 0 0, 1.2 3.4, 98.6 -4e1 ] |
MFVec3f -- A multiple-value field that contains any number of three-dimensional vectors. |
MFVec3fs are written to file as one or more triples of floating point values separated by whitespace. |
When more than one value is present, all of the values are enclosed in square brackets and separated by commas; |
For example: [ 0 0 0, 1.2 3.4 5.6, 98.6 -4e1 212 ] |
VRML1.0 defines several different classes of nodes. Most of the nodes can be classified into one of three categories; shape, property or group. |
Shape nodes define the geometry in the scene.
|
Property nodes affect the way shapes are drawn. |
And Grouping nodes gather other nodes together,
|
Some group nodes also Control nodes whether or not their children are drawn. |
Nodes may contain zero or more fields. |
Each node type defines the type, name, and default value for each of its fields. |
The default value for the field is used if a value for the field is not specified in the VRML file. |
The order in which the fields of a node are read is not important;
|
Note that each VRML node uses local coordinates centered at (0,0,0) |
The data implied by the node is placed in 3D world at position and orientation implied by current accumulated transformation |
Now we examine the 36 nodes grouped by type. |
The first group are the shape nodes. |
These specify geometry: |
AsciiText, |
Cone, Cube, Cylinder, IndexedFaceSet, IndexedLineSet, PointSet, Sphere, |
The second group are the properties. |
These can be further grouped into properties of the geometry and its appearance, matrix or transform properties, and cameras and lights: |
Geometry and Material Nodes |
Coordinate3, FontStyle, Info, LOD,Material, MaterialBinding, Normal, NormalBinding, Texture2, Texture2Transform, TextureCoordinate2, ShapeHints |
The Transformation Nodes |
MatrixTransform, Rotation, Scale, Transform, Translation |
The Camera Nodes |
OrthographicCamera, PerspectiveCamera |
The Lighting Nodes |
DirectionalLight, PointLight, SpotLight |
The Shape nodes are now grouped together as children of a global node of type Shape which specifies geometry and apperance of 3D object
|
Camera nodes are essentially removed and considered part of Browser |
Transform node in VRML2.0 incorporate Separator Transform and sub-transformations such as VRML1.0 Rotation node |
WWWAnchor becomes Anchor; WWWInline Inline and a host of syntax changes in all the other node types |
Most critically are additional capabilities Scripts, Sensors, Sound, Interpolators, Collision, Billboard etc. |
These are the group nodes: |
Group, Separator, Switch, TransformSeparator, WWWAnchor |
Finally, the WWWInline node does not fit neatly into any category. |
WWWInline |
DEF nodename nodetype {
|
} |
or nodetype {fieldschildren} |
The DEF format allows one to specify a name which is optional but can be used to replicate nodes |
In the following we discuss a set of VRML examples situated on |
http://www.npac.syr.edu/users/gcf/vrmldemos/vrmldemo.html |
Major complex example is a car with |
VRML at http://www.npac.syr.edu/users/gcf/vrmldemos/car.wrl |
and a set of 8 "small" examples arranged on one page at |
http://www.npac.syr.edu/users/gcf/vrmldemos/Pyramid/pyramid.wrl |
Each of these VRML files has an associated HTML page describing issues: |
http://www.npac.syr.edu/users/gcf/vrmldemos/car.html |
http://www.npac.syr.edu/users/gcf/vrmldemos/Pyramid/pyramid.html |
The Pyramid VRML(wrl) and HTML files is linked to eight further VRML and associated HTML explanation files |
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/white.html is a basic white Pyramid with simple color and surface properties
|
http://www.npac.syr.edu/users/gcf/vrmldemos/Pyramid/mistake.html |
This incorrectly uses shapehints to specify order of points in rendering |
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/per_vertex.html
|
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/per_vertex_indexed.html
|
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/per_face.html
|
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/per_face_indexed.html
|
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/texture_naive.html
|
http://www.npac.syr.edu/users/gcf/vrmldemos |
/Pyramid/texture.html
|
Separator { # Start Pyramid Scene Graph |
Material {
|
} # We will discuss rest later ..... |
This gives the object some color and surface properties. |
The object is white and it is not reflecting any light. |
The object is mildly lighted (defined by ambientColor), even when there is no light defined in the world. |
This node defines the current surface material properties for all subsequent shapes. |
Material sets several components of the current material during traversal. |
Different shapes interpret materials with multiple values differently. |
To bind materials to shapes, use a MaterialBinding node . |
FILE FORMAT/DEFAULTS
|
Replaced by Transform in VRML2.0 |
This group node performs a push (save) of the traversal state before traversing its children and a pop (restore) after traversing them. |
This isolates the separator's children from the rest of the scene graph. |
A separator can include lights, cameras, coordinates, normals, bindings, and all other properties. |
Separators can also perform render culling. |
Render culling skips over traversal of the separator's children if they are not going to be rendered, based on the comparison of the separator's bounding box with the current view volume. |
Culling is controlled by the renderCulling field.
|
CULLING ENUMS
|
FILE FORMAT/DEFAULTS
|
Coordinate3 {
|
} |
The point field defines the vertices of the object. |
There are five points defined. The points are labeled form 0 to 4. |
Coordinate3 just defines points to be used later in IndexedFaceSet |
Replaced by Coordinate in VRML2.0 |
IndexedFaceSet {
|
} |
Builds Pyramid as 6 triangles formed from original points defined in Coordinate3 |
This part coordIndex unchanged in VRML2 |
This node represents a 3D shape formed by constructing faces (polygons) from vertices located at the current coordinates. |
IndexedFaceSet uses the indices in its coordIndex field to specify the polygonal faces. |
An index of -1 indicates that the current face has ended and the next one begins. |
The vertices of the faces are transformed by the current transformation matrix. |
Treatment of the current material and normal binding is as follows:
|
The DEFAULT material binding is equal to OVERALL. |
The DEFAULT normal binding is equal to PER_VERTEX_INDEXED;
|
MaterialBinding Specification totally changed in VRML2 -- its easier! |
Explicit texture coordinates (as defined by TextureCoordinate2) may be bound to vertices of an indexed shape by using the indices in the textureCoordIndex field.
|
As with all vertex-based shapes, if there is a current texture but no texture coordinates are specified, a default texture coordinate mapping is calculated using the bounding box of the shape.
|
Be sure that the indices contained in the coordIndex, materialIndex, normalIndex, and textureCoordIndex fields are valid with respect to the current state, or errors will occur. |
FILE FORMAT/DEFAULTS |
IndexedFaceSet {
|
} |
14 fields in VRML2.0 also specifying material binding and rendering |
WWWAnchor { # Has Attributes (name) and Children
|
} |
Anchor (and different syntax) in VRML2 |
WWWAnchor works as a Separator and associates a link to the object. |
If the viewer activates this link, the web page specified in name attribute will be displayed on the viewer's browser. |
The link can also point to any HTML page. |
WWWInline provides a way to incorporate VRML objects from the web.
|
The name field provides the URL of the included object. |
The bboxSize defines the bounding box of the object. |
The center of the bounding box can be specified by bboxCenter field. |
The WWWAnchor group node loads a new scene into a VRML browser when one of its children is chosen. |
Exactly how a user "chooses" a child of the WWWAnchor is up to the VRML browser; typically, clicking on one of its children with the mouse will result in the new scene replacing the current scene. |
A WWWAnchor with an empty ("") name does nothing when its children are chosen. |
The name is an arbitrary URL. |
WWWAnchor behaves like a Separator, pushing the traversal state before traversing its children and popping it afterwards. |
The description field in the WWWAnchor allows for a friendly prompt to be displayed as an alternative to the URL in the name field. |
Ideally, browsers will allow the user to choose the description, the URL or both to be displayed for a candidate WWWAnchor. |
The WWWAnchor's map field is an enumerated value that can be either NONE(the default) or POINT.
|
MAP ENUM
|
FILE FORMAT/DEFAULTS |
WWWAnchor {
|
} |
Anchor in VRML2 with additional capabilities (e.g. load into another frame) |
The WWWInline node reads its children from anywhere in the World Wide Web. |
Exactly when its children are read is not defined; reading the children may be delayed until the WWWInline is actually displayed. |
A WWWInline with an empty name does nothing. |
The name is an arbitrary URL. |
The effect of referring to a non-VRML URL in a WWWInline node is undefined. |
If the WWWInline's bboxSize field specifies a non-empty bounding box
|
This allows an implementation to view-volume cull or LOD switch the WWWInline without reading its contents. |
FILE FORMAT/DEFAULTS |
WWWInline {
|
} |
name becomes url in VRML2.0 Inline node |
This node defines a geometric 3D transformation consisting of (in order) a (possibly) non-uniform scale about an arbitrary point, a rotation about an arbitrary point and axis, and a translation. |
FILE FORMAT/DEFAULTS |
Transform {
|
} |
In VRML2.0 Transform is basic grouping node and can also specify bounding box |
Transform {
|
} |
is equivalent to the sequence of elementary VRML transformations |
Translation {translationT1} |
Translation {translationT2} |
Rotation {rotationR1} |
Rotation {rotationR2} |
Scale {scaleFactorS} |
Rotation {rotation-R2} |
Translation {translation-T2} |
This is typical of a particular VRML transform Node with translation and scale also defined |
This node defines a 3D rotation about an arbitrary axis through the origin. |
The rotation is accumulated into the current transformation, which is applied to subsequent shapes. |
FILE FORMAT/DEFAULTS |
Rotation {
|
} |
Removed in VRML2.0 -- Use Transform |
The viewer looks at the world from the top as default but this is changed with position (default 0 0 1) and orientation (default is negative z -- 0 0 1 0 ) |
PerspectiveCamera {
|
} |
Removed in VRML2.0 |
A perspective camera defines a perspective projection from a viewpoint. |
The viewing volume for a perspective camera is a truncated right pyramid. |
By default, the camera is located at (0,0,1) and looks along the negative z-axis; |
The position and orientation fields can be used to change these values. |
The heightAngle field defines the total vertical angle of the viewing volume. |
An OrthographicCamera is similar but does not use perspective (decreasing size with distance from viewpoint) |
FILE FORMAT/DEFAULTS |
PerspectiveCamera {
|
} |
First the whole world is specified as one object as this is the rule! (Not enforced) |
DEF World Separator { # Name of Scene Graph |
This enable the world be used as a component of a larger world. Separator is used as a object wrapper and we will use it to define parts of car later. |
Transform { # A 30 degree rotation about x axis
|
} |
DirectionalLight { # Light the Car !
|
} |
This node defines a directional light source that illuminates along rays parallel to a given 3-dimensional vector. |
A light node defines an illumination source that may affect subsequent shapes in the scene graph, depending on the current lighting style. |
Light sources are affected by the current transformation. |
A light node under a separator does not affect any objects outside that separator. |
FILE FORMAT/DEFAULTS |
DirectionalLight {
|
} |
VRML2.0 adds ambientintensity field |
ShapeHints {
|
} |
ShapeHints node tells the VRML browser about the object, so that optimization can be done during rendering. |
The creaseAngle field tells the browser to do a smooth transition form one polygon to another. |
This will have a more pronounced effect on a curved surface. |
Moved to fields of geometry nodes in VRML2.0 |
Coming back to Triangles defined in IndexedFacSet, we find that ShapeHints has given incorrect advice and so results are unpredictable |
IndexedFaceSet {
|
] |
} |
Moved in VRML2.0 to fields of geometry nodes |
The ShapeHints node indicates that IndexedFaceSets are solid, contain ordered vertices, or contain convex faces. |
These hints allow VRML implementations to optimize certain rendering features. |
Optimizations that may be performed include enabling back-face culling and disabling two-sided lighting. |
For example, if an object is solid and has ordered vertices, an implementation may turn on backface culling and turn off two-sided lighting. |
If the object is not solid but has ordered vertices, it may turn off backface culling and turn on two-sided lighting. |
The ShapeHints node also affects how default normals are generated. |
When an IndexedFaceSet has to generate default normals, it uses the creaseAngle field to determine which edges should be smoothly shaded and which ones should have a sharp crease. |
The crease angle is the angle between surface normals on adjacent polygons. |
For example, a crease angle of .5 radians (the default value) means that an edge between two adjacent polygonal faces will be smooth shaded if the normals to the two faces form an angle that is less than .5 radians (about 30 degrees).
|
VERTEX ORDERING ENUMS
|
SHAPE TYPE ENUMS
|
FACE TYPE ENUMS
|
FILE FORMAT/DEFAULTS |
ShapeHints {
|
} |
Separator { |
Material {
|
} |
Changed in VRML2.0 |
Above we define 18 colors and MaterialBinding value PER_VERTEX associates one with each vertex with no addition needed in IndexFaceSet Node. |
MaterialBinding {
|
} |
Changed in VRML2.0 |
This node specifies how the current materials are bound to shapes that follow in the scene graph. |
Each shape node may interpret bindings differently. |
The current material always has a base value, which is defined by the first value of all material fields. |
Since material fields may have multiple values, the binding determines how these values are distributed over a shape. |
The bindings for faces and vertices are meaningful only for shapes that are made from faces and vertices. |
Similarly, the indexed bindings are only used by the shapes that allow indexing. |
When multiple material values are bound, the values are cycled through, based on the period of the material component with the most values. |
For example, the following table shows the values used when cycling through (or indexing into) a material with 2 ambient colors, 3 diffuse colors, and 1 of all other components in the current material.
|
Material Ambient color Diffuse color Other |
0 0 0 0 |
1 1 1 0 |
2 1 2 0 |
3 (same as 0) 0 0 0 |
BINDINGS
|
FILE FORMAT/DEFAULTS
|
Material { |
diffuseColor [
|
] |
ambientColor 0.1 0.1 0.1 |
} |
Six colors are defined, but only five are used. The colors defined in diffusecolor are labelled from 0 to 5. |
MaterialBinding { # Specify that Vertex Colors will be specified Indirectly
|
} |
One Must now add to IndexedFaceSet a new attribute materialIndex linking vertices to colors (only 0 to 4 used) |
IndexedFaceSet { |
materialIndex [
|
] |
} |
Changed in VRML2.0 |
Material { # Define 6 Colors |
diffuseColor [ # One for each triangle
|
] |
ambientColor 0.1 0.1 0.1 |
} |
Six colors are defined because there are six triangles making up Pyramid. |
MaterialBinding {
|
} |
The browser will pick a color from the list in natural order of triangles and so no change needed in IndexedFaceSet. |
Changed in VRML2.0 |
This uses same Material Node as PER_FACE with 6 colors defined |
MaterialBinding {
|
} |
Tell the browser to pick a color form the list according to the given indices using MaterialIndex attribute in IndexFaceSet Node. |
IndexedFaceSet { # Use Usual CoordIndex Attribute
|
} |
Material {
|
} |
Texture2 {
|
} |
This will wrap Image defined in Texture2 Node onto Pyramid (becomes ImageTexture in VRML2.0) |
This property node defines a texture map and parameters for that map. |
This map is used to apply texture to subsequent shapes as they are rendered. |
The texture can be read from the URL specified by the filename field. |
To turn off texturing, set the filename field to an empty string (""). |
Textures can also be specified inline by setting the image field to contain the texture data. |
Specifying both a URL and data inline will result in undefined behavior. |
WRAP ENUM
|
FILE FORMAT/DEFAULTS |
Texture2 {
|
} |
This Optimizes Placement of Texture Map on Pyramid and initially uses Texture2 Node as in naive placement example |
TextureCoordinate2 {
|
} |
Some reference points: four corners and a middle point, are defined above on the texture map which is always viewed as a rectangle. |
By definition, the texture coordinate goes from 0.0 to 1.0 on the x axis and the y axis of the texture image. |
Becomes TextureCoordinate in VRML2 |
Then the browser is told in MaterialBinding to expect a index value for each vertex. |
MaterialBinding { # Note Indices are "different"
|
} # Using PER_VERTEX_INDEXED |
IndexedFaceSet { # Add to usual coordIndex |
textureCoordIndex [
|
] |
} |
This node defines a set of 2D coordinates to be used to map textures to the vertices of subsequent PointSet, IndexedLineSet, or IndexedFaceSet objects. |
It replaces the current texture coordinates in the rendering state for the shapes to use. |
Texture coordinates range from 0 to 1 across the texture. |
The horizontal coordinate, called S, is specified first, followed by the vertical coordinate, T. |
FILE FORMAT/DEFAULTS |
TextureCoordinate2 {
|
} |
This node defines a 2D transformation applied to texture coordinates. |
This affects the way textures are applied to the surfaces of subsequent shapes. |
The transformation consists of (in order) a non-uniform scale about an arbitrary center point, a rotation about that same point, and a translation. |
This allows a user to change the size and position of the textures on shapes. |
Becomes a field in Appearance node in VRML2.0 |
FILE FORMAT/DEFAULTS |
Texture2Transform {
|
} |
The left front wheel is defined here. |
The transform node is enclosed within a separator, so it only affect the children objects of the wheel. |
The Material node is used to define the color of the wheel. |
DEF LeftFrontWheel Separator { |
Transform {
|
} |
Material {
|
} # Continue LeftFrontWheel on next foil ... |
DEF Wheel Sphere { |
radius 1 |
} |
} # End LeftFrontWheel |
Use Transform and Material as in RightFrontWheel with changed color and translation. |
However we can "copy" actual Wheel with USE command |
DEF RightFrontWheel Separator { |
USE Wheel |
} |
Unchanged in VRML2.0 ! |
This very simple node represents a sphere. |
By default, the sphere is centered at the origin and has a radius (the only attribute) of 1. |
The sphere is transformed by the current cumulative transformation and is drawn with the current material and texture. |
A sphere does not have faces or parts. |
Therefore, the sphere ignores material and normal bindings, using the first material for the entire sphere and using its own normals. |
When a texture is applied to a sphere, the texture covers the entire surface, wrapping counterclockwise from the back of the sphere. |
The texture has a seam at the back on the yz-plane. |
FILE FORMAT/DEFAULTS |
Sphere {
|
} |
The head light consists of three objects, a bottomless cone, a sphere and a pointlight source. |
The PointLight is located inside of the sphere and it gives out a slightly yellow light. |
The light is filtered by the sphere's surface properties with an emissive yellow color. |
The result is a yellow light with a hint of high intensity. |
DEF HeadLight Separator { # We will re-USE! |
Separator { # The Bottomless Cone
|
Material {
|
} |
Cone { # Defines sides of Light
|
} |
} # End Bottomless Cone |
parts replaced by side/bottom in VRML2 |
Separator { # Start Sphere and PointLight
|
# Continue Sphere and PointLight Separator ....
|
} |
} # End HeadLight |
Now we can use the HeadLight again with USE -- good cars have two of them -- this time we save a lot! |
This node represents a simple cone whose central axis is aligned with the y-axis. |
By default, the cone is centered at (0,0,0) and has a size of -1 to +1 in all three directions. |
The cone has a radius of 1 at the bottom and a height of 2, with its apex at 1 and its bottom at -1. |
The cone has two parts: the sides and the bottom. |
The cone is transformed by the current cumulative transformation and is drawn with the current texture and material which will reference the parts. |
If the current material binding is PER_PART or PER_PART_INDEXED, the first current material is used for the sides of the cone, and the second is used for the bottom. |
Otherwise, the first material is used for the entire cone. |
When a texture is applied to a cone, it is applied differently to the sides and bottom.
|
PARTS
|
FILE FORMAT/DEFAULTS |
Cone {
|
} |
parts replaced by side and bottom which are either true or false in VRML2 |
This node defines a point light source at a fixed 3D location. |
A point source illuminates equally in all directions; that is, it is omni-directional. |
A light node defines an illumination source that may affect subsequent shapes in the scene graph, depending on the current lighting style. |
Light sources are as you should expect affected by the current transformation. |
A light node under a separator does not affect any objects outside that separator. |
FILE FORMAT/DEFAULTS |
PointLight {
|
} |
VRML2 adds fields such as attentuation, radius, ambientIntensity |
This node represents a simple capped cylinder centered around the y-axis. |
By default, the cylinder is centered at (0,0,0) and has a default size of -1 to +1 in all three dimensions. |
The cylinder has three parts: the sides, the top (y = +1) and the bottom (y = -1). |
You can use the radius and height fields to create a cylinder with a different size. |
The cylinder is transformed by the current cumulative transformation and is drawn with the current material and texture. |
If the current material binding is PER_PART or PER_PART_INDEXED, the first current material is used for the sides of the cylinder, the second is used for the top, and the third is used for the bottom. |
Otherwise, the first material is used for the entire cylinder. |
When a texture is applied to a cylinder, it is applied differently to the sides, top, and bottom. |
On the sides, the texture wraps counterclockwise (from above) starting at the back of the cylinder. |
The texture has a vertical seam at the back, intersecting the yz-plane. |
For the top and bottom, a circle is cut out of the texture square and applied to the top or bottom circle. |
The top texture appears right side up when the top of the cylinder is tilted toward the +Z axis, and the bottom texture appears right side up when the top of the cylinder is tilted toward the -Z axis. |
PARTS
|
FILE FORMAT/DEFAULTS |
Cylinder {
|
} |
parts replaced by side bottom and top which are true or false in VRML2.0 |
Becomes Text in VRML2.0 |
Here we display the name of manufacturer and when you click on name, you go to their home page. |
WWWAnchor { |
name "http://www.ford.com/" |
Transform { # Put the name where you want
|
} # To be Continued |
AsciiText { # This string is displayed
|
} |
} # End WWWAnchor |
VRML2.0 Text node has Fontstyle field (pointing to Fontstyle node) expressing nature of text |
This node represents strings of text characters from the ASCII coded character set. |
The first string is rendered with its baseline at (0,0,0). |
All subsequent strings advance y by - (size * spacing). |
See node type FontStyle for a description of the size field. |
The justification field determines the placement of the strings in the x dimension as LEFT, CENTER or RIGHT where for instance latter places the right edge of each string at x=0. |
Text is rendered from left to right, top to bottom in the font set by FontStyle. |
The width field defines a suggested width constraint for each string. |
The default is to use the natural width of each string. Setting any value to 0 indicates the natural width should be used for that string. |
The text is transformed by the current cumulative transformation and is drawn with the current material and texture. |
FILE FORMAT/DEFAULTS
|
Specification of JUSTIFICATION enumerated list
|
See Discussion of our Terrain Renderer in VRML for use of LOD Node |
This group node is used to allow applications to switch between various representations of objects automatically. |
The children of this node typically represent the same object or objects at varying levels of detail, from highest detail to lowest. |
The specified center point of the LOD is transformed by the current transformation into world space, and the distance from the transformed center to the world-space eye point is calculated. |
If the distance is less than the first value in the ranges array, then the first child of the LOD group is drawn. |
If between the first and second values in the ranges array, the second child is drawn, etc. |
If there are N values in the ranges array, the LOD group should have N+1 children. |
Specifying too few children will result in the last child being used repeatedly for the lowest levels of detail; |
if too many children are specified, the extra children will be ignored. |
Each value in the range array should be less than the previous value, otherwise results are undefined. |
FILE FORMAT/DEFAULTS |
LOD {
|
} |
VRML2.0 has additional level field whose value is an array of nodes which are object at lebvels of detail specified |