Concave and convex textures

Source: Internet
Author: User
Wikipedia, a free encyclopedia

(Redirect self-convex texture)

Jump to: navigation, search

A sphere without a concave and convex texture; the convex and concave texture used; this sphere with a concave and convex texture is exactly the same as the above sphere, which changes the light effect of the sphere and makes it look like an orange.

Concave and convex textures(Bump mapping), also knownWrinkle textureIs a computer graphics technology. In this technology, each pixel to be rendered must be added with a disturbance found in the height graph before computing illumination. As a result, the surface is richer and more meticulous, which is closer to the appearance of an object in nature. Normal texture is a common concave/convex texture technology, and there are many other implementation technologies, such as parallax ing.

directory

[hide]

  • 1 Implementation

    • 1.1 bmem technology
    • 1.2 normal map method
  • 2 fake concave and convex maps
  • 3 Differences with displacement ing
  • 4 references
  • 5 link
  • 6 See


[Edit] Implementation[Edit] Bmem Technology

The bmem technology stores the height information of each vertex through a gray scale map called a height map and is directly processed by the API.

[Edit] Normal Map Method

Primary entry:Normal Map

But in fact, game programmers generally do not like to use the bmem technology, because it is slow to execute, so they usually use dp3 technology: directly put the height map (height map) converts a line chart to a normal map. The RGB values of the map are the normal directions of the original height: NX, NY, and NZ, this figure can be computed by direct3d functions. Finally, when rendering the image, multiply each pixel of the height image and the vector vertex of the light source to obtain the image indicating the brightness coefficient of each vertex. Based on the height chart, the more prominent the image is, the smaller the angle between the normal and the light source, the greater the value of this point. Then multiply the figure into the rendering line, so that the model has a shadow in the concave area of the backlight and a brighter effect in the light source, such a 3D model looks like it is really uneven! These can be directly completed by machines in the rendering pipeline.

You can use the following simple statements:

 // Convert the light source location to argb DWORD vector2argb( D3dxvector3 * V, Float Height )  { DWORD R =  ( DWORD )  ( 127.0f * V -  > X + 128.0f )  ; DWORD g =  ( DWORD )  ( 127.0f * V -  > Y + 128.0f )  ; DWORD B =  ( DWORD )  ( 127.0f * V -  > Z + 128.0f )  ; DWORD =  ( DWORD)  ( 255.0f * Height )  ;  Return  (  ( A < 24l )  +  ( R < 16l )  +  ( G < 8l )  + B ) ;  }  // Generate a line chart D3dxcomputenormalmap ( Pnormalmap, pheightmap, Null , 0, d3d_channel_red, 1.0f )  ;  // Pheightmap is the pointer of the original height graph, and pnormalmap is an empty texture used to store the line chart  // During renderingProgramIt can be written as follows: DWORD F = Vector2argb (  & Light, 0.0f )  ;   // Light is a unit light source vector PD - > Setrenderstate ( D3drs_texturefactor, F )  ;  // Pd is the device pointer of d3d. PD -  > Settexture ( 1, texture )  ;  // Set the original texture, as shown in the preceding figure. You can paste the texture style as needed. PD -  > Settexture ( 0, normalmap )  ;  // Use the line chart generated above PD-  > Settexturestagestate ( 0, d3dtss_colorarg1, d3dta_texture )  ;  // Set "source 1" as a line chart PD -  > Settexturestagestate ( 0, d3dtss_colodrop, d3dtop_dotproduct3 )  ;  // Perform point multiplication between "source 1" (line chart) and "source 2" (light source normal ). PD -  > Settexturestagestate ( 0, d3dtss_colorarg2, d3dta_tfactor ) ;  // Set "source 2" as the light source normal parameter PD -  > Settexturestagestate ( 1, d3dtss_colorarg1, d3dta_texture )  ;  // Add the original texture of the image in this step and the following steps PD -  > Settexturestagestate ( 1, d3dtss_colodrop, d3dtop_modulate )  ; PD -  > Settexturestagestate ( 1, d3dtss_colorarg2, d3dta_current)  ; 
[Edit] Fake concave-convex texture

3D computer graphics Programmers sometimes use fake pasters with a small amount of computing to simulate the Paster effect. One of the methods is to replace the normal variation of the surface with the texture index change, which is often used for two-dimensional concave and convex textures. This technology is used in geforce 2 graphics acceleration hardware.

The full-screen two-dimensional false concave-convex texture can be easily implemented using a simple and fast rendering loop. The demonstration image in 1990s was a very common visual effect.

[Edit] Difference between ing and displacement

The difference between the displacement ing and the concave-convex texture is already obvious in the example diagram: In the concave-convex texture, only the normal is disturbed, and the ry itself is not disturbed, the result is that the human changes only appear on the contour of the object, and the sphere itself is still the original circle. That is, the concave-convex texture is only a visual change, just like an image that is very pivoting; while the displacement ing actually changes the 3D object to "uneven ".

[Edit] References
    • BlinN, James F. "Wrinkle surface simulation", computer graphics, vol. 12 (3), pp. 286-292 SIGGRAPH-ACM (August 1978)
[Edit] Link
    • Examples of real-time concave and convex textures implemented by http://www.jawed.com/bump/ Java language (includingSource code)
    • Http://www.blacksmith-studios.dk/projects/downloads/bumpmapping_using_cg.php bump mapping tutorial Using CG and C ++
[Edit] See
    • Texture ing
    • Normal ing
    • Parallax ing
    • Displacement ing
    • Embossed texture ing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.