Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2021-03-04 13:59:49 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-03-08 19:25:16 +0300
commitba75ea8012084aa84ba8c9ac088b88a8dcf4fb21 (patch)
tree32610751177961885185afee8f4c4773ccda4ced /source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
parent6afe2d373a00a49a7a51cafec50d03ada0fe0743 (diff)
EEVEE: Use Fullscreen maxZBuffer instead of halfres
This removes the need for per mipmap scalling factor and trilinear interpolation issues. We pad the texture so that all mipmaps have pixels in the next mip. This simplifies the downsampling shader too. This also change the SSR radiance buffer as well in the same fashion.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl15
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
index ecff28dcd38..f2117d8ee67 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
@@ -104,6 +104,11 @@ void do_ssr(vec3 V, vec3 N, vec3 T, vec3 B, vec3 vP, float a2, vec4 rand)
pdfData = min(1024e32, pdf_ggx_reflect(NH, a2)); /* Theoretical limit of 16bit float */
+ /* TODO(fclem) This bias should use depth precision and the dot product between
+ * ray direction and geom normal. */
+ float rays_bias = 0.005;
+ vP = vP + vNg * rays_bias;
+
vec3 hit_pos = raycast(-1, vP, R * 1e16, ssrThickness, rand.y, ssrQuality, a2, true);
hitData = encode_hit_data(hit_pos.xy, (hit_pos.z > 0.0), false);
@@ -325,10 +330,10 @@ vec3 get_hit_vector(vec3 hit_pos,
vec3 get_scene_color(vec2 ref_uvs, float mip, float planar_index, bool is_planar)
{
if (is_planar) {
- return textureLod(probePlanars, vec3(ref_uvs, planar_index), min(mip, prbLodPlanarMax)).rgb;
+ return textureLod(probePlanars, vec3(ref_uvs, planar_index), mip).rgb;
}
else {
- return textureLod(prevColorBuffer, ref_uvs, mip).rgb;
+ return textureLod(prevColorBuffer, ref_uvs * hizUvScaleBias.xy + hizUvScaleBias.zw, mip).rgb;
}
}
@@ -403,12 +408,6 @@ vec4 get_ssr_samples(vec4 hit_pdf,
vec4 mip = log2(cone_footprint * max_v2(vec2(textureSize(depthBuffer, 0))));
mip = clamp(mip, 0.0, MAX_MIP);
- /* Correct UVs for mipmaping mis-alignment */
- hit_co[0].xy *= mip_ratio_interp(mip.x);
- hit_co[0].zw *= mip_ratio_interp(mip.y);
- hit_co[1].xy *= mip_ratio_interp(mip.z);
- hit_co[1].zw *= mip_ratio_interp(mip.w);
-
/* Slide 54 */
vec4 bsdf;
bsdf.x = bsdf_ggx(N, hit_pos[0], V, roughnessSquared);