GPUOpen-LibrariesAndSDKs / HIPRT

Other
95 stars 6 forks source link

Q: Branching factor, skinning #18

Open ib00 opened 5 days ago

ib00 commented 5 days ago

Two questions:

  1. Is there a restriction on what BVH branching factor must be? Must it be a power-of-two or it can be anything?
  2. What is a recommended way for using this library for animated meshes and for skinning?
meistdan commented 5 days ago
  1. Only supported branching factor is 4: https://github.com/GPUOpen-LibrariesAndSDKs/HIPRT/blob/main/hiprt/hiprt_common.h#L177
  2. This is a difficult question as we have not tested HIPRT in such scenario. I would suggest either the balanced build for the initial construction with refitting for other frames, or fast/balanced rebuild each frame.
ib00 commented 4 days ago

Thanks. So, if I wanted to support different branching factor, is it enough to just change the last step of the build algorithm (Collapse), or would a bigger change be needed (including traversal)?

meistdan commented 1 day ago

You need to change both build and construction if you want to support branching factor other than 4.

For the build, it should be relatively easy; you just need to adjust to your node format here: https://github.com/GPUOpen-LibrariesAndSDKs/HIPRT/blob/main/hiprt/impl/BvhBuilderKernels.h#L548-L607

The traversal is hard-coded to 4 here: https://github.com/GPUOpen-LibrariesAndSDKs/HIPRT/blob/main/hiprt/impl/hiprt_device_impl.h#L318-L376

ib00 commented 20 hours ago

Thank you. This seems doable.