transform irradiance + specular map to linear color space

- fixes overly bright image when pbr + reflection probes are used
This commit is contained in:
Dmitry Stepanov
2025-10-12 19:03:39 +03:00
parent a8aa8cc4f9
commit 72911fa2d5
@@ -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;