hide random home http://www.sgi.com/tech/Inventor/VRML/Chap7.html (Silicon Surf Promotional CD, 01/1995)

Summary of The Inventor Mentor - Chap 7

Chapter 7: Textures

Textures can greatly increase the quality of a rendered image. Textures are used to add visual detail to a model without increasing the number of polygons in the model.

This chapter describes how to use textures in an Inventor scene graph.

Up to Summary of The Inventor Mentor
Back to Chapter 6 - Text
On to Chapter 8 - Curves and Surfaces


Creating Textured Objects

To display a textured object, you need a list of polygons comprising the object on which the texture is to be displayed and a 2 dimensional bitmap or image which is called a texture map. The mapping between the texture and the polygons is controlled by assigning texture coordinates to individual vertices.

2 dimensional images used as texture maps can be read from file or stored in memory. Currently only SGI's rgb image format is supported on the SGI's but there are many ways to convert image files to the SGI rgb format.

Note: One page 157, a texture map is described as a 1x1 square. However, a texture map does not have to have the same dimension in height and in width. When a square or rectangular bitmap is read into memory, it is assigned coordinates between 0.0 and 1.0 in both directions. These coordinates are mapped to the texture coordinates on the vertices of the polygon.

Example

The following example uses an SoTexture2 node to apply the bitmap contained in "texture.rgb" to a cube.

#Inventor V2.0 ascii

Separator {
    Texture2 {
	filename "texture.rgb"
    }
    Cube {
    }
}

Nodes used for Texture Mapping

SoTexture2
Used to specify bitmap for texturing.
SoTextureCoordinate2
Contains list of texture coordinates to be indexed by subsequent vertices.
SoTextureCoordinateBinding
Describes texture coordinate binding for following shape nodes.
SoTextureCoordinatePlane
SoTextureCoordinateEnvironment
These nodes allow the use of spatial functions for creating texture coordinates.
SoTextureCoordinateDefault
Turns off previous texture coordinate functions.
SoTexture2Transform
Transforms a 2D texture map

How a Texture Affects Underlying Colors

Texture maps can be used to modulate the color and the transparency of an object. Normally, when drawing shaded images, a polygons color (or "shaded color") is calculated based on the current SoMaterial node. When a texture is used to MODULATE the color, the shaded color is combined with the texture color. When it is used as a DECAL, the texture color replaces the shaded color. With BLEND mode turned on and a one or two-component texture map, the final color is blended between the shaded color and a constant blend color. (See Plates 10-13 between pages 252 and 253 for examples.)

Mapping the Texture Onto an Object

To map the texture onto the object, you can use the default texture mapping for the shape node, as in the above example. However, you will often want more control over how the texture is mapped to the polygons of the object.

An SoTextureCoordinate2 node can be used to align specific texture coordinates to polygon vertices.

There are also two texture coordinate functions that can be applied to shapes: SoTextureCoordinatePlane and SoTextureCoordinateEnvironment.

Chapter 7 goes into detail about how to use the various texture mapping techniques.

Glossary

SoMaterial
This is a node used in Inventor to specify how the object looks under different lighting conditions. An SoMaterial node includes information about the way an object emits, reflects, and absorbs light, along with how shiny and transparent the object is.
Texture Map
A 2 dimensional bitmap containing an image to be mapped onto the polygons representing an object. Texture mapping an image of bricks onto a rectangular surface can give the appearance of a brick wall.
Texture Coordinates
Texture coordinates are 2 dimensional numbers assigned to vertices of a polygon. These coordinates are responsible for telling the graphics engine what part of the texture appears on the polygon.

Author/Summarizer:
John Barrus <barrus@merl.com>


Up to Summary of The Inventor Mentor
Back to Chapter 6 - Text
On to Chapter 8 - Curves and Surfaces