Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a simple ray tracer and tests it on the well-known Cornell Box scene. This is an experimental demonstration of ray tracing with compute shaders in pygfx.
Ray tracing is a rendering technique distinct from rasterization. By simulating the physical behavior of light in a scene, it produces visuals that are closer to real-world lighting, with natural support for soft shadows and global illumination. This makes it particularly well-suited for offline rendering scenarios that demand high visual fidelity, such as film-quality rendering.
Below are the rendering results of the Cornell Box scene at different sample-per-pixel (spp) levels:
1000 spp:

10,000 spp:

100,000 spp:

Replacing the small cube in the scene with a transparent glass and applying a mirror-like surface to the front of the big rectangular box, we can get the following rendering result (around 30,000 spp):

I think this example serves as an exploratory starting point for implementing ray tracing with Pygfx. Perhaps in the future, we can have a powerful offline renderer using ray tracing technology in Pygfx :)