Jump to content
  • Advertisement
Sign in to follow this  
Lode

bumpmapping question

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

We learned in a class about CG that a bumpmap causes its effect by changing the direction of normals before doing the light calculations, but the professor didn't say in what direction those normals have to move when using a grayscale bumpmap. So, in what direction do the normals have to move?

Share this post


Link to post
Share on other sites
Advertisement
You know, I'll never beat your raytracer (yes, I'm in that class too) if you keep adding features :/.

Share this post


Link to post
Share on other sites
Quote:
Original post by Funkymunky
Right, the normal map. I think this page will have the information you're looking for.


Oh great, the most crucial step (converting from bumpmap to normal map) isn't explained in the tutorial, it just gives a list of programs that can do it for you. I'm interested in the way to do this in my own software.

Still an interesting read though.

Share this post


Link to post
Share on other sites
But that's not the end of the story.

You still have to transform the normal map vectors into tangent space.

This means finding the Normal (you've got it already), Binormal and Tangent vectors for each triangle in the scene, then converting it into a matrix and applying the matrix to each normal map vector.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lode
Oh great, the most crucial step (converting from bumpmap to normal map) isn't explained in the tutorial, it just gives a list of programs that can do it for you. I'm interested in the way to do this in my own software.

You would want to use a Sobel filter on the bump map, which is basically something that calculates the gradient of the image intensity at some pixel. Since the grayscale bump map represents a heightmap, you can use this to generate your normals! I happened to stumble upon some example code here. You'd be utterly surprised at just how easily the normal map is computed, I was actually more surprised at how difficult it was just to find a piece of example code.

Share this post


Link to post
Share on other sites
In practice, you'll need more than one filter (and a way to propagate externally baked normal maps) depending on what you're bumping, Sobel tends to produce 'rough' bumpage.

Then when rendering, matrix aren't the only option to make the trip into tangent space even more so for a raytracer where i'd assume it would be wiser to precompute those (or some) per triangle terms so you want that representation to be compact; that's what i do anyway.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!