Blender Git Commit Log

Git Commits -> Revision 2189dfd

Revision 2189dfd by Patrick Mours (master)
September 27, 2021, 15:12 (GMT)
Cycles: Rework OptiX visibility flags handling

Before the visibility test against the visibility flags was performed in an any-hit program in OptiX
(called `__anyhit__kernel_optix_visibility_test`), which was using the `__prim_visibility` array.
This is not entirely correct however, since `__prim_visibility` is filled with the merged visibility
flags of all objects that reference that primitive, so if one object uses different visibility flags
than another object, but they both are instances of the same geometry, they would appear the same
way. The reason that the any-hit program was used rather than the OptiX instance visibility mask is
that the latter is currently limited to 8 bits only, which is not sufficient to contain all Cycles
visibility flags (12 bits).

To mostly fix the problem with multiple instances and different visibility flags, I changed things to
use the OptiX instance visibility mask for a subset of the Cycles visibility flags (`PATH_RAY_CAMERA`
to `PATH_RAY_VOLUME_SCATTER`, which fit into 8 bits) and only fall back to the visibility test any-hit
program if that isn't enough (e.g. the ray visibility mask exceeds 8 bits or when using the built-in
curves from OptiX, since the any-hit program is then also used to skip the curve endcaps).

This may also improve performance in some cases, since by default OptiX can now perform the normal
scene intersection trace calls entirely on RT cores without having to jump back to the SM on every
hit to execute the any-hit program.

Fixes T89801

Differential Revision: https://developer.blender.org/D12604

Commit Details:

Full Hash: 2189dfd6e25a7bb6b734116619d87bc2d2a535ff
Parent Commit: 7270ba0
Lines Changed: +127, -60

4 Modified Paths:

/intern/cycles/device/optix/device_impl.cpp (+30, -14) (Diff)
/intern/cycles/device/optix/device_impl.h (+2, -1) (Diff)
/intern/cycles/kernel/bvh/bvh.h (+36, -17) (Diff)
/intern/cycles/kernel/device/optix/kernel.cu (+59, -28) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021