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:
authorBrecht Van Lommel <brecht@blender.org>2022-07-13 17:54:53 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-15 19:46:24 +0300
commit5152c7c152e52d563cbd3ba3c792de3af0c2c14f (patch)
tree45cad004066413ce309279ad52f2a363e5477150 /intern/cycles/kernel/camera
parentbb376da6dfdd2476fc3738ce1fc89dac27825cef (diff)
Cycles: refactor rays to have start and end distance, fix precision issues
For transparency, volume and light intersection rays, adjust these distances rather than the ray start position. This way we increment the start distance by the smallest possible float increment to avoid self intersections, and be sure it works as the distance compared to be will be exactly the same as before, due to the ray start position and direction remaining the same. Fix T98764, T96537, hair ray tracing precision issues. Differential Revision: https://developer.blender.org/D15455
Diffstat (limited to 'intern/cycles/kernel/camera')
-rw-r--r--intern/cycles/kernel/camera/camera.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/intern/cycles/kernel/camera/camera.h b/intern/cycles/kernel/camera/camera.h
index 7e1b1c037e9..926ccf7b86f 100644
--- a/intern/cycles/kernel/camera/camera.h
+++ b/intern/cycles/kernel/camera/camera.h
@@ -165,9 +165,11 @@ ccl_device void camera_sample_perspective(KernelGlobals kg,
float nearclip = kernel_data.cam.nearclip * z_inv;
ray->P += nearclip * ray->D;
ray->dP += nearclip * ray->dD;
- ray->t = kernel_data.cam.cliplength * z_inv;
+ ray->tmin = 0.0f;
+ ray->tmax = kernel_data.cam.cliplength * z_inv;
#else
- ray->t = FLT_MAX;
+ ray->tmin = 0.0f;
+ ray->tmax = FLT_MAX;
#endif
}
@@ -231,9 +233,11 @@ ccl_device void camera_sample_orthographic(KernelGlobals kg,
#ifdef __CAMERA_CLIPPING__
/* clipping */
- ray->t = kernel_data.cam.cliplength;
+ ray->tmin = 0.0f;
+ ray->tmax = kernel_data.cam.cliplength;
#else
- ray->t = FLT_MAX;
+ ray->tmin = 0.0f;
+ ray->tmax = FLT_MAX;
#endif
}
@@ -258,7 +262,7 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam,
/* indicates ray should not receive any light, outside of the lens */
if (is_zero(D)) {
- ray->t = 0.0f;
+ ray->tmax = 0.0f;
return;
}
@@ -349,9 +353,11 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam,
float nearclip = cam->nearclip;
ray->P += nearclip * ray->D;
ray->dP += nearclip * ray->dD;
- ray->t = cam->cliplength;
+ ray->tmin = 0.0f;
+ ray->tmax = cam->cliplength;
#else
- ray->t = FLT_MAX;
+ ray->tmin = 0.0f;
+ ray->tmax = FLT_MAX;
#endif
}