SL-10500
Replace clamp on height in atmospherics calcs on fragment shader path. Fix colorspace conversions in material shaders in forward rendering mode. Fix deferred shaders not setting the sun_up_factor uniform and getting moonlight instead of sunlight.meow-7.2.2
parent
3e0c9087cd
commit
aafa561215
|
|
@ -42,6 +42,9 @@ vec3 scaleSoftClipFrag(vec3 l);
|
|||
|
||||
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 linear_to_srgb(vec3 cs);
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
|
|
@ -199,7 +202,7 @@ void main()
|
|||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vec3 gamma_diff = diffcol.rgb;
|
||||
vec3 gamma_diff = linear_to_srgb(diffcol.rgb);
|
||||
#endif
|
||||
|
||||
#if HAS_SPECULAR_MAP
|
||||
|
|
@ -332,6 +335,7 @@ void main()
|
|||
}
|
||||
|
||||
col = atmosFragLighting(col, additive, atten);
|
||||
col = scaleSoftClipFrag(col);
|
||||
|
||||
vec3 npos = normalize(-pos.xyz);
|
||||
|
||||
|
|
@ -352,7 +356,8 @@ void main()
|
|||
glare = min(glare, 1.0);
|
||||
float al = max(diffcol.a,glare)*vertex_color.a;
|
||||
|
||||
col = scaleSoftClipFrag(col);
|
||||
//convert to gamma space for display on screen
|
||||
col.rgb = linear_to_srgb(col.rgb);
|
||||
|
||||
#ifdef WATER_FOG
|
||||
vec4 temp = applyWaterFogView(pos, vec4(col.rgb, al));
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ vec3 linear_to_srgb(vec3 cl);
|
|||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
frag_color = diff;
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
frag_color = diff;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,11 @@ vec3 atmosLighting(vec3 light)
|
|||
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
|
||||
|
||||
vec3 P = inPositionEye;
|
||||
|
||||
|
||||
//(TERRAIN) limit altitude
|
||||
if (P.y > max_y) P *= (max_y / P.y);
|
||||
if (P.y < -max_y) P *= (-max_y / P.y);
|
||||
|
||||
vec3 tmpLightnorm = lightnorm.xyz;
|
||||
|
||||
vec3 Pn = normalize(P);
|
||||
|
|
@ -93,7 +97,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit,
|
|||
//(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
|
||||
temp2.y = max(0.0, tmpLightnorm.y);
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
sunlight *= exp(-light_atten * temp2.y);
|
||||
|
||||
// main atmospheric scattering line integral
|
||||
temp2.z = Plen * density_multiplier;
|
||||
|
|
|
|||
|
|
@ -8507,6 +8507,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
|
||||
shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
|
||||
|
||||
LLEnvironment& environment = LLEnvironment::instance();
|
||||
shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
|
||||
|
||||
if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue