-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement Ray Tracing on Metal #7402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See the ray_cube_compute, ray_cube_fragment examples which use the wgpu api built on top of the wgpu-hal api. |
I implemented it for the most part: https://github.com/Lichtso/wgpu/tree/metal/ray_tracing_acceleration_structures A challenge I encontered is that metal does not use raw GPU pointers like all other backends. Instead one has to build the BLASes first and then add a list of their handles to the TLAS descriptor to build it. Then the instances in the TLAS can reference those listed BLASes by index. This could require a rework of the And then there are these other annoyances like how the flags and the barriers are handled. |
Maybe try Edit: Also see https://developer.apple.com/documentation/metal/mtlindirectaccelerationstructureinstancedescriptor. |
Great idea, I will give it a shot after I got something working. I fixed a few more things, the metal API validation and the msl shader validation pass, but so far there still are no intersections ever at all :( At least I can now see the BLAS, the TLAS instantiations thereof and the shaders acceleration structure buffer binding being active in XCode: https://developer.apple.com/documentation/xcode/inspecting-acceleration-structures Still, the actual shader produces no hits even if I make all parameters the least restrictive possible (like using a negative minimal distance, forcing opacity and full hit mask etc.). |
The only other thing I could find is that you bitshift |
Well, turns out it was already working. I just had Xcode configured not to run cargo build, so I was looking at an outdated build. |
Raytracing is not yet implemented for Metal? Is it currently being worked on? If not, I might take a look at it. Is there an example that could be tested?
The text was updated successfully, but these errors were encountered: