Skip to content

Commit

Permalink
Merge pull request #337 from favreau/master
Browse files Browse the repository at this point in the history
Fixed SDF distance evaluation for displacement in OptiX engine
  • Loading branch information
favreau authored Nov 30, 2023
2 parents c6c235b + 7ec9dfc commit 6a9132b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion platform/engines/optix6/cuda/geometry/SDFGeometries.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6a9132b

Please sign in to comment.