Skip to content
Snippets Groups Projects
Commit e889511a authored by Tofu Linden's avatar Tofu Linden
Browse files

ss reflections tweakage:

+		// Offset the guess source a little according to a trivial
+		// checkerboard dither function and spec.a.
+		// This is meant to be similar to sampling a blurred version
+		// of the diffuse map.  LOD would be better in that regard.
+		// The goal of the blur is to soften reflections in surfaces
+		// with low shinyness, and also to disguise our lameness.
parent d5c07e58
No related branches found
No related tags found
No related merge requests found
......@@ -291,6 +291,14 @@ void main()
depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = tc.xy + (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// Offset the guess source a little according to a trivial
// checkerboard dither function and spec.a.
// This is meant to be similar to sampling a blurred version
// of the diffuse map. LOD would be better in that regard.
// The goal of the blur is to soften reflections in surfaces
// with low shinyness, and also to disguise our lameness.
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
ref2d += normalize(ref2d)*14.0*(1.0-spec.a)*(checkerboard-0.5);
// get attributes from the 2D guess point
float refdepth = texture2DRect(depthMap, ref2d).a;
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
......
......@@ -290,6 +290,14 @@ void main()
depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = tc.xy + (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// Offset the guess source a little according to a trivial
// checkerboard dither function and spec.a.
// This is meant to be similar to sampling a blurred version
// of the diffuse map. LOD would be better in that regard.
// The goal of the blur is to soften reflections in surfaces
// with low shinyness, and also to disguise our lameness.
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
ref2d += normalize(ref2d)*14.0*(1.0-spec.a)*(checkerboard-0.5);
// get attributes from the 2D guess point
float refdepth = texture2DRect(depthMap, ref2d).a;
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
......
......@@ -293,6 +293,14 @@ void main()
depth -= 0.5; // unbias depth
// first figure out where we'll make our 2D guess from
vec2 ref2d = tc.xy + (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
// Offset the guess source a little according to a trivial
// checkerboard dither function and spec.a.
// This is meant to be similar to sampling a blurred version
// of the diffuse map. LOD would be better in that regard.
// The goal of the blur is to soften reflections in surfaces
// with low shinyness, and also to disguise our lameness.
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
ref2d += normalize(ref2d)*14.0*(1.0-spec.a)*(checkerboard-0.5);
// get attributes from the 2D guess point
float refdepth = texture2DRect(depthMap, ref2d).a;
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
......
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