Eighth Talk Texture mapping
In the previous lecture, we used material nodes to change the appearance of the object. These properties are only the macroscopic effects of consistency, and we have not yet touched upon some of the details of the object. Texture mapping and processing can enhance the expressive force for the surface details of an object. This lecture is divided into three parts to discuss: First, the use of X3D basic texture nodes, the second is the use of the texture of the coordinate system, the third is the transformation of the texture.
The use of X3D basic texture nodes
In X3d, the pixeltexture (pixel texture), imagetexture (texture), and movietexture (image texture) Three nodes are provided. For movietexture (image texture) nodes, we'll discuss them in more detail later in the "Multimedia Effects" section, which discusses only the first two basic texture nodes.
1, pixeltexture (pixel texture) node
The Pixeltexture node creates a two-dimensional texture map with an array of pixel values, the main attributes of which are:
Image-defines a two-dimensional image with an array. The array is divided into two parts, the first three is its eigenvalues, and the following values are the actual pixel values.
The first three eigenvalues mean that the first to second number is used to represent the number of pixels in the direction of width and height, and the third value is the composition of the byte of the actual pixel that follows. as follows:
When 1 o'clock, the pixel value is single-byte, that is, the range of values is 0x00~0xff, which indicates brightness (gray level);
When 2 o'clock, the pixel value is Double-byte, the 1th byte represents brightness, and the 2nd byte represents the alpha value (that is, transparency).
When 3 o'clock, the pixel value is three bytes and is used to represent the RGB color components.
When 4 o'clock, the pixel value is four bytes, the first three bytes are used to represent RGB color components, and the fourth byte represents the alpha value.
Repeats--Indicates whether the texture is repeated horizontally along the s axis. The default value is true.
Repeatt--Indicates whether the texture is repeated vertically along the T axis. The default value is true.
Repeatt [Repeatt:initializeonly type Sfbool (true|false) "true"]
Let's look at a simple sample code:
Where the image value of the Pixeltexture node is "2 2 3 0xff0000 0x00ff00 0x0000ff 0xffffff". In other words, the pixel value uses three bytes, representing RGB color components respectively. Because both width and height specify 2 quantities, you need to 2x2=4 a pixel value.
As shown in the following figure, note the color distribution of the cube (different browser plug-ins may result in the same results).