Texture Wrapping Mode

xiaoxiao2021-03-06  42

When the texture post is performed, the image will appear in the (U, V) position of the object surface, and these values ​​are in the [0.0, 1.0] range. However, what happens if this value is exceeded? This is determined by the mapping function of the texture. In OpenGL, such mapping functions are called "texture wraping mode"; in D3D, it is called "Texture Addressing Mode". Frequently with the following: 1. Duplicate (GL_Repeat): The image repeatedly appears on the surface. In the algorithm, the integer portion of the texture coordinate is ignored, and the copy of the texture map is pasted on the surface of the object. For most replication textures, the texture unit at the top of the texture should match the bottom texture unit, and the texture unit on the left side of the texture should also match the texture unit on the right side. This will be seamlessly connected. 2. Intercept (GL_CLAMP): Set the value greater than 1.0 to 1.0, set the value of less than 0.0 to 0.0, which will be exceeded in [0.0, 1.0] range, which will cause the edge of the texture. Repeat. 3. Mirror repeat (GL_Mirrored_repeat_arb): The image is constantly repeating on the surface of the object, but the image is mirror or reversed each time it is repeated. This is compared at the edge of the texture. Implemented through the ARB_TEXTURE_MIRRORED_REPEAT extension in OpenGL. 4. Boundary interception (CLAMP_TO_BORDER_ARB): Draws the parameter values ​​outside the [0.0, 1.0] range with separate boundary color or texture edges. Advisor paper suitable for drawing objects. Implementing the ARB_TEXTURE_BORDER_CLAMP extension in OpenGL, CLAMP_TO_BORDER_ARB intercends the texture coordinates at all MIPMap hierarchy, so that NEAREST and LINEAR are filtered to return only the color of the boundary texture unit. 5. Edge interception (GL_CLAMP_TO_EDGE): Also ignores the boundary. Texture units in the texture edge or near the edge of the texture are used as texture calculations, but do not include the texture unit on the boundary. The original GL_CLAMP is not described in detail in OpenGL1.2. According to the definition, in the dual-line interpolation process, the point other than the texture boundary is formed by each of the textured edge pixels and the boundary colors. In OpenGL1.2, GL_CLAMP_TO_EDGE is introduced to correct this problem. At the same time, GL_CLAMP_TO_BORDER_ARB only samples the boundary points on the texture boundaries. However, because many hardware does not support boundary processing, the effect of GL_CLAMP_TP_EDGE and GL_CLAMP is like it is the same. The new hardware (such as GeForce3) has effects GL_CLAMP correctly, but the result is usually not expected.

转载请注明原文地址:https://www.9cbs.com/read-55958.html

New Post(0)