SL-17703: PBR: Sun/Moon lighting is in sRGB

meow-7.2.2
Ptolemy 2022-07-08 07:52:19 -07:00
parent daf3f4f736
commit bae0fc077b
2 changed files with 5 additions and 2 deletions

View File

@ -43,6 +43,7 @@ uniform float sun_moon_glow_factor;
float getAmbientClamp() { return 1.0f; }
// Returns colors in sRGB
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
out vec3 atten, bool use_ao)
{

View File

@ -339,10 +339,12 @@ void main()
vec3 sun_contrib = min(da, scol) * sunlit;
#if PBR_USE_ATMOS
color += sun_contrib;
color = linear_to_srgb(color);
color += 2.0*sun_contrib; // 2x = Undo legacy hack of calcAtmosphericVars() returning sunlight.rgb * 0.5;
color *= atten.r;
color += 0.5*additive;
color += 2.0*additive;
color = scaleSoftClipFrag(color);
color = srgb_to_linear(color);
#endif // PBR_USE_ATMOS
#if DEBUG_PBR_DIFFUSE