Hi all, I’m trying to implement normal mapping but I’m confused with which space to use.
Up to now I’m doing all the light calculation in view space as I’m doing this:
VERTEX SHADER
passedPosition = modelViewMatrix*vec4(vertexPosition,1.0);
FRAGMENT SHADER
........
vec3 Ldist = passedPosition .xyz - lights[i].lightPosition.xyz;
vec3 L = normalize(Ldist);
........
Now, I was reading this: Three Normal Mapping Techniques Explained For the Mathematically Uninc
for normal mapping. For how my thing is structured I can’t access (without messing something and I’ll like to avoid this option) light directions in the vertex shader.
So to actually do what is explained in the section View Space Normal Mapping of the above link I should pass onto the fragment shader the TBN matrix and then transform the light direction in there. But is this someway avoidable? Can you point me to an alternative way to do this maintaining the structure I already have (that is at the beginning of the post)? I’m a bit confused at the moment. Sorry if this topic is confusionary aswell