Opacity Micromaps and framework for simple engine courses#385
Conversation
Add four SVG diagrams illustrating shadow concepts (hard shadows, soft shadows, foliage alpha-testing problem, shadow ray lifecycle, and triangle subdivision) and create the introduction chapter for the Opacity Micromaps course explaining the performance problem with alpha-tested geometry in ray-traced shadows.
… people should use. At time of writing, Vulkan 3.4.350 sdk isn't yet available. so I'll hold back the changes to the source code example. That one will stay on EXT until the sdk that can support this has been released.
|
The CI will fail until LunarG updates the VulkanSDK to 1.4.351. The release that has KHR version of the extension. Currently 1.4.350 is the most released version and we use the LunarG sdk in CI. |
…ated the CMake to automatically grab Vulkan_hpp when local SDK doesn't have the KHR OMM.
|
Can we merge #388 and then update this branch from master? I'm seeing the same issues as during my review of the glTF PR that stop me from building the code part of this PR. |
# Conflicts: # attachments/simple_engine/CMake/FindKTX.cmake
|
Still going through the tutorial, but one thing I'm missing: There doesn't seem to be any mention of how to build the actual code in the tutorial. Could that be added? |
…camera, long touch to reset camera. Swipe to translate camera.
| @@ -0,0 +1,120 @@ | |||
| = Simple Engine — Course Modules | |||
There was a problem hiding this comment.
This is missing from the navigation and as such inaccessible to readers. It also looks to be in the wrong folder (source instead of documentation).
|
|
||
| The right choice depends on the texture content and the performance targets of the application. Content with sharp, high-contrast alpha masks (like a chain-link fence with near-binary alpha) benefits greatly from even low subdivision levels because the boundaries are crisp. Content with soft, gradual alpha transitions (like hair cards or feathers) may require higher subdivision levels to keep the unknown fraction small. | ||
|
|
||
| == Building the Micromap: A One-Time Investment |
There was a problem hiding this comment.
Can this be expanded with some more details? Like how do you actually build a micromap at runtime, and how (if possible) to offline create those?
|
|
||
| This is the complete description of an **Opacity Micromap**: a data structure, attached to a triangle mesh in the GPU's acceleration structure, that subdivides each triangle into a regular grid of smaller triangles and assigns each one a pre-computed opacity state. The word "micro" is used precisely: these are not additional geometric triangles that the ray tracer has to traverse. They are sub-triangle classifications that the traversal hardware reads as metadata, using them to accelerate the decision of whether a given ray-triangle intersection represents an actual hit. | ||
|
|
||
| == Three States, Not Two |
There was a problem hiding this comment.
I don't think that's true for the KHR extension. It supports a 2 and 4 state format, but none with three states.
|
Could you do a documentation pass to check if everything has properly been updated to the KHR extensions? I noticed a few things that sound like they apply to the EXT one, and not the (significantly changed) KHR one. |
| layout(constant_id = N) gl_EnableOpacityMicromapExt; | ||
| ---- | ||
|
|
||
| where `N` is a specialisation constant ID. This is a one-line addition to the shader — not a logical change — but without it, the hardware silently ignores all micromap data during ray query traversal and falls back to the full any-hit shader path on every intersection, as if no micromaps were attached at all. This was a deliberate design change from `VK_EXT_opacity_micromap`, where the optimisation was implicit for ray queries. The explicit declaration makes the hardware intent unambiguous and allows compilers to reason about it correctly. |
There was a problem hiding this comment.
...silently ignores all micromap data...
Is that true? The description of OpacityMicromapIdKHR in the SPIR-V spec sounds different:
If ray query traversal uses acceleration structures with opacity micromaps, this execution mode must be specified with a value of true; otherwise, undefined behavior results.
Add Opacity Micromaps course
Add framework for new special complex topics for simple engine.
Add four SVG diagrams illustrating shadow concepts (hard shadows, soft shadows, foliage alpha-testing problem, shadow ray lifecycle, and triangle subdivision) and create the introduction chapter for the Opacity Micromaps course explaining the performance problem with alpha-tested geometry in ray-traced shadows.