[Solved] Debugging Normal Mapping

Hey 'Embers,

I’m trying to render a normal mapped sphere with a moon texture obtained from here:

But for reasons that aren’t entirely clear to me, the render looks quite off and even super dark in spots. I’m using the vert/frag shader provided in the LibCinder NormalMappingBasic application with the specular highlight turned off.

I’m seeing two - possibly related issues:

  • The craters are clearly not lit correctly, they have the shadow on the ‘opposite side’.
  • There are multiple strong dark patches that makes very little sense to me.

What I can confirm is that the normals and tangents look decent:

I’ve tried flipping the tangent (* -1) without seeing the intended result, and I’m messed a fair bit with how the light source is placed but I feel like I’m kind of fumbling in the dark.

I’d much appreciate any concrete steps I could take to simplify the bug hunt I’m on, or - of course - a direct finger pointed at the likely culprit.

Cheers,
Gazoo

Turns out I’d forgotten to pass the bound texture IDs into the GLSL shader. I did bind the texture resources to texture ID’s, but then didn’t pass them properly.