mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
transform irradiance + specular map to linear color space
- fixes overly bright image when pbr + reflection probes are used
This commit is contained in:
@@ -134,7 +134,7 @@
|
||||
|
||||
ivec2 cubeMapSize = textureSize(prefilteredSpecularMap, 0);
|
||||
float mip = roughness * (floor(log2(float(cubeMapSize.x))) + 1.0);
|
||||
vec3 reflection = properties.skyboxLighting ? textureLod(prefilteredSpecularMap, reflectionVector, mip).rgb : properties.ambientColor.rgb;
|
||||
vec3 reflection = properties.skyboxLighting ? S_SRGBToLinear(textureLod(prefilteredSpecularMap, reflectionVector, mip)).rgb : properties.ambientColor.rgb;
|
||||
|
||||
vec3 F0 = mix(vec3(0.04), albedo.rgb, metallic);
|
||||
vec3 F = S_FresnelSchlickRoughness(clampedCosViewAngle, F0, roughness);
|
||||
@@ -146,7 +146,7 @@
|
||||
float ambientOcclusion = texture(aoSampler, texCoord).r * materialAo;
|
||||
vec4 bakedLighting = texture(bakedLightingTexture, texCoord);
|
||||
|
||||
vec3 irradiance = texture(irradianceMap, fragmentNormal).rgb;
|
||||
vec3 irradiance = S_SRGBToLinear(texture(irradianceMap, fragmentNormal)).rgb;
|
||||
vec3 diffuse = (properties.skyboxLighting ? irradiance : properties.ambientColor.rgb) * albedo.rgb;
|
||||
|
||||
FragColor.rgb = bakedLighting.rgb + (kD * diffuse + specular) * ambientOcclusion;
|
||||
|
||||
Reference in New Issue
Block a user