Results 1 to 4 of 4

Thread: NVidia Bump Mapping

  1. #1
    Junior Member Newbie
    Join Date
    May 2004
    Posts
    11

    NVidia Bump Mapping

    I'm trying to follow the bump mapping from the NVidia SDK, and have yet to get it working in a demo I'm doing. Basically I took one texture and used Photoshop to create a grayscale alpha channel version of the original texture adding some height to the texture to give it the "bump" effect. Now as I understand it the textures have to be combined using multitexturing and blending, so I'm trying to do the following:

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE,GL_ONE);

    glActiveTextureARB(GL_TEXTURE0_ARB);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, m_textures[1]);
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
    glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);

    glActiveTextureARB(GL_TEXTURE1_ARB);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, m_textures[3]);
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
    glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);

    And then I use:

    glMultiTexCoord2fARB(GL_TEXTURE0_ARB,...)
    glMultiTexCoord2fARB(GL_TEXTURE1_ARB,...)

    What am I doing wrong?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: NVidia Bump Mapping

    "What am I doing wrong?"

    Well, where should I start?

    First, let's separate the notions of blending (that is, blending as in glEnable(GL_BLEND)) and multitexture per-fragment operations (those activated with glTexEnv* and it's kin). What you need are multitextured per-fragment operations.

    Secondly, you should understand that bump mapping isn't like turning on a switch (it should be, but it isn't). If you're talking about tangent-space bump mapping (sometimes referred to as DotProduct3 bump mapping), which is what most nVidia code uses, you have to do a lot of work:

    1: convert your height map (the alpha map you generated in Photoshop) into a normal offset map.
    2: Per vertex, you must compute and transform the light-space normals into tangent space via a transformation matrix.
    3: You must pass this tangent-space light normal through your vertex processing as a color (so you have to disable lighting).
    4: Per-pixel, you must set your multitexturing per-fragment operation to perform a dot product combination between the normal offset map and the interpolated tangent-space light normal.
    5: Lastly, you must modulate the result of the last stage with your regular texture color.

    If you don't understand these steps, feel free to look at nVidia's website. There are numerous demos, and some of them have pretty good documentation. Also, try downloading the nVidia OpenGL SDK; it's pretty helpful for learning about Tangent-Space bump mapping.

    In short, bump mapping isn't simple. It is a complex exercise that requires significant time to get working right.

  3. #3
    Junior Member Newbie
    Join Date
    May 2004
    Posts
    11

    Re: NVidia Bump Mapping

    Thanks a bunch. I was mistaken in that I thought bump mapping was simply multitexturing with the texture map and height map. Now I realize why all the NVidia demos I've seen were much more complicated. I really appreciate the help and will download some more of the NVidia demos.

  4. #4
    Member Contributor
    Join Date
    May 2001
    Location
    Cheltenham,Gloucestershire,England
    Posts
    59

    Re: NVidia Bump Mapping

    hi there,

    just before i start down the bump mapping route is
    it possible to do it with multiple light
    sources?

    mark.

Similar Threads

  1. opengl bump mapping (normal mapping) problem with VBO and GLSL
    By emrekaya413 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-29-2018, 03:52 AM
  2. Some Bump Mapping Questions (cube-mapping)
    By Whooster in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-14-2012, 11:55 PM
  3. Discussion about plastic bump mapping ...ooops ...dot3 bump mapping
    By raverbach in forum OpenGL: Advanced Coding
    Replies: 23
    Last Post: 03-31-2003, 02:31 PM
  4. Bump mapping in UT and Q3
    By Jigro in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 01-29-2001, 03:43 PM
  5. Bump mapping in Q3 and UT
    By Jigro in forum OpenGL: User Software
    Replies: 0
    Last Post: 01-29-2001, 03:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean