test(vulkan-rt): port RTVolume example to native Vulkan (#33)
Regression test for the procedural BLAS path: the same 3x3x3 grid of unit-box AABBs runs through a PROCEDURAL_HIT_GROUP_KHR group whose GLSL intersection shader (reportIntersectionEXT) turns each box into a radius-1 sphere, the any-hit shader punches the spherical-checkerboard cut-out (visible proof non-opaque geometry runs any-hit), and the closest-hit shades per-instance tints — the WebGPU example behavior reproduced natively. Fixed camera in raygen.glsl; the WebGPU/DOM path is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
a9e42f9c90
commit
40c4184d41
8 changed files with 357 additions and 18 deletions
|
|
@ -1,26 +1,36 @@
|
|||
# RTVolume
|
||||
|
||||
WebGPU software ray tracing of **procedural (AABB) geometry** with an
|
||||
**any-hit** cut-out — the two features added for issue #13.
|
||||
Ray tracing of **procedural (AABB) geometry** with an **any-hit** cut-out
|
||||
on both backends — software WebGPU (issue #13) and native Vulkan hardware
|
||||
RT (issue #33).
|
||||
|
||||
A 3×3×3 grid of unit boxes is registered as an AABB BLAS
|
||||
(`Mesh::BuildProcedural`, the WebGPU analog of `VK_GEOMETRY_TYPE_AABBS_KHR`).
|
||||
The hit group is a `RTShaderGroupType::ProceduralHitGroup` carrying:
|
||||
(`Mesh::BuildProcedural` — `VK_GEOMETRY_TYPE_AABBS_KHR` on Vulkan, the
|
||||
software AABB-leaf path on WebGPU). The hit group is procedural
|
||||
(`RTShaderGroupType::ProceduralHitGroup` /
|
||||
`VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR`) carrying:
|
||||
|
||||
- `intersection.wgsl` — analytic ray–sphere test that turns each box into a
|
||||
radius-1 sphere (runs in TRACE, once per box the ray enters);
|
||||
- `anyhit.wgsl` — returns `RT_ANYHIT_IGNORE` for half the cells of a
|
||||
spherical checkerboard, so the ray passes through and the background /
|
||||
spheres behind show through (the visible proof any-hit runs);
|
||||
- `closesthit.wgsl` — normal-based Lambert shading, tinted per instance.
|
||||
- `intersection.wgsl` / `intersection.glsl` — analytic ray–sphere test that
|
||||
turns each box into a radius-1 sphere (runs once per box the ray enters);
|
||||
- `anyhit.wgsl` / `anyhit.glsl` — ignores the intersection for half the
|
||||
cells of a spherical checkerboard, so the ray passes through and the
|
||||
background / spheres behind show through (the visible proof any-hit runs);
|
||||
- `closesthit.wgsl` / `closesthit.glsl` — normal-based Lambert shading,
|
||||
tinted per instance.
|
||||
|
||||
The geometry is registered **non-opaque** and the instances clear their
|
||||
force-opaque flag, which is what lets the any-hit shader run. Flip the
|
||||
instance flag to `kRTGeometryInstanceForceOpaque` (or build the mesh with
|
||||
`opaque = true`) to skip any-hit and see solid spheres.
|
||||
|
||||
WebGPU/DOM only:
|
||||
WebGPU/DOM (free camera, WASD + mouse):
|
||||
|
||||
```
|
||||
crafter-build --target=wasm32-wasip1 -r
|
||||
```
|
||||
|
||||
Native Vulkan (fixed camera in raygen.glsl):
|
||||
|
||||
```
|
||||
crafter-build -r
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue