You can wrap your objects with any pictures you like. Using
Texture mapping will save the complexity to express the objects
and its surface.
Node classes Used for Texture Mapping
The image file that you use for the texture should be .rgb format.
sample of .rgb image:
There are 7 node classes:
Wrapping objects
If you use textures, you need only the SoTexture2 node.
SoTexture2
SoTexture2 node has these fields:
SoTexture2, especially filename field is the basis of texture mapping.
Using the filename field: the Default Texture Mapping
Using image field: make the texture by
pixel (not an image file). Set the filename field empty. See How to use SoSFImage
Using wrapS and wrapT fields: the possible values are REPEAT
(default) and CLAMP (repeat the last pixel).See The difference between REPEAT and CLAMP
Using model field: the possible values are MODULATE (default),
DECAL (change the model's shaded color to the texture color), and
BLEND (blend the shaded color and blend a color).
Using blendColor field: when BLEND texture model will be used, it
specifies the color to blend.
Coordinate a texture
These nodes coordinate texture map by texture-coordinate functions
SoTextureCoordinate2 , SoTextureCoordinateBinding
SoTextureCoordinate2 node has a field
SoTextureCoordinateBinding node has a field
SoTextureCoordinate2 node coordinates the texture on the shape made by
vertex. In many cases, it causes some warps of the texture.
SoTextureCoordinateBinding node defines that the current texture
coordinates will be bound to the shape nodes.
Using point and value fields: If the binding
coordinate is default, value is needless.
SoTextureCoordinatePlane
SoTextureCoordinatePlane node has two fields:
SoTextureCoordinatePlane node changes the repeat frequency (interval)
Transforming a Texture Map
SoTexture2Transform node transforms the texture by 4 ways
SoTexture2Transform
There are 4 fields of the SoTexture2Transform node:
SoTexture2Transform transforms the texture not how to wrap the
object with the texture.
Using translation field: translate a texture in 2 vector (float).
Using rotation field: rotate a texture in radians.
Using scaleFactor field: scaling the texture in 2 vector (float).
Using center field: change the center of the rotation in 2 vector (float).
Advanced coordinate methods of texture mapping
There are two nodes for the advanced texture
mapping.
SoTextureCoordinateEnvironment
SoTextureCoordinateEnvironment node reflects the environment on
the objects like
a mirror. You need to create spherical reflection map (refer to
"OpenGL Programming Guide").
SoTextureCoordinateDefault
SoTextureCoordinateDefault node cancels the last texture coordinate
function and make default texture coordinates.
s1021058@u-aizu.ac.jp