Dhpoware Demos Normal Mapping unexpected result

Started by
9 comments, last by nonoptimalrobot 10 years, 8 months ago

I'm not exactly sure what's going on here but even the ad-hoc correction looks a bit wrong to me. It's better but still seems off. I've seen similar anomalies that were the result of messed up tangents and normals; you might want to look into how those are being computed.

One thing that jumps out at me is that you are doing your lighting in tangent space. When you have just one light that's fine but for each light you have to increase the amount of data that gets interpolated for use by the pixel shader. It's better to pass the world space tangent and normal vector to the pixel shader then construct the tbn matrix there and transform the per-pixel normal into world space. That way your light data can exist in world space and simply be stored in constant buffers with the added benefit of your reflection model and attenuation calculations living in world space. This scales much better, is good for your sanity, and keeps your interpolator count down.

This topic is closed to new replies.

Advertisement