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.

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.