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

Textures


VRML 2.0 allows you to use Images, Movies and Pixel defined images to texture your shapes. When texturing a shape the texture is applied by default to each of the faces of the shape.

The following figure shows an example using an image to texture all the primitive shapes:

The texture image used in the above example is

One can also specify in this node if the texture is to be repeated for each of the faces of the shape. The following figure shows an example for a single square face using the same image as above for texturing:

As you can see from the above example the image can be repeated verticaly, horizontaly, both, or none.

There is still more, you can translate, and rotate the texture as the next figure shows.

In the above example the number of images is set to 4 in both dimensions, the image is translated (see the lower left corner), and finally the texture is rotated roughly 45 degrees (remember that in VRML the angles are measured in radians, the rotation in radians use was 0.75).

In order to fully understand the the understanding of the texture coordinate system is needed. A texture is represented in a 2-D coordinate system (s,t) that ranges from 0 to 1 in both directions.

The geometric operations mentioned above, scale, translation, and rotation, are aplied in this coordinate system.

See the TextureTransform and TextureCoordinate (only applies to IndexedFaceSet and ElevationGrid) for more detailed information.

Combining Textures with Materials

Image Types

  • color: The shape's diffuse color specified in the Material node is ignored.
  • grayscale: The image's gray values are multiplied by the diffuse color.
  • The following image shows a grayscale image applied to 4 cubes with different diffuse colors: red, green, blue and white.

    Transparency

    Some file formats support transparency levels for pixels. PNG fully implements this concept. Not all GIF formats support pixel transparency level, instead a color can be selected to be transparent. JPEG file format does not support transparency information.

    When using an image with pixel transparency, the transparency level overrides the transparency of the Material node. JPEG file format does not support transparency information.