From 7ec9dfcbc9ed0afd03de41e74846dc4acb919752 Mon Sep 17 00:00:00 2001 From: Cyrille Pierre Henri Favreau Date: Thu, 30 Nov 2023 15:27:20 +0100 Subject: [PATCH] Fixed SDF distance evaluation for displacement in OptiX engine --- platform/engines/optix6/cuda/geometry/SDFGeometries.cu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/engines/optix6/cuda/geometry/SDFGeometries.cu b/platform/engines/optix6/cuda/geometry/SDFGeometries.cu index 04b528219..fa6760425 100644 --- a/platform/engines/optix6/cuda/geometry/SDFGeometries.cu +++ b/platform/engines/optix6/cuda/geometry/SDFGeometries.cu @@ -332,7 +332,8 @@ static __device__ inline float rayMarching(const SDFGeometry* primitive, bool& p for (uint64_t i = 0; i < geometrySdfNbMarchIterations; i++) { const float3 p = ray.origin + ray.direction * t; - processDisplacement = (/*ray.flags == RAY_FLAG_PRIMARY && */ ::optix::length(p - eye) < geometrySdfDistance); + const float3 tp = rtTransformPoint(RT_OBJECT_TO_WORLD, p); + processDisplacement = (/*ray.flags == RAY_FLAG_PRIMARY && */ ::optix::length(tp - eye) < geometrySdfDistance); float signed_radius = sdfSign * sdfDistance(p, primitive, processDisplacement); float radius = abs(signed_radius);