SL-18190 End of linear space odyssey -- just eat the conversions in atmosphericsFuncsF for sunlight and additive, but leave linear ambient in tact.
parent
411aa9f727
commit
10b2d1be01
|
|
@ -370,7 +370,7 @@ vec3 pbrIbl(vec3 diffuseColor,
|
|||
vec3 diffuse = diffuseLight * diffuseColor;
|
||||
vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
|
||||
|
||||
return (diffuse + specular) * ao * 0.5; //reduce by half to place in appropriate color space for atmospherics
|
||||
return (diffuse + specular*0.5) * ao; //reduce by half to place in appropriate color space for atmospherics
|
||||
}
|
||||
|
||||
// Encapsulate the various inputs used by the various functions in the shading equation
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ void main()
|
|||
vec3 irradiance = vec3(0);
|
||||
vec3 radiance = vec3(0);
|
||||
sampleReflectionProbes(irradiance, radiance, pos.xyz, norm.xyz, gloss);
|
||||
irradiance = max(amblit*2.0,irradiance);
|
||||
irradiance = max(amblit*0.75,irradiance);
|
||||
|
||||
vec3 f0 = vec3(0.04);
|
||||
|
||||
|
|
@ -209,8 +209,8 @@ void main()
|
|||
float NdotV = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0);
|
||||
|
||||
color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
|
||||
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, light_dir) * sunlit*2.75 * scol;
|
||||
color += colorEmissive;
|
||||
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, light_dir) * sunlit * scol;
|
||||
color += colorEmissive*0.5;
|
||||
|
||||
color = atmosFragLightingLinear(color, additive, atten);
|
||||
color = scaleSoftClipFragLinear(color);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,6 @@ void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 no
|
|||
|
||||
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity)
|
||||
{
|
||||
color = mix(color.rgb, legacyenv*0.5, envIntensity);
|
||||
color = mix(color.rgb, legacyenv*1.5, envIntensity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ vec3 srgb_to_linear(vec3 col);
|
|||
vec3 linear_to_srgb(vec3 col);
|
||||
|
||||
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
|
||||
{
|
||||
{
|
||||
if (no_atmo == 1)
|
||||
{
|
||||
return light;
|
||||
|
|
@ -45,14 +45,7 @@ vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
|
|||
|
||||
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten)
|
||||
{
|
||||
if (no_atmo == 1)
|
||||
{
|
||||
return light;
|
||||
}
|
||||
|
||||
light *= atten.r;
|
||||
light += additive;
|
||||
return light*2.0;
|
||||
return atmosFragLighting(light, additive, atten);
|
||||
}
|
||||
|
||||
vec3 atmosLighting(vec3 light)
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ uniform float sun_moon_glow_factor;
|
|||
|
||||
float getAmbientClamp() { return 1.0f; }
|
||||
|
||||
vec3 srgb_to_linear(vec3 col);
|
||||
|
||||
// return colors in sRGB space
|
||||
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
|
||||
out vec3 atten, bool use_ao)
|
||||
|
|
@ -148,6 +150,14 @@ vec3 srgb_to_linear(vec3 col);
|
|||
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
|
||||
out vec3 atten, bool use_ao)
|
||||
{
|
||||
#if 1
|
||||
calcAtmosphericVars(inPositionEye, light_dir, 1.0, sunlit, amblit, additive, atten, false);
|
||||
sunlit = srgb_to_linear(sunlit);
|
||||
additive = srgb_to_linear(additive);
|
||||
amblit = ambient_linear;
|
||||
#else
|
||||
|
||||
//EXPERIMENTAL -- attempt to factor out srgb_to_linear conversions above
|
||||
vec3 rel_pos = inPositionEye;
|
||||
|
||||
//(TERRAIN) limit altitude
|
||||
|
|
@ -217,12 +227,11 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
|
|||
additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
|
||||
|
||||
// brightness of surface both sunlight and ambient
|
||||
sunlit = sunlight.rgb;
|
||||
sunlit = min(sunlight.rgb, vec3(1));
|
||||
amblit = tmpAmbient.rgb;
|
||||
additive *= vec3(1.0 - combined_haze);
|
||||
|
||||
//sunlit = srgb_to_linear(sunlit);
|
||||
amblit = ambient_linear;
|
||||
additive = srgb_to_linear(additive*1.5);
|
||||
|
||||
//sunlit = sunlight_linear;
|
||||
amblit = ambient_linear*0.8;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue