Merge pull request 'normal map on ship' (#15) from fix_normal_map into master

Reviewed-on: #15
This commit is contained in:
Wojciech Goralewski 2024-02-07 14:02:31 +01:00
commit 1f70717502
2 changed files with 12 additions and 3 deletions

View File

@ -36,8 +36,8 @@ public:
} }
glm::vec3 color = glm::vec3(0.3, 0.3, 0.5); glm::vec3 color = glm::vec3(0.3, 0.3, 0.5);
float roughness = 0.2; float roughness = 0.5;
float metallic = 1.0; float metallic = 0.6;
glm::vec3 spaceshipPos /*= glm::vec3(0.065808f, 1.250000f, -2.189549f)*/; glm::vec3 spaceshipPos /*= glm::vec3(0.065808f, 1.250000f, -2.189549f)*/;
glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f); glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);

View File

@ -102,8 +102,17 @@ void main()
vec4 texColor = texture(textureSampler, TexCoords); vec4 texColor = texture(textureSampler, TexCoords);
vec3 normal = normalize(texture(normalSampler, TexCoords).xyz * TBN);
vec3 normalMapNormal = texture(normalSampler, TexCoords).xyz;
normalMapNormal = normalMapNormal * 2.0 - 1.0;
//normalMapNormal.y = -normalMapNormal.y;
vec3 normal = normalize(normalMapNormal * TBN );
//vec3 normal = normalize(texture(normalSampler, TexCoords).xyz * TBN);
//vec3 normal = normalize(vecNormal); //vec3 normal = normalize(vecNormal);
vec3 viewDir = normalize(cameraPos-worldPos); vec3 viewDir = normalize(cameraPos-worldPos);
vec3 lightDirs[4]; vec3 lightDirs[4];