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-08 19:12:25 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-03-08 19:25:38 +0300
commit0983e66e03001d9f38075d3a9ee8fcaa7966a7d2 (patch)
tree88080b965d73d3cfb3c5f5809a35f97f77488966 /source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
parent5db5966cdb61d5711d5c737fd8d000c69be9cf5e (diff)
EEVEE: Occlusion: Use ScreenSpaceRay for iteration
The sampling is now optimum with every samples being at least one pixel appart. Also use a squared repartition to improve the sampling near the center. This also removes the thickness heuristic since it seems to remove a lot of details and bias the AO too much.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
index 0adfea9ca73..7c375aabb62 100644
--- a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
@@ -65,8 +65,6 @@ void raytrace_screenspace_ray_finalize(inout ScreenSpaceRay ray)
/* Clipping to frustum sides. */
float clip_dist = line_unit_box_intersect_dist(ray.origin.xyz, ray.direction.xyz);
ray.max_time = min(ray.max_time, clip_dist);
- /* Avoid no iteration. */
- ray.max_time = max(ray.max_time, 1.1);
/* Convert to texture coords [0..1] range. */
ray.origin = ray.origin * 0.5 + 0.5;
ray.direction *= 0.5;
@@ -122,6 +120,8 @@ bool raytrace(Ray ray,
}
ScreenSpaceRay ssray = raytrace_screenspace_ray_create(ray, params.thickness);
+ /* Avoid no iteration. */
+ ssray.max_time = max(ssray.max_time, 1.1);
float prev_delta = 0.0, prev_time = 0.0;
float depth_sample = get_depth_from_view_z(ray.origin.z);
@@ -173,6 +173,8 @@ bool raytrace_planar(Ray ray, RayTraceParameters params, int planar_ref_id, out
}
ScreenSpaceRay ssray = raytrace_screenspace_ray_create(ray);
+ /* Avoid no iteration. */
+ ssray.max_time = max(ssray.max_time, 1.1);
/* Planar Reflections have X mirrored. */
ssray.origin.x = 1.0 - ssray.origin.x;