I am developing a voxel-like game, and without normal map applied and only the diffuse map is supplied, the light reflect correctly, but once the normal map is applied, it is shaded as if the light hits at a 135 degrees from where it should be. I suspect it was something with the tangents, but so far it didn’t seems to make any difference. Could anyone explain what may lead to this problem based on how things should work?
Pic 1: With normal map applied
Pic 2: Without normal map applied and only the diffuse map
Some possible reasons are:
- the normal map is wrong
- the value of normalMapType does not correspond to the type of the normal map image
- your
normalMap uses uv/rotation/offset/scale that misalligns it
Maybe there are other reasons too. Enjoy the debugging.
I sometimes forget to convert degrees to radians. So when something is pointed the wrong way, that is the first thing I check.
nvm, I realized it is problem with the textures I am injecting, after converting from DDS to jpg it works fine again. so the math isn’t wrong
Sometimes textures are flipped, and can be fixed with texture.flipY=false