# bumpmapping question

This topic is 4276 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

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

#### Share this post

##### Share on other sites
Right, the normal map. I think this page will have the information you're looking for.

#### Share this post

##### Share on other sites
Quote:
 Original post by FunkymunkyRight, 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

##### 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

##### Share on other sites
Quote:
 Original post by LodeOh 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

##### Share on other sites
Allright, a simple convolution filter mask, nice, thanks :)

#### Share this 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

##### Share on other sites

This topic is 4276 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.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• ### Forum Statistics

• Total Topics
628730
• Total Posts
2984431

• 25
• 11
• 10
• 16
• 14