Introduction to embossed bump mapping

Source: Internet
Author: User
Bump mapping is a illumination technique used to disturb the surface vector of an object at the pixel level. It simulates the object's "bumps" by changing the light calculation ". A paper first published by Jim BlinN named "simulation of wrinkled surfaces" by bump mapping. blinN uses a grayscale height map to simulate the disturbance of the surface normal vector of an object. so what is bump map? How can we create a bump map? Bump Map is a texture map that contains relief information that will be applied to 3D models. relief information has several forms, one of which is elevation or height map, which stores the height variables of each pixel and is usually stored in grayscale format; the other is normal map, stores the normal vector of each pixel in the texture map. in this case, the RGB value is usually used as the 3D coordinate of the normal vector. simply put: bump mapped rendered surface = base_texture + bump_mapped texture the principles and algorithms of bump mapping are found in nehe lesson22 and emboss bump mapping by Michael I. gold, NVIDIA Corp. mongo.ppt, 309 K] has been explained in detail, and I will not repeat it here. I only want to explain some key points and some problems I encountered during my learning. C = (L · N) * dl * DM (1)
  • L is light Vector
  • N is normal vector
  • DL is light diffuse color
  • DM is material diffuse color
(L · n) = (FD + (H1-H0) (2) (H1-H0) is the bump_mapped texture we have built. But how do we implement (H1-H0) in formula 2? This is created in the nehe Tutorial: the first image has half the brightness of the original height map (h0 = RGB/2 ); the second image has the brightness (inverth1 = (255-rgb)/2) of the original height map invert image. H0 is used for the first draw and inverth1 is used for the second draw (Remember, the texture coordinates must be slightly offset to the light source. The "additive blending" texture mixing mode (glblendfunc (gl_one, gl_one), H = H0 + inverth1 * perturbed) is also used ). if inverth1 is not offset, A (127,127,127) grayscale image is mixed. let's try it. after the two diagrams are mixed, a value greater than 0.5 is used to simulate the surface of the light source, and a value less than 0.5 is used to simulate the Back-to-source light source. the next point is to calculate all the vectors of light vector for each vertex must be in the same coordinate system, object or world space. if we convert the defined in object space (defined in space) of thousands of fragments to the World Space (light is usually defined in the space), a lot of operations are required, so it is a better choice that transform the light position from world to local space using the inverse transformation matrix. tangent space. tangent space generally defines a local coordinate system (TBN, normal vector, tangent vector, binormal vector) by a set of vectors, as shown in: T parallel texture U direction, B is perpendicular to T and N at the same time. first, the tangent space of all vertices is calculated in the object space on the premise that the texture coordinates U and V are known. in combination with the preceding descriptions, we can calculate the components of light vector (which has been converted from World Space to object space) in the tangent space of each vertex: the offset direction of the reverse graph is determined by [lrelx 0 lrelz], which corresponds to the direction u, v. if you use multitexture to process H0 and inverth1, you need hardware support and corresponding Texture Information settings (texture images, filters, environments, coordinates, and matrices) for each Texture unit) specify the current texture ing function for gl_texture0_arb: gltexenvf (gl_texture_env, gl_texture_env_mode, gl_combine_ext );
Gltexenvf (gl_texture_env, delimiter, gl_replace); specify the current texture ing function for gl_texture1_arb: gltexenvf (gl_texture_env, gl_texture_env_mode, gl_combine_ext );
Gltexenvf (gl_texture_env, gl_combine_rgb_ext, gl_add); gl_combine_ext, gl_combine_rgb_ext, gl_add in OpenGL 1.2 reference manual has an interpreted http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp? Topic =/com.ibm.aix.doc/libs/openglrf/gltexenv.htm in multitexture processing bump mapping, several lines of code have been puzzled: // disable second Texture unit
Glactivetexturearb (gl_texturew.arb );
Gldisable (gl_texture_2d );
 
// Bind base texture to Texture unit 0
Glactivetexturearb (gl_texture0_arb );
Glable (gl_texture_2d );
Glbindtexture (gl_texture_2d, basetexture! Remember, remember, it cannot be fully believed that pai_^ embossed bump mapping is the simplest type of bump mapping, which is not practical and can only be used in diffuse lighting. However, it is a primer technique that understands bump mapping. there are three other bump mapping technologies to be further explored (the driving force of forward, sigh). The following lists the four related technologies:
  • Embossed bump mapping
  • Perturbed UV bump mapping
  • Perturbed normals bump mapping
  • Dot Product bump mapping
See also: http://developer.nvidia.com/object/GL_Bump.htmlhttp://www.pvrdev.com/pub/PC/doc/f/Bump%20Mapping%20Comparison.htmhttp://nehe.gamedev.net/data/lessons/lesson.asp? Lesson = 22 http://www.pvrdev.com/pub/PC/doc/f/Bump%20Mapping.htm

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.