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

Merged in Geenz/viewer-eep-shader-fixes/BUG-226620 (pull request #333)


Fix for BUG-226620

Approved-by: default avatarGraham Madarasz <graham@lindenlab.com>
parents 28fd43a1 2013578c
No related branches found
No related tags found
No related merge requests found
...@@ -483,12 +483,14 @@ Geenz Spad ...@@ -483,12 +483,14 @@ Geenz Spad
STORM-1900 STORM-1900
STORM-1905 STORM-1905
NORSPEC-229 NORSPEC-229
BUG-226611 BUG-226611
BUG-226617 BUG-226617
BUG-226618 BUG-226618
BUG-226646 BUG-226646
BUG-226647 BUG-226647
BUG-226648 BUG-226648
OPEN-339
BUG-226620
Gene Frostbite Gene Frostbite
GeneJ Composer GeneJ Composer
Geneko Nemeth Geneko Nemeth
......
...@@ -123,14 +123,27 @@ void main() ...@@ -123,14 +123,27 @@ void main()
if (spec.a > 0.0) // specular reflection if (spec.a > 0.0) // specular reflection
{ {
// the old infinite-sky shiny reflection vec3 npos = -normalize(pos.xyz);
float sa = dot(refnormpersp, light_dir.xyz);
vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); //vec3 ref = dot(pos+lv, norm);
vec3 h = normalize(light_dir.xyz+npos);
// add the two types of shiny together float nh = dot(norm.xyz, h);
vec3 spec_contrib = dumbshiny * spec.rgb; float nv = dot(norm.xyz, npos);
bloom = dot(spec_contrib, spec_contrib) / 6; float vh = dot(npos, h);
col += spec_contrib; float sa = nh;
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
float gtdenom = 2 * nh;
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
if (nh > 0.0)
{
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
vec3 speccol = sun_contrib*scol*spec.rgb;
speccol = max(speccol, vec3(0));
bloom = dot (speccol, speccol) / 2;
col += speccol;
}
} }
col.rgb += diffuse.a * diffuse.rgb; col.rgb += diffuse.a * diffuse.rgb;
......
...@@ -136,14 +136,27 @@ void main() ...@@ -136,14 +136,27 @@ void main()
if (spec.a > 0.0) // specular reflection if (spec.a > 0.0) // specular reflection
{ {
// the old infinite-sky shiny reflection vec3 npos = -normalize(pos.xyz);
float sa = dot(refnormpersp, light_dir.xyz);
vec3 dumbshiny = sunlit*scol*(texture2D(lightFunc, vec2(sa, spec.a)).r); //vec3 ref = dot(pos+lv, norm);
vec3 h = normalize(light_dir.xyz+npos);
// add the two types of shiny together float nh = dot(norm.xyz, h);
vec3 spec_contrib = dumbshiny * spec.rgb; float nv = dot(norm.xyz, npos);
bloom = dot(spec_contrib, spec_contrib) / 6; float vh = dot(npos, h);
col += spec_contrib; float sa = nh;
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
float gtdenom = 2 * nh;
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
if (nh > 0.0)
{
float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
vec3 speccol = sun_contrib*scontrib*spec.rgb;
speccol = max(speccol, vec3(0));
bloom += dot (speccol, speccol) / 2;
col += speccol;
}
} }
col.rgb += diffuse.a * diffuse.rgb; col.rgb += diffuse.a * diffuse.rgb;
......
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