We’ve been adding support for B-spline curves to our renderer and noticed some weird behaviors when using an orthographic camera.
Here’s a comparison with Embree:
From the different setups we’ve tried, it seems that the built-in intersection program is “faulty” whenever a curved segment is orthogonal to the ray direction. With an orthographic camera, this becomes much more visible.
I was able to re-create this behavior in the provided SDK example (
optixCurves) by changing the ray generation program:
diff --git a/SDK/optixCurves/optixCurves.cu b/SDK/optixCurves/optixCurves.cu index e157b5d..5dea427 100644 --- a/SDK/optixCurves/optixCurves.cu +++ b/SDK/optixCurves/optixCurves.cu @@ -57,8 +57,14 @@ static __forceinline__ __device__ void computeRay( uint3 idx, uint3 dim, float3& static_cast<float>( idx.y ) / static_cast<float>( dim.y ) ) - 1.0f; - origin = params.cam_eye; - direction = normalize( d.x * U + d.y * V + W ); + origin = + 2.f * make_float3(static_cast<float>(idx.x) / static_cast<float>(dim.x), + static_cast<float>(idx.y) / static_cast<float>(dim.y), + 0) - 1.f; + origin.z = params.cam_eye.z; + + direction = make_float3(0.f, 0.f, -1.f); + //direction = normalize(make_float3(0.001f, 0.f, -1.f)); }
The commented line, where the ray direction is changed, slightly offsets the viewing direction such that the curve is no longer contained in a orthogonal plane to the viewing direction. Below is a comparison with the patch above:
- left: orthogonal viewing direction (patch as-is)
- right: slighlty offset angle (un-commented patch)
We’ve noticed this with B-spline curves, but we did not try other curve types. Also, this at least affects Optix 7.4 and 7.5.
Is this a known issue?