Sign in to follow this  
MichaelMook

Single-Pass DOT3 Bump Mapping Tutorial

Recommended Posts

Hey everyone, after spending over a week busting my head trying to get DOT3 Bump Mapping to work, I ended up with a success, and a tutorial to help those of you who are trying to figure this out as well. By no means is it an "uber" or "professional" tutorial, but I hope it helps. http://www.unraveledmind.com/bumpmap.html I use this technique in a 3D engine I'm playing around with that I started writing less than two weeks ago. The Engine's source is also included. :) From 3DS file loading to easy stuff such as frustum culling, it covers quite a few things. Hopefully some of you will find this helpful in your own projects. Share the lewt, so to speak. :)

Share this post


Link to post
Share on other sites
had a quick look
nice one (esp with the recent spate of bumpmapping posts here)
though do u really need to mipmap the cubemap

Share this post


Link to post
Share on other sites
I like your tutorial.

One problem I noticed is that your texture is mirrored which causes your bumps to be 'outies' on the right half of the model, and 'innies' on the other.

You can fix this either by not mirroring textures, or by using a more robust method of generating tangent space. One method is the NVMeshMender class on the nvidia dev webiste, although that's overkill for the purposes of your tutorial.

Share this post


Link to post
Share on other sites
zedzeek: Mipmapping turned on makes the framerate higher actually, surprising as it is. Try it without, see what happens. ;)

SimmerD: I never actually noticed that until you mentioned it. Interesting side-effect, I suppose. I can see why it's happening though. I created half of the model using 3D Studio Max and simply mirrored the other half, didn't really consider the fact that it would make the bump map inverted, I suppose.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It's not very surprising that mipmapping raises your framerate as this will make more texture accesses hit the caches on the graphics card, because accesses to a lower mip will be more "together" than accesses to a minified bigger mip.

Share this post


Link to post
Share on other sites
Just a quick update. I fixed the flipped bumpmap problem by adding this code right after it normalizes the tangents:

// Check to make sure the texture isn't mirrored from right to left, and flip the S Tangent if it is
if(Dot(Cross(vSTangent[iV], vTTangent[iV]), vNormal[iV]) < 0.0f) vSTangent[iV] = -vSTangent[iV];

Share this post


Link to post
Share on other sites
i was sorta thinking of building the mipmaps not giving the correct result (ie a normalized vector) but on further thought its gonna be very close

Share this post


Link to post
Share on other sites

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

Sign in to follow this