Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] OMI_materials_blend #240

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Jan 2, 2025

This is a work-in-progress extension to add additional blending modes to glTF materials.

Preview: https://github.com/aaronfranke/gltf-extensions/tree/OMI_materials_blend/extensions/2.0/OMI_materials_blend

Godot implementation: omigroup/omi-godot#13

See icosa-mirror/UnityGLTF#1, KhronosGroup/glTF#1189, and KhronosGroup/glTF#1302 for the existing discussions.

(also, I deleted duplicate ### JSON Schema sections in the audio extensions)

@aaronfranke aaronfranke marked this pull request as draft January 2, 2025 20:00
@hybridherbst
Copy link

Great comparison table!

I think the part about blending is a bit misleading, and maybe there need to be additional clarifications for transmission:

"BLEND"
Simple translucency for materials such as glass. The behavior is the same as in the base glTF specification.

"Blend" does not actually simulate glass materials; it is a magical opacity property which makes objects disappear into thin air. "Transmission" on the other hand simulates glass materials –

  • at opacity=0 with "blend", objects are completely invisible, there are no reflections visible either
  • at transmission=1, objects are fully transparent but their reflections still show up (like glass)

@aaronfranke
Copy link
Member Author

@hybridherbst Thanks, good catch! I actually took that from the PlayCanvas docs, so I guess their docs are wrong. I've modified the description of BLEND to simply match what Khronos has for glTF.

@mikeskydev
Copy link
Contributor

Does it make sense to add new alphaMode values directly on the material property instead of storing in the extensions property?

@aaronfranke
Copy link
Member Author

aaronfranke commented Jan 2, 2025

@mikeskydev Either is allowed per the glTF material schema (one possible value is "type": "string" for any string).

{
    "alphaMode": "ADD" // Directly setting the value.
}

However, if the only option was to use the existing "alphaMode" field, then this would make it impossible to provide a custom fallback when an importer doesn't support this extension. Therefore, we can and should allow for both.

{
    "alphaMode": "BLEND", // Fallback.
    "extensions": {
        "OMI_materials_blend": {
            "alphaMode": "ADD" // Override when clients support OMI_materials_blend.
        }
    }
}

I made a quick implementation in Godot and it can handle importing both of these cases: omigroup/omi-godot#13

@aaronfranke aaronfranke force-pushed the OMI_materials_blend branch 3 times, most recently from 5677819 to 9b1b390 Compare January 3, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants