Skip to content
Snippets Groups Projects
Commit 360b3230 authored by Graham Linden's avatar Graham Linden
Browse files

SL-11260

Make terrain underwater shader not try to light said terrain.

Fix colorspace of reflected color in non-ALM shading.

Tweak transparency of water further.
parent db091d23
No related branches found
No related tags found
No related merge requests found
...@@ -153,24 +153,25 @@ void main() ...@@ -153,24 +153,25 @@ void main()
spec = pow(spec, 128.0); spec = pow(spec, 128.0);
//figure out distortion vector (ripply) //figure out distortion vector (ripply)
vec2 distort2 = distort+wavef.xy*(refScale*0.01)/max(dmod*df1, 1.0); vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0);
vec4 fb = texture2D(screenTex, distort2); vec4 fb = texture2D(screenTex, distort2);
//mix with reflection //mix with reflection
// Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug // Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug
color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.3 + 0.7); color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.4 + 0.6);
vec4 pos = vary_position; vec4 pos = vary_position;
color.rgb += spec * specular; color.rgb += spec * specular;
color.rgb = atmosTransport(color.rgb); //color.rgb = atmosTransport(color.rgb);
color.rgb = scaleSoftClip(color.rgb); color.rgb = scaleSoftClip(color.rgb);
color.a = spec * sunAngle2 * 0.88;
color.a = spec * sunAngle2;
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
frag_data[0] = vec4(color.rgb, color); // diffuse frag_data[0] = vec4(color.rgb, color); // diffuse
frag_data[1] = vec4(0); // speccolor, spec frag_data[1] = vec4(0); // speccolor, spec
frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0 frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0
......
...@@ -59,7 +59,10 @@ void main() ...@@ -59,7 +59,10 @@ void main()
vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
/// Add WL Components /// Add WL Components
outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); outColor.rgb *= vertex_color.rgb;
// SL-11260...
//outColor.rgb = atmosLighting(outColor.rgb);
outColor = applyWaterFog(outColor); outColor = applyWaterFog(outColor);
frag_color = outColor; frag_color = outColor;
......
...@@ -121,7 +121,6 @@ void main() ...@@ -121,7 +121,6 @@ void main()
vec4 refcol = refcol1 + refcol2 + refcol3; vec4 refcol = refcol1 + refcol2 + refcol3;
float df1 = df.x + df.y + df.z; float df1 = df.x + df.y + df.z;
df1 *= 0.3333;
refcol *= df1; refcol *= df1;
vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
...@@ -151,11 +150,11 @@ void main() ...@@ -151,11 +150,11 @@ void main()
//mix with reflection //mix with reflection
// Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug // Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug
color.rgb = mix(fb.rgb, refcol.rgb, df1 + 0.6); color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.4 + 0.6);
color.rgb += spec * specular; color.rgb += spec * specular;
color.rgb = atmosTransport(color.rgb); //color.rgb = atmosTransport(color.rgb);
color.rgb = scaleSoftClip(color.rgb); color.rgb = scaleSoftClip(color.rgb * 0.5);
color.a = spec * sunAngle2; color.a = spec * sunAngle2;
#if defined(WATER_EDGE) #if defined(WATER_EDGE)
......
...@@ -50,7 +50,6 @@ void main() ...@@ -50,7 +50,6 @@ void main()
vec4 color; vec4 color;
color = vary_HazeColor; color = vary_HazeColor;
color *= 2.; color *= 2.;
/// Gamma correct for WL (soft clip effect). /// Gamma correct for WL (soft clip effect).
frag_color.rgb = scaleSoftClip(color.rgb); frag_color.rgb = scaleSoftClip(color.rgb);
frag_color.a = 1.0; frag_color.a = 1.0;
......
...@@ -1095,6 +1095,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() ...@@ -1095,6 +1095,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterProgram.mFeatures.calculatesAtmospherics = true; gWaterProgram.mFeatures.calculatesAtmospherics = true;
gWaterProgram.mFeatures.hasGamma = true; gWaterProgram.mFeatures.hasGamma = true;
gWaterProgram.mFeatures.hasTransport = true; gWaterProgram.mFeatures.hasTransport = true;
gWaterProgram.mFeatures.hasSrgb = true;
gWaterProgram.mShaderFiles.clear(); gWaterProgram.mShaderFiles.clear();
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB)); gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB)); gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
...@@ -1111,6 +1112,7 @@ BOOL LLViewerShaderMgr::loadShadersWater() ...@@ -1111,6 +1112,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterEdgeProgram.mFeatures.calculatesAtmospherics = true; gWaterEdgeProgram.mFeatures.calculatesAtmospherics = true;
gWaterEdgeProgram.mFeatures.hasGamma = true; gWaterEdgeProgram.mFeatures.hasGamma = true;
gWaterEdgeProgram.mFeatures.hasTransport = true; gWaterEdgeProgram.mFeatures.hasTransport = true;
gWaterEdgeProgram.mFeatures.hasSrgb = true;
gWaterEdgeProgram.mShaderFiles.clear(); gWaterEdgeProgram.mShaderFiles.clear();
gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB)); gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB)); gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment