Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Two bump-mapping questions

  1. #1

    Two bump-mapping questions

    Alright, I think I've got it!!!
    I have a light vector that is from a light source to a vertex that has been tranformed to eye space. Now, if I multiply this vector by the inverse modelview matrix, I get the vector in object space right?

    Now here's what I'm thinking...The inverse of a matrix that has only been rigidly transformed (ie no scales or skews), is just the transpose of itself (I read it in a math book at least .) Now, is it the same if the matrix has been translated? Or does the translation somehow throw off the inverse calcs?

    The thing is, I have a bump-mapping algorithm that works well if a light position and three vertices are passed in. The trouble comes when I try to bump map only knowing a vertex, its normal, and a light position. I'd love to use the alg I already have (which requires three vertices), but my boss wants the alg to work if only one vertex can be known at any given time . I'd appreciate any help.


    [This message has been edited by yoale (edited 05-05-2003).]

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

    Re: Two bump-mapping questions

    Yes, the translation throws it off. That's because the 4x4 is no longer orthonormal.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  3. #3

    Re: Two bump-mapping questions

    Aha!!!! I thought so. Now, I'm curious if there is a way to compute the inverse without resorting to Gausian Elimination (did I spell that right? )

  4. #4

    Re: Two bump-mapping questions

    Well, thanx jwatte! I think I have the necessay calcs!

    According to something I found in an ATI demo...
    inv[13] = matrix[12,13,14] dotprod matrix[0,1,2]
    inv[14] = matrix[12,13,14] dotprod matrix[4,5,6]
    inv[15] = matrix[12,13,14] dotprod matrix[8,9,10]

    That's it then, right? If so, this was by far the quickest I've ever resolved a programming problem, in less than an hour! Thanks again! Keep up the good work.

    [This message has been edited by yoale (edited 05-05-2003).]

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,704

    Re: Two bump-mapping questions

    Congratulations! You solved the problem by using available information on the web. This is one of the best skills to have. (That, and debugging).

    Basically, what happens in that code is that you invert the rotation, and then back-rotate the offset part. This works as long as there is no skew or stretch.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •