Texture Nodes

Three types of texture Nodes are supported by VRML: ImageTexture, PixelTexture, and MovieTexture. PixelTexture can be used to create a gradient shade on the surface of an object. PixelTexture is also the only way to embed a texture in the actual VRML source code. The MovieTexture node maps an MPEG movie to the surface of the object. The fields of the MovieTexture node can be manipulated to change how the movie will be displayed. A good VRML book or one of the onlinen references will provide more insight into the PixelTexture or MovieTexture nodes.

The ImageTexture node is the most common way to map a texture to the surface of an object. The following is the syntax for the ImageTexture node:

ImageTexture { url [] repeatS TRUE repeatT TRUE }

To map a texture, simply specify the filename of the image in the url field. RepeatS and repeatT specify whether the texture should be repeatedly mapped across the entire surface of the object. To most people, this is known as tiling. RepeatS specifies to tile in the S direction (horizontal) and RepeatT specifies to tile in the T direction (vertical).

The following code maps a brick texture to a box:

Shape { appearance Appearance { material Material {} texture ImageTexture { url "brick.jpg" } } } geometry Box {} }