normalmap.frag
Variables and Uniforms
Comment out normal and added three tangent space vectors
in vec3 fragPos;
// in vec3 normal;
in vec2 texCoord;
in vec3 tangentLightPos;
in vec3 tangentViewPos;
in vec3 tangentFragPos;Uniforms
Comment out lightPos and viewPos
// uniform vec3 lightPos;
// uniform vec3 viewPos;Add the normal map uniform
// added for LabA08 Normal map
uniform sampler2D normalMap;main()
Read normal data from the normal map
Change the range of normals to [-1, 1]
Replace lightPos, viewPos and fragPos with their tangent counterparts
Full Source Code
Last updated