Skip to content

Adding KHR_materials_retroreflection example - #285

Merged
emackey merged 1 commit into
KhronosGroup:mainfrom
mklefrancois:khr-materials-retroreflection
Aug 24, 2026
Merged

Adding KHR_materials_retroreflection example#285
emackey merged 1 commit into
KhronosGroup:mainfrom
mklefrancois:khr-materials-retroreflection

Conversation

@mklefrancois

Copy link
Copy Markdown
Contributor

This sample asset accompanies KhronosGroup/glTF#2610, which proposes the KHR_materials_retroreflection extension.

The scene contains two traffic cones side by side: one with a retroreflective material using both retroreflectionFactor and retroreflectionTexture, and one without the extension for comparison. The retroreflective cone brightens significantly when the light and camera directions are closely aligned, which is the characteristic appearance of real-world retroreflective materials such as high-visibility clothing and road markings.

Traffic cone with and without KHR_materials_retroreflection

Rendered with vk_gltf_renderer.

@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch from 225b3b2 to 271af5e Compare July 8, 2026 15:24
@echadwick-dgg3d

Copy link
Copy Markdown

This is a great example!

I think it needs a few changes, per SubmittingModels:

  • The .glTF JSON file should be named with PascaleCase to match the folder name
  • The glTF asset and its resources should be moved into a \glTF subfolder (Models/TrafficCone/glTF/TrafficCone.gltf).
  • It's missing a README.md with a screenshot folder.
  • It's missing properly formatted license and metadata files.

You can check one of the existing assets to see how things are ideally set up.

@mklefrancois

Copy link
Copy Markdown
Contributor Author

Thanks @echadwick-dgg3d, I made many changes and hopefully it meets all requirements.

@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch from e1482b3 to b7b146f Compare August 4, 2026 06:34
@echadwick-dgg3d

Copy link
Copy Markdown

Looking good. One discrepancy, the readme says the screenshot is from the sample viewer, but the image shows evidence of pathtracing (shadows & soft reflections on the ground plane) which the viewer does not support. Which renderer was it created with? I think it's ok if it's not the glTF Sample Viewer, since we do have other assets with pathtraced screenshots.

@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch from b7b146f to 796da0d Compare August 4, 2026 15:07
@mklefrancois

Copy link
Copy Markdown
Contributor Author

Thanks for pointing it out, I took another model as template and forgot to modify this. The renderer is vk_gltf_renderer. Updating the readme.

@echadwick-dgg3d

Copy link
Copy Markdown

A couple more points I noticed:

Is there a reason why the two materials use "metallicFactor": 0.5,? Any metallic values which are not 0 or 1 are non-physical in the metallic-roughness shading model, so this can lead to unpredictable behavior in renderers. The general advice is to only use grays for anti-aliasing in a metallic texture.

Also, the two gray textures ConeBaseMat_metallicRoughness.png and ConeBaseMat_retroreflective.png could ideally be 8bit grayscale format instead of 24bit.

@mklefrancois

Copy link
Copy Markdown
Contributor Author

Thanks @echadwick-dgg3d, good catches. Fixed both.

Setting metallic to 0 like you suggested actually made the retroreflection almost disappear. It makes sense once you look at the MRM model (Portsmouth et al.): the retroreflection is basically the specular lobe bounced back toward the light, so its strength comes from the specular reflectance. That metallicFactor: 0.5 was faking that reflectance — exactly the non-physical trick you flagged. On a proper dielectric (F0 ≈ 0.04) there's almost nothing left to bounce back.

So instead of cheating with metallic, I gave the tape a real dielectric specular via KHR_materials_specular (masked to the stripes). The paper actually calls for this — it says F for retroreflectors should be treated as an empirical value rather than a smooth-surface Fresnel, since the real tape scatters through glass beads / corner cubes.

For the textures: both are 8-bit grayscale now (~55% smaller). They were also identical, so I merged them into one image and dropped the duplicate (metallic-roughness reads G/B, retroreflection reads R).

The two materials are now identical; the only difference is the KHR_materials_retroreflection extension on the left one.

@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch 2 times, most recently from 1225c28 to 89ab02d Compare August 6, 2026 16:29
@echadwick-dgg3d

echadwick-dgg3d commented Aug 6, 2026

Copy link
Copy Markdown

Setting metallic to 0 like you suggested actually made the retroreflection almost disappear. It makes sense once you look at the MRM model (Portsmouth et al.): the retroreflection is basically the specular lobe bounced back toward the light, so its strength comes from the specular reflectance. That metallicFactor: 0.5 was faking that reflectance — exactly the non-physical trick you flagged. On a proper dielectric (F0 ≈ 0.04) there's almost nothing left to bounce back.

So instead of cheating with metallic, I gave the tape a real dielectric specular via KHR_materials_specular (masked to the stripes). The paper actually calls for this — it says F for retroreflectors should be treated as an empirical value rather than a smooth-surface Fresnel, since the real tape scatters through glass beads / corner cubes.

Awesome (though I don't think I advised setting it to zero). Could you add your info in the readme, so people can learn why it's needed and how they can reproduce this effect with their own assets?

Does the readme need to be updated to list the specular extension?

Have you run this asset through the glTF Validator? I think there might be an unused texcoord on the floor, but this is a pretty minor issue I think.

It might seem like a lot of work to get something into the repo, but it's worth the effort to have a bunch of well-formed assets. Thanks for all your work on this!

@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch from 89ab02d to 75801d5 Compare August 7, 2026 14:34
@mklefrancois

Copy link
Copy Markdown
Contributor Author

Thanks! I really appreciate the thorough review and attention to details. This will help when we will bring the asset for opacity micromaps!

And you're right — the "set to 0" was my call; you said 0 or 1, and 0 is the physical one for a plastic cone.

Added a Materials section to the README explaining why KHR_materials_specular is needed — retroreflection redirects the specular lobe, so a plain dielectric (F0 ≈ 0.04) makes it barely visible.

The extensions are automatically added by the script. I have regenerated it, and KHR_materials_specular, KHR_lights_punctual now appears to the extensions list.

Good catch on the floor — an unused TEXCOORD_0 (the plane material has no textures), so I removed it and its orphaned accessor/bufferView. Ran it through the glTF Validator: 0 errors, 0 warnings. The only remaining message is an info that the validator doesn't yet know KHR_materials_retroreflection, which is expected.

Thanks again for the review!

@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch 2 times, most recently from 63b27d4 to 7fc845f Compare August 20, 2026 17:32
Comment thread Models/TrafficCone/metadata.json Outdated
"version": 2,
"legal": [
{
"license": "CC-BY 4.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There have been some ... changes (hopefully: improvements) ... in terms of the CI quality check. Specifically: The CI now checks for the validity of the license identifiers. In this case, the license must be a valid SPDX identifier, so it has to be
CC-BY-4.0

(i.e. the current value is missing that last -...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will give it a try,

The SPDX was correct, but the licence was differently written

    "spdx": "CC-BY-4.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may still be some ... "legacy aspects" ... regarding the metadata JSON handling.

But according to the latest state, the "spdx" property in the metadata should no longer be required. Instead, the "license" property should be a valid SPDX identifier (or an identifier for a license that is stored locally in the LICENSES directory).

This was done in order to streamline, simplify, and canonicalize the submission process. Until recently, I think that there wasn't even a mechanism that prevented users from adding some
"icon": "https://example.com/not-safe-for-work.png"
in their metadata. (And there may not be a mechanism that prevents them from doing that today).

But most of the fields in that JSON can be (and now: are) derived from the SPDX identifier. So the only required fields now should be

            "license": "CC-BY-4.0",
            "artist": "hinndia",
            "year": "2024",
            "owner": "hinndia",
            "what": "Everything"

@emackey emackey added the PBR Physically Based Rendering label Aug 21, 2026
@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch from 7fc845f to c931844 Compare August 21, 2026 16:09
@javagl

javagl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

So CI seems to be happy now.

Given that the corresponding PR in the glTF repo is not merged yet, I assume that this should also not yet be merged. But when the time is right, maybe someone (Ed or Alexey) can have a look and review+merge this accordingly.

@mklefrancois

Copy link
Copy Markdown
Contributor Author

In the PBR meeting, if I recall correctly, the agreed sequence was: the asset should be merged first, followed by the Khronos Viewer implementing the feature, and then the extension would be merged. I'd be happy to discuss this further on Monday.

Replace extension to KHR

Make the two material metallic and roughness identical

TrafficCone: restructure to meet Sample-Assets submission requirements

Bring the KHR_materials_retroreflection test model in line with
SubmittingModels.md:

- Rename to PascalCase and move the asset + resources into glTF/
  (traffic_cone.gltf/.bin and images/*.png -> glTF/TrafficCone.*)
- Replace license.txt with generated LICENSE.md and add metadata.json
- Add README.body.md (Legal section omitted; states it is a test model
  for the extension) and generate README.md via util/model.php
- Add catalog and large screenshots under screenshot/
- Regenerate repo-wide indexes (Models.md, Models-extension.md,
  model-index.json, .reuse/dep5)
TrafficCone: metallic=0 + KHR_materials_specular for retroreflection

- Set metallicFactor to 0 on both cones; 0.5 was non-physical. The MRM
  retroreflection redirects the specular lobe, so its strength comes from
  specular reflectance -- provide it via KHR_materials_specular on the
  stripes instead of faking it with metalness.
- Re-encode the metallic-roughness / retroreflection textures to 8-bit
  grayscale; the two were byte-identical, so merge into one image and drop
  the duplicate (metallic-roughness reads G/B, retroreflection reads R).
- Both cone materials are now identical except the KHR_materials_retroreflection
  extension on ConeMatRetro.
- Align the directional light with the view so the effect self-demonstrates;
  refresh screenshots.
@mklefrancois
mklefrancois force-pushed the khr-materials-retroreflection branch from c931844 to 3582d49 Compare August 24, 2026 15:00
@emackey
emackey merged commit db7184d into KhronosGroup:main Aug 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PBR Physically Based Rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants