Skip to content
Snippets Groups Projects
Commit 14629ca3 authored by Rider Linden's avatar Rider Linden
Browse files

Merged in Geenz/viewer-eep-shader-fixes (pull request #322)


Water plane rendering improvements

Approved-by: default avatarGraham Madarasz <graham@lindenlab.com>
parents d7b47bf7 f07a1741
No related branches found
No related tags found
No related merge requests found
...@@ -134,7 +134,7 @@ void main() ...@@ -134,7 +134,7 @@ void main()
col += spec_contrib; col += spec_contrib;
} }
col = mix(col.rgb, diffuse.rgb, diffuse.a); col.rgb += diffuse.a * diffuse.rgb;
if (envIntensity > 0.0) if (envIntensity > 0.0)
{ //add environmentmap { //add environmentmap
...@@ -145,8 +145,10 @@ void main() ...@@ -145,8 +145,10 @@ void main()
if (norm.w < 0.5) if (norm.w < 0.5)
{ {
col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a); //col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a);
col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); //col = mix(scaleSoftClipFrag(col), fullbrightScaleSoftClipFrag(col, additive, atten), diffuse.a);
col = atmosFragLighting(col, additive, atten);
col = scaleSoftClipFrag(col);
} }
#ifdef WATER_FOG #ifdef WATER_FOG
......
...@@ -142,32 +142,23 @@ void main() ...@@ -142,32 +142,23 @@ void main()
vec4 baseCol = texture2D(refTex, refvec4); vec4 baseCol = texture2D(refTex, refvec4);
refcol = mix(baseCol*df2, refcol, dweight); refcol = mix(baseCol*df2, refcol, dweight);
//get specular component
float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0);
//harden specular
spec = pow(spec, 128.0);
//figure out distortion vector (ripply) //figure out distortion vector (ripply)
vec2 distort2 = distort+wavef.xy*refScale * 0.33/max(dmod*df1, 1.0); vec2 distort2 = distort+wavef.xy*refScale * 0.33/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.99999); color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
vec4 pos = vary_position; vec4 pos = vary_position;
color.rgb += spec * specular; //color.rgb = atmosTransport(color.rgb);
//color.rgb = scaleSoftClipFrag(color.rgb) * 0;
color.rgb = atmosTransport(color.rgb);
color.rgb = scaleSoftClipFrag(color.rgb);
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, 1); // diffuse frag_data[0] = vec4(color.rgb, 1); // diffuse
frag_data[1] = vec4(0); // speccolor, spec frag_data[1] = vec4(specular * 0.4, 0.75); // 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.05, 0);// normalxy, 0, 0
} }
...@@ -146,7 +146,7 @@ void main() ...@@ -146,7 +146,7 @@ void main()
col += spec_contrib; col += spec_contrib;
} }
col = mix(col.rgb, diffuse.rgb, diffuse.a); col.rgb += diffuse.a * diffuse.rgb;
if (envIntensity > 0.0) if (envIntensity > 0.0)
{ //add environmentmap { //add environmentmap
...@@ -154,13 +154,13 @@ void main() ...@@ -154,13 +154,13 @@ void main()
vec3 refcol = textureCube(environmentMap, env_vec).rgb; vec3 refcol = textureCube(environmentMap, env_vec).rgb;
col = mix(col.rgb, refcol, envIntensity); col = mix(col.rgb, refcol, envIntensity);
} }
vec3 a = col.rgb;
if (norm.w < 0.5) if (norm.w < 0.5)
{ {
col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a); //col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a);
col = mix(scaleSoftClipFrag(col), fullbrightScaleSoftClipFrag(col, additive, atten), diffuse.a); //col = mix(scaleSoftClipFrag(col), fullbrightScaleSoftClipFrag(col, additive, atten), diffuse.a);
col = atmosFragLighting(col, additive, atten);
col = scaleSoftClipFrag(col);
} }
#ifdef WATER_FOG #ifdef WATER_FOG
......
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