arkavo-org / arkavo-org/VRMMetalKit
GLTFMetalKit: KHR_texture_transform + other widely-adopted KHR extensions
- Dominant language
- Swift
- Stars
- 6
- Forks
- 2
- Avg merge
- 18h 51m
- Merged PRs (30d)
- 26
Description
## Context
PR #241 ships GLTFMetalKit with two KHR extensions: `KHR_materials_unlit` and `KHR_lights_punctual` (directional / point / spot, max 8). The dispatch surface in `GLTFKHRExtensions.swift` and the asset loader's material decoder is in place for adding more.
Several widely-adopted KHR extensions affect rendering correctness of common Khronos sample assets:
| Extension | Impact | Effort |
|---|---|---|
| `KHR_texture_transform` | UV offset/rotation/scale per texture slot. Common in optimized assets. | Small. Already parsed in `GLTFTextureInfo.khrTextureTransform`; just needs shader-side UV transform. |
| `KHR_materials_emissive_strength` | HDR emissive intensity multiplier for bloom-like effects. | Small. Single uniform passthrough. |
| `KHR_materials_clearcoat` | Second specular lobe for car-paint-like materials. | Medium. Extra fragment math + new BRDF parameters. |
| `KHR_materials_ior` | Index-of-refraction for fresnel adjustment. Common alongside transmission. | Small. F0 modulation. |
| `KHR_draco_mesh_compression` | Geometry compression. Many production glTF assets ship Draco-compressed. | Large. Requires Draco decoder bridge. |
Surfaced in PR #241. Each is its own focused increment.
## What's needed
- Prioritize by impact-to-effort. Suggested order: `KHR_texture_transform` → `KHR_materials_emissive_strength` → `KHR_materials_ior`. Defer `clearcoat` and `Draco` to when a specific consumer needs them.
- For each: parse the extension JSON in the material decoder, plumb the relevant fields into `GLTFMaterialUniforms` (or a new uniform buffer), update the PBR fragment.
- `GLTFLoadError.unsupportedExtension(name:)` policy continues to apply to anything not yet implemented.
## Acceptance
- Sample assets that depend on each extension render correctly (e.g. `BoomBox` for `texture_transform`, `EmissiveStrengthTest` for `emissive_strength`).
- Existing tests continue to pass.
- The "unsupported extension" error path stays clean.
## Estimate
`KHR_texture_transform`: ~3 hours.
`KHR_materials_emissive_strength`: ~1 hour.
`KHR_materials_ior`: ~2 hours.
The other two are larger and should be their own issues if/when needed.
Contributor guide
Research direction
Start with GLTFKHRExtensions.swift, the asset loader's material decoder, and the existing GLTFTextureInfo.khrTextureTransform field. Begin with KHR_texture_transform, then trace GLTFMaterialUniforms into the PBR fragment and inspect the named BoomBox sample. Done means the selected extension's sample renders correctly, existing tests pass, and unsupported-extension errors remain clean.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100