Skip to content

Proposal for EXT_mesh_opacity_micromap - #2623

Open
pixeljetstream wants to merge 23 commits into
KhronosGroup:mainfrom
pixeljetstream:EXT_mesh_opacity_micromap
Open

pixeljetstream wants to merge 23 commits into
KhronosGroup:mainfrom
pixeljetstream:EXT_mesh_opacity_micromap

Conversation

@pixeljetstream

@pixeljetstream pixeljetstream commented Jul 29, 2026 •

Copy link
Copy Markdown

Hello,

with the standardization of Vulkan VK_KHR_opacity_micromap as well as
Microsoft DirectX Raytracing — opacity micromaps we are proposing this extension to allow providing micromap data as part of a glTF.

Because the data is typically mesh-specific (micromaps operate in barycentric space) we added a mesh prefix to the extension name, also so that it doesn't clash with the Vulkan extension on searches.

We are looking forward to your feedback.

pixeljetstream and others added 3 commits June 9, 2026 15:34
Co-authored-by: Nia Bickford <nbickford@nvidia.com>
Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Pyarelal Knowles <pknowles@nvidia.com>
- Use GitHub-renderable math delimiters ($...$, $$...$$) instead of \(...\) and \[...\]
- Fix @pknowlesnv contributor handle; add Martin-Karl Lefrançois as contributor
- Refer to the core glTF definition of triangle count for micromapIndices
- Add a Known Implementations section
- Clarify that API micromap fields in the mapping table refer to the built micromap object
- Mark informative references as non-normative; link the OMM SDK on GitHub
README
- Define base triangle vertices v0/v1/v2 from TRIANGLES index order and the
  (u, v) barycentric convention; note that reordering or rotating triangles
  invalidates the association
- Limit subdivision levels to [0, 12] (DirectX 12 maximum)
- Define valid lookup values: signed elements >= -4, unsigned special-index
  bit patterns, and the record range including the no-accessor case
- Remove byteStride support for data, triangles and micromapIndices (core
  glTF only allows it for vertex attributes); triangles byteLength is a
  multiple of 8
- Require normalized == false on micromapIndices
- State usage entries per (level, format) pair as a data constraint
- Add Interaction with Materials (non-normative), Interaction with Other
  Extensions, and Optional vs. Required sections
- Make the reference function the normative ordering definition; keep the
  traversal description and figure as non-normative illustration
- Rework the API mapping into a non-normative Graphics API Correspondence
  table; use docs.vulkan.org links
- Use Khronos-style property tables and section order

Schema
- Move micromap objects to micromap.schema.json based on
  glTFChildOfRootProperty (adds name)
- Add maximum 12 to usageLevels; tighten descriptions
NBickford-NV and others added 8 commits October 24, 2026 05:21
- Overview:
    - Made it clearer that micromaps contain micromap triangles
    - Reduced some repetition between paragraphs 2 and 3, and cleaned up some clunkiness when we mention how this works well with graphics APIs
    - Don't claim binary-compatibility, because JSON will treat things like floats
    - Hardware can use OMMs; it's not required to (although it should, it helps quite a bit)
- Reference function now uses pseudocode that is in no particular language; additional code around clamping to the triangle edges has been removed; added more comments, although the magic of this function is still rather unexplained here.
- More links
- More LaTeX
- Moved the graphical description of the space-filling curve up to Subdivision and Micromap Order
- Changed 'typically created' to 'often created'; we do see format 1 and it's not that atypical.
- Some 'have to' -> 'must' replacements for concision
- Define the space-filling curve order normatively as a recursion with
  explicit vertex order for each of the four sub-triangles, so the
  definition no longer depends on the reference function or the figure.
- Add figures/micromap-split-rule.svg illustrating the split rule (vertex
  order of each sub-triangle, flipped winding marked), redrawn in spec
  notation from the "Bird curve recursive splitting rule" slide of
  NVIDIA's Micro-Mesh Basics deck.
- Restore the subdivision figure legend (vertex placement, blue/red arrows).
- Mark Appendix A non-normative and note equivalence with the
  VK_KHR_opacity_micromap reference code.
- Restore clamping in the pseudocode so points on the triangle edges and
  slightly outside return a valid index (matches the Vulkan reference).
- Pseudocode: parenthesize shifts inside XOR, define << and u32 wrap,
  use (1 << L) instead of exp2(L) for the integer mask.
- Fix the copyright appendix link after the rename to Appendix B.
- Overview: usage arrays count triangles per level/format combination.
- Set copyright range to `2026`
- `primitive` -> `mesh primitive`
- New note about the intended use of opacity micromap states
- Entries in the usage histogram must have distinct (level, format) pairs
- Buffer views must not define `target`
- Added `micromapBaseTriangle` to example
- Added note about what `micromapBaseTriangle` is useful for
- Removed support for signed `micromapIndices` accessors
- SVGs use SVG attributes instead of CSS styles now, and `sans-serif` is now the only listed `font-family`.
- `micromap-subdivision.svg` now has a white background and no longer references boxy-svg.
- JSON schemas now use draft 2020-12.
…ction of the extension; remove requirement that microtriangles not overlap.
…out a constraint they must follow together; require the sum of usageCounts to be equal to the number of triangles, which comes from the triangles buffer view
@lexaknyazev

Copy link
Copy Markdown
Member

We should have simple unit test assets that cover all relevant glTF-to-API data conversions. The goal is not to test APIs (they have their own test suites) but to confirm that glTF extension implementations support all possible input configurations and pass them correctly. Such assets should be as simple as possible (minimal required geometry, tiny textures, etc).

  • The product of (i.e., eight cases):
    • Four possible states of the micromapIndices accessor: undefined, uint8, uint16, and uint32.
    • Two possible states of the micromapBaseTriangle property: undefined and non-zero. For the non-zero base triangle cases with uint8 and uint16 micromap indices accessors, the base triangle value should be greater than 255 an 65535, respectively, to ensure that implementations do not mask/truncate the base triangle value.
  • Across the test assets, each format should be used at least once. This would also ensure that both 1 and 2 are accepted as usageFormats array elements.

* Require micromapBaseTriangle to fit in a uint32
* Clarify that special indices don't apply when `micromapIndices` is undefined.
* Use the new effective component type syntax in the glTF draft
@mklefrancois

Copy link
Copy Markdown
Contributor

Hi @lexaknyazev the unit tests are under Causeway.

There are many tests, and here is the list which is covering most of the possible configuration.
(This is a copy of the README.md)

Scene What it tests and what to expect
levels_fmt1_omm.gltf One triangle per subdivision level 0..12, 1-state format, 'tri' alpha pattern.

Triangles in reading order, 5 per row: level 0 first, level 12 last. Each shows a ring, a big disc at its bottom-left corner, a small one at the bottom-right and a medium one at the apex, only finer. Levels 0 and 1 are empty (a microtriangle is opaque only if at least half of it is covered), level 2 has three blobs at the three discs, the edges are built from triangles (a sawtooth) until level 8 or so, and levels 10 to 12 look alike. Blobs in the wrong corners, mirrored or scattered mean a wrong microtriangle order.
levels_fmt2_omm.gltf One triangle per subdivision level 0..12, 4-state format, 'tri' alpha pattern.

All triangles look the same: the unknown microtriangles are resolved by the alpha test, so the picture equals the scene without the extension at every level (compare with its _no_omm twin).
states_all_omm.gltf Hand-authored states over an opaque texture (top row) and a fully transparent one (bottom row).

State 0 transparent and state 1 opaque win over the texture. Unknown states fall back to the alpha test: solid on the top row, empty on the bottom row. Columns: level 1 (state = index), level 2 (index % 4), level 4 (top-level child k has state k: corner v0 transparent, middle opaque, corner v1 and corner v2 unknown), and a 1-state level 3 (index % 2). Top row: only the v0 corner is a hole in column 1; bottom row: only state-1 microtriangles show.
level0_uniform_omm.gltf Level 0 micromaps: one microtriangle, 1-state and 4-state, over opaque and transparent textures.

Columns: 1-state transparent, 1-state opaque, 4-state transparent, opaque, unknown-transparent, unknown-opaque. Top row (opaque texture): only the transparent states (columns 1 and 3) are holes. Bottom row (transparent texture): only the opaque states (columns 2 and 4) are solid.
special_indices_omm.gltf Special micromapIndices -1..-4 (uint8, uint16, uint32) over opaque and transparent textures.

Columns: transparent (-1), opaque (-2), unknown-transparent (-3), unknown-opaque (-4), then a regular micromap triangle (the 'tri' pattern). Rows 1-3 (opaque texture; uint8, uint16, uint32): -1 is a hole, the rest solid. Rows 4-6 (transparent texture): only -2 is solid. The regular column shows the pattern in rows 1-3 and (unknown resolved to transparent) nothing but the pattern's opaque states elsewhere.
index_types_omm.gltf micromapIndices as uint8, uint16 and uint32, with the records and the data shuffled.

Three identical 8x8 grids of 'rings', whatever the index type. Records and data are in random order, so a renderer that assumes record i belongs to triangle i draws garbage.
no_indices_base_triangle_omm.gltf No micromapIndices accessor; micromapBaseTriangle with and without indices.

Three identical 4x4 grids of 'glyph' (an F). 1: no accessor, base 0 (triangle t uses record t). 2: no accessor, base = start of its own records. 3: shuffled indices relative to a non-zero base. Unused records precede them all.
shared_records_omm.gltf Many triangles sharing one micromap triangle; many records sharing one data blob.

Left: 8x8 cells, 128 triangles, every cell shows the whole 'glyph' texture, all cells sharing 2 micromap triangles (one per triangle of the cell). Right: the same, with a record per triangle that all point at 2 data blobs (shared dataOffset). Both look like 64 identical F's.
mixed_levels_formats_omm.gltf One micromap with 12 (level, format) usages, records interleaved, data shuffled and padded.

A 6x2 grid of cells showing the 'glyph' F; cell (column c, row r) has level c+1 and format 1 on the top row, format 2 on the bottom row. Format 2 cells all show the exact F; format 1 cells show a coarse F that improves to the right.
mixed_levels_triangles_omm.gltf One mesh, one micromap, 4-state format; every triangle has its own level 0..12, over one big 'glyph' F.

A 4x3 grid of cells (24 triangles, two per cell) forming a single 'glyph' F across the whole mesh. Each triangle uses its own level, shuffled so that all of 0..12 occur. The format is 4-state everywhere, so the image must equal the no-micromap twin: only how much of each triangle is resolved by the micromap (opaque microtriangles) rather than by the alpha test (unknown ones along the edge of the F) changes with the level.
winding_orientation_omm.gltf Every vertex rotation and reflection of one triangle, indexed and not indexed.

Seven triangles with the 'tri' pattern, each baked for its own vertex order (1-state, level 4). All show the same picture (a ring plus discs: big bottom-left, small bottom-right, medium at the top), whatever the order; the staircase differs, since the microtriangle grid follows the vertex order. The last one is non-indexed.
neg_rotated_vertices_omm.gltf INVALID ON PURPOSE: the micromap was baked for another vertex order than the mesh has.

Left is correct. Middle and right were baked for the original order but their vertices are rotated, which the spec says invalidates the association: the picture is rotated/scrambled. Shows that a renderer maps the micromap through the primitive's own vertex order.
double_sided_omm.gltf A double-sided mask material seen from the front and the back.

Camera 'Front' and camera 'Back' look at the same four triangles (levels 2-5, 1-state). The alpha shape is attached to the surface: the back view is the mirror image of the front view, and the same microtriangles are hit.
alpha_cutoff_omm.gltf A horizontal alpha ramp with alphaCutoff 0.1 .. 0.9, each baked with its own cutoff.

The solid area shrinks from left to right as the cutoff rises: the edge is at u = cutoff. Top row 1-state (a straight edge with a microtriangle staircase), bottom row 4-state (a clean edge).
base_color_alpha_omm.gltf baseColorFactor alpha 1 .. 0.25 times a horizontal ramp, cutoff 0.5, baked with the factor.

The factor scales the texture alpha before the test, so the edge sits at u = 0.5 / factor: 0.5, 0.67, 1 (everything transparent from there), and an empty quad for 0.25.
material_modes_omm.gltf The same micromap on an OPAQUE, MASK and BLEND material.

The extension doesn't depend on the material. MASK is the reference. OPAQUE with a micromap: renderer defined; a renderer that honors the micromap shows holes (transparent states) and unknown states as opaque, one that ignores it shows a solid quad. BLEND: renderer defined too. Row 1 is 1-state, row 2 4-state.
texture_wrap_omm.gltf UVs from -0.5 to 2.5 with REPEAT, MIRRORED_REPEAT and CLAMP_TO_EDGE samplers.

The micromaps are baked with the sampler's wrap mode: repeat tiles the F, mirror alternates mirrored F's, clamp smears the edge pixels (an F cut off at the quad's center). Top 1-state, bottom 4-state.
texture_transform_uvsets_omm.gltf KHR_texture_transform (offset, rotation, scale) and TEXCOORD_1.

The micromaps are baked after the transform: identity, offset, 45 degree rotation, scale 2 with rotation, and a material on texCoord 1 (TEXCOORD_0 is a decoy that would show a solid color). Each shows what the plain alpha test shows.
fine_detail_omm.gltf Thin bars ('fence') with levels 2 .. 7, 1-state (top) and 4-state (bottom).

The fence is 16x16 bars, each a 1/16 of the quad pitch. Top: 1-state micromaps lose bars at low levels (levels 2-3 show a blotchy or empty quad) and converge to the fence by level 7. Bottom: 4-state keeps the exact fence at every level.
multiple_micromaps_omm.gltf Three micromaps in one file, a mesh with three primitives, and a primitive sharing a micromap.

Left: one mesh, three primitives, each with its own micromap (level 3 1-state, level 5 1-state, level 4 4-state), side by side. Right: a second mesh whose primitive uses micromap 0 again, with 'rings' baked there.
transforms_instancing_omm.gltf Mirrored, rotated and scaled nodes, a node hierarchy, and EXT_mesh_gpu_instancing.

One mesh (4x4 grid, 'glyph', level 4 1-state) drawn by many nodes: identity, mirrored in X (negative scale), rotated 90 degrees, non-uniform scale, a child of a scaled parent, and 24 GPU instances with random rotation and scale. The F follows the geometry in every one; a mirrored node shows a mirrored F.
morph_target_omm.gltf A morph target moves the vertices; the micromap stays on the surface.

The same 8x8 'glyph' grid with morph weights 0, 0.5 and 1 (a shear plus a bulge in Z). The alpha shape stretches with the surface. A renderer without morph support shows three flat identical quads.
sphere_noise_omm.gltf An icosphere with a 'noise' hole texture: uniform level and per-triangle adaptive levels.

Two 1280-triangle spheres, non-indexed, equirectangular uv. Left: every triangle level 5, 4-state. Right: level chosen per triangle from its size in texels (about 2 texels per microtriangle), 4-state, so the file mixes several levels. Both look like the same swiss-cheese sphere.
foliage_cards_omm.gltf A bush of leaf cards, every card using the same two micromap triangles.

N cards (--foliage-cards) with a pointed leaf with a transparent midrib, scattered on a ball and facing outward. The two micromap triangles (level 6, 4-state) are shared by all cards.
stress_dense_omm.gltf A plane of many triangles, one micromap triangle each.

A flat plane of --stress-grid squared cells (2 triangles each) with a 'noise' hole texture, every triangle with its own micromap triangle (4-state, --stress-level). It looks like a perforated sheet and equals the alpha-test render; it exercises the build and traversal cost of many micromaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants