# Normal for bump mapping

This topic is 3017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,

I was looking at a nice tutorial on how to perform simple 2D bump mapping.
http://www.gamedev.net/reference/articles/article327.asp

There is just one little thing I don't get:

------------------
If we know X and Y of normal, we can calculate it's Z
(as normals are unit vectors. So Z is simply 1-sqrt(X^2 + Y^2) ).
------------------

If I do the maths, as the normal is a vector unit then:

1 = sqrt(x^2 + y^2 + z^2)
1 = x^2 + y^2 + z^2
1 - x^2 - y^2 = z^2
z = sqrt(1 - (x^2 + y^2))

Which is not the same formula as in the tutorial...
Could anyone tell me where the problem is?

Thanks

##### Share on other sites
Yeah starting with
1 = (x^2 + y^2 + z^2)^0.5
I end up with
z = (1 - x^2 - y^2)^0.5

Perhaps the author you're quoting has made a mistake... This nvidia page also lists the solution as
Z = sqrt( 1 - X * X - Y * Y )

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009811
• ### Who's Online (See full list)

There are no registered users currently online

×