Merge pull request #3808 from supertuxkart/bugfix/fix-PBR-computation

Fix bug with PBR roughness (was working in metal but not plastic mate…
This commit is contained in:
samuncle
2019-03-14 20:52:01 +01:00
committed by GitHub

View File

@@ -21,6 +21,7 @@ void main()
// Metallic map is stored in normal color framebuffer .w
// Emit map is stored in diffuse color framebuffer.w
float metallicMapValue = texture(normal_color, tc).w;
float specMapValue = texture(normal_color, tc).z;
float emitMapValue = diffuseMatColor.w;
float ao = texture(ssao_tex, tc).x;
@@ -28,7 +29,7 @@ void main()
vec3 SpecularComponent = texture(specular_map, tc).xyz;
vec3 diffuse_color_for_mix = diffuseMatColor.xyz * 4.0;
vec3 metallicMatColor = mix(vec3(0.04), diffuse_color_for_mix, metallicMapValue);
vec3 metallicMatColor = mix(vec3(specMapValue), diffuse_color_for_mix, metallicMapValue);
vec3 tmp = DiffuseComponent * mix(diffuseMatColor.xyz, vec3(0.0), metallicMapValue) + (metallicMatColor * SpecularComponent);
vec3 emitCol = diffuseMatColor.xyz + (diffuseMatColor.xyz * diffuseMatColor.xyz * emitMapValue * emitMapValue * 10.0);