Normal Mapping and Lighting space confusion

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:


	passedPosition = modelViewMatrix*vec4(vertexPosition,1.0);



     vec3 Ldist = passedPosition .xyz - lights[i];
     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

I’m not sure why your vertex shader would not have access to the light direction uniforms, after all uniforms are set on the program object not the shader object, so all shader stages should have access to the same set of uniforms (you just need to declare them in each stage) - perhaps I’m missing something?
Other than that, I think you’ll have to do one of the two things: transform the light direction to tangent space in the vertex shader or enable the fragment shader to do that transformation (i.e. pass the TBN matrix to it) - and from a performance POV it seems preferable to do the former.