Page MenuHome

Cycles: Add support for native OptiX curve primitive
ClosedPublic

Authored by Patrick Mours (pmoursnv) on Jul 6 2020, 4:37 PM.

Details

Summary

With D8013 performance of curve rendering has decreased noticeably with CUDA and OptiX. However, OptiX recently added support for curves natively, which when used would avoid having to try and optimize the curve intersection algorithm from Embree for the GPU (which could turn out rather difficult without changing some of its core principles).

This patch adds support for the curve primitive from OptiX to Cycles. It's currently hidden behind a debug option, since there can be some slight rendering differences still (because no backface culling is performed and something seems off with endcaps). The curve primitive was added with the OptiX 7.1 SDK and requires a r450 driver or newer (Windows 451.48+, Linux 450.51+), so this patch also updates the codebase to be able to build with the new SDK (but retains support for building with 7.0 too, so not to break existing build configurations).

Performance is substantially better (up to 40%) and even surpasses rounded ribbons in certain cases. I tested against the test suite and the overall results are the same too, with the exception of some small image differences as noted before (so motion blur etc. works).

Rounded Ribbons3D Curves3D Curves (Native OptiX Curve Primitive)
koro (200 samples)00:29
00:41
00:26
fishy_cat (1000 samples)00:33
00:41
00:35

To build make sure the OptiX SDK (https://developer.nvidia.com/designworks/optix/download) and relevant CMake variables were updated to point to OptiX 7.1.

Diff Detail

Repository
rB Blender

Event Timeline

Patrick Mours (pmoursnv) requested review of this revision.Jul 6 2020, 4:37 PM
Patrick Mours (pmoursnv) edited the summary of this revision. (Show Details)Jul 6 2020, 4:46 PM
Patrick Mours (pmoursnv) added a reviewer: Cycles.

Nice, thanks! Should be pretty safe to commit already since it's a debug option. Couldn't spot bugs from reading the code.

This revision is now accepted and ready to land.Jul 6 2020, 7:00 PM

I've tried it here, but am getting an error message from OptiX:
OPTIX_ERROR_INVALID_VALUE in optixBuiltinISModuleGet( context, &module_options, &pipeline_options, &builtin_options, &builtin_modules[0]) (device_optix.cpp:479)

This is driver 451.48 on Windows 10 with a Quadro RTX4000, OptiX 7.1.0 and CUDA 11.0.

Strange. --debug-cycles should help to get a more detailed error message from OptiX.

Thanks, that gave me a hint - mistake on my side, I inadvertently caused a code path that didn't set up usesPrimitiveTypeFlags properly.

Patch works fine, great work.