I understand that the AS of LuisaCompute is designed as a two-layer AS, for optix::TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING is set in cuda_shader_optix.cpp; and the emplace_back member function of Accel in accel.h accepts mesh, curve and procedural only. Although uint64_t mesh_handle argument is also defined in a reload function, passing an Accel or other object that is not inherited from Primitive is not feasible (at least with CUDA backend), for the following implementation in cuda_accel.cpp:
auto prim = reinterpret_cast<const CUDAPrimitive *>(m.primitive);
The inability to implement multi-layer AS is not the only problem this implementation poses. In OptiX, some methods accept primitive's OptixTraversableHandle to generate new OptixTraversableHandle. For example, optix::api().convertPointerToTraversableHandle used to achieve motion blur. According to the current design, developers will have to inherit CUDAPrimitive to encapsulate this new OptixTraversableHandle, but this will bring design overhead, for this OptixTraversableHandle is just an instance, it does not have a BVH Buffer, and does not need (and cannot) to implement the update function. Is this good design?
Furthermore, is it necessary for LC to support a multi-layer AS?
In order to optimize performance, the multi-level AS will not be implemented in the short term. Motion blur on OptiX will be simply managed by Accel with an array of OptixTraversableHandle(s).
I understand that the AS of LuisaCompute is designed as a two-layer AS, for
optix::TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING
is set incuda_shader_optix.cpp
; and theemplace_back
member function ofAccel
inaccel.h
accepts mesh, curve and procedural only. Althoughuint64_t mesh_handle
argument is also defined in a reload function, passing anAccel
or other object that is not inherited fromPrimitive
is not feasible (at least with CUDA backend), for the following implementation incuda_accel.cpp
:The inability to implement multi-layer AS is not the only problem this implementation poses. In OptiX, some methods accept primitive's
OptixTraversableHandle
to generate newOptixTraversableHandle
. For example,optix::api().convertPointerToTraversableHandle
used to achieve motion blur. According to the current design, developers will have to inheritCUDAPrimitive
to encapsulate this newOptixTraversableHandle
, but this will bring design overhead, for thisOptixTraversableHandle
is just an instance, it does not have a BVH Buffer, and does not need (and cannot) to implement the update function. Is this good design?Furthermore, is it necessary for LC to support a multi-layer AS?