Page MenuHome

Cycles X: Improve performance of transparent shadows with OptiX
ClosedPublic

Authored by Patrick Mours (pmoursnv) on Sep 16 2021, 7:01 PM.

Details

Summary

This changes the shadow record-all any-hit program to accept all
hits (return without calling optixIgnoreIntersection) beyond
the furthest distance recorded after the maximum number of hits
that can be recorded was reached.
OptiX will not call the any-hit program anymore for hits beyond
the distance of the accepted hits and also reduces the current
ray length behind the scenes. As a result performance improves
drastically in scenes where shadow rays can hit a lot of
transparent objects, like the "koro" benchmark scene.

With this applied I now get similar performance with both CUDA
and OptiX in "koro". Not quite perfect yet, but much better than
before.

Diff Detail

Repository
rB Blender
Branch
cycles-x_optix_transparent_shadows (branched from master)
Build Status
Buildable 17068
Build 17068: arc lint + arc unit

Event Timeline

Patrick Mours (pmoursnv) requested review of this revision.Sep 16 2021, 7:01 PM
Patrick Mours (pmoursnv) created this revision.

Oh and I moved the shadow_intersections_has_remaining function, because otherwise the kernel fails to compile when __TRANSPARENT_SHADOWS__ is not set.

Great find.

intern/cycles/kernel/device/optix/kernel.cu
225

The comment can be tweaked a bit to avoid ambiguity.

/* Accept hit, so that OptiX won't consider any more hits beyond the distance of the current hit anymore. */
This revision is now accepted and ready to land.Sep 16 2021, 7:19 PM
intern/cycles/kernel/device/optix/kernel.cu
225

And of course I forgot to do this before pushing now ... Feel free to fix that in a subsequent commit (don't really want to push an additional commit with just this one line changed now ...).