tensorflow / graphics

TensorFlow Graphics: Differentiable Graphics Layers for TensorFlow
Apache License 2.0
2.75k stars 365 forks source link

Bounding volume hierarchies for collision detection/raycasting #288

Open drebain opened 4 years ago

drebain commented 4 years ago

I'm interested in implementing a GPU accelerated BVH module based on Morton Codes along the lines of this. I have written a very naive version of the tree construction function here as a demo for what this could look like.

BVH functionality would be useful in a number of applications including physics and rendering, and one tree could support multiple operations including raycasting, one-to-many, and many-to-many collision detection.

My example places heavy assumptions on the tree structure (complete, k-ary) and can treat it as a single tensor, but more advanced versions might warrant some kind of abstraction like a Tree class. I'm not sure what the right approach would be for fitting this in with the rest of the API.

taiya commented 4 years ago

Added @G4G to start a discussion.

G4G commented 4 years ago

Thanks for answering the comments, the code looks good to me.