Skip to content
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

Full Ray Traced Scene #11

Closed
3 of 7 tasks
kvark opened this issue Mar 13, 2023 · 2 comments · Fixed by #10
Closed
3 of 7 tasks

Full Ray Traced Scene #11

kvark opened this issue Mar 13, 2023 · 2 comments · Fixed by #10
Labels
type: feature New feature or request

Comments

@kvark
Copy link
Owner

kvark commented Mar 13, 2023

We need to demonstrate an ability to load whole 3D scenes and render them in real-time with ray-tracing.
Even though #6 has paved the way to ray tracing, and there is a ray query example now, there is still a few hard steps to make for this to work on complex scenes.

Main steps:

  • blade-render crate with Renderer API
  • provide all geometry data to the shader
  • glTF loader
  • environment map - importance sampling
  • lighting model

Bonus:

  • asset cache (potentially with distill)
  • taskification (likely with choir)

First of all, there needs to be a blade-render crate that takes care of scene resources, BLAS/TLAS, pipelines, and associated buffers. The user would still be in control of encoding the commands, but the renderer would do all the heavy lifting of ray-tracing.

Secondly, we need to find a way for the ray intersection code to fetch the associated object data: vertex/index buffers, material parameters, etc. This is generally done via the device address buffer (and potentially SBT) in Vulkan, but here we have to also make it compatible with Metal. So far, it looks like the only way there is via converting everything to use Metal Argument Buffers. So we'd start by doing the work on Naga side.

Potentially, we'd first get Vulkan running with blade-render, and then focus on ramping up Metal side. There is still a question of what type would be used for the array bindings, since &[BufferPiece; N] is apparently not liked by the orphan rules:

error[E0119]: conflicting implementations of trait `HasShaderBinding` for type `&[BufferPiece; _]`
   --> blade-graphics\src\lib.rs:443:1
    |
429 | impl<T: bytemuck::Pod> HasShaderBinding for T {
    | --------------------------------------------- first implementation here
...
443 | impl<'a, const N: usize> HasShaderBinding for &'a [BufferPiece; N] {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&[BufferPiece; _]`
    |
    = note: upstream crates may add a new impl of trait `bytemuck::Pod` for type `&[BufferPiece; _]` in future versions
@kvark kvark added the type: feature New feature or request label Mar 13, 2023
@zakarumych
Copy link
Collaborator

zakarumych commented Mar 13, 2023

impl<T: bytemuck::Pod> HasShaderBinding for T { doesn't look nice really. Pod data can easily be meaningless for GPU.

@kvark
Copy link
Owner Author

kvark commented Mar 14, 2023

@zakarumych Blade is unsafe, so this is OK. I wouldn't mind a solution that checks or shares the structure definition, just haven't found a good one yet.

@kvark kvark closed this as completed in #10 Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants