Skip to content

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

@echadwick-artist
Copy link

echadwick-artist commented Jun 1, 2025

I created this a few years back, when I was developing for the Wii. I wonder if this extension could be extended to include the full source-destination matrix?

IMG_9603

As for why someone would want these methods in glTF… they are helpful when creating effects like water, fire, spell-casting animations, UI elements, decals , etc.

@SimonHeggie
Copy link

Big +1 from the 2D / Spine-style side.

This adds the blend modes artists actually need for layered pipelines:
• Multiply for shadows/occlusion without washing out color
• Additive for glows/FX

Today we patch this per-engine after import; having a portable glTF extension closes that gap.
Core alphaMode:"BLEND" + extension override) is exactly what we need to stay compatible.

This will also make a clean Blender → glTF path viable without relying on legacy add-ons tied to old Blender APIs.

Thanks for pushing this!
Fingers crossed the review goes through!

-S

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.

6 participants