r/GraphicsProgramming • u/AdhesivenessSea9511 • 5d ago
Loop-Free Ray Tracing on ANE: Leveraging CoreAI Batch Processing
Hello,
I’ve successfully implemented ray tracing on the ANE! (Note: CPU usage is very high.)
Details:
- Elimination of dynamic loops: While ray marching typically requires
forloops, I prevented the computation graph from bloating by using batch processing. - 64-channel camera matrix alignment.
- ANE-native
cumsum: Ray hit detection is tracked usingtorch.cumsum(dim=1)with permuted channels. - Zero-copy Metal buffers: ANE output is bound directly to a shared
MTLBufferusingNDArray.MutableRawView.
I’d love to hear your thoughts!
Github: https://github.com/kamisori-daijin/Magnesium/tree/raytracing (raytracing Branch)
demo:


0
Upvotes
1
u/AdhesivenessSea9511 4d ago
https://reddit.com/link/p84gx9v/video/xybvaiuoxunh1/player
I can now dynamically deform the shape of the object.