Original Post
hello guys, im having a problem with my bump mapping. the problem is, i have a cube, and every side is texturedwith one texture. and i have the normal texture as well with me. now, i pass to the shader my camera position, as if its the light position. and the shader calculates the does the bump mapping. now, the issue is, only two sides of the cube work correctly, and the rest of the sides, dont show the bumps when im near, if i go far from them, the bumps appear, i can just see the bump when im far away. why do u think that is? here is my vertex shader code: i also realized that i see the bumps correctly when i stand facing the corner of the cube where both sides of the cube are viewed. here is the corerct display:
and here is the wrong display:
Vs_Output vs_out;
// Set output vertex pos, and texture coords.
vs_out.vertexPos = mul(worldViewProj, float4(IN.vertexPos, 1));
vs_out.texture0 = IN.texture0;
// Set the object space light direction.
vs_out.lightDirection = lightPos - IN.vertexPos;
// Build TBN matrix.
float3x3 tbnMatrix;
tbnMatrix[0] = mul(IN.sTangent, worldView);
tbnMatrix[1] = mul(IN.binormal, worldView);
tbnMatrix[2] = mul(IN.normal, worldView);
// Convert light direction to texture space.
vs_out.lightDirection = mul(tbnMatrix, vs_out.lightDirection);
return vs_out;
and here is the wrong display: