Skip to content

Expose premultipliedAlpha on material component#5810

Merged
dmarcos merged 1 commit intoaframevr:masterfrom
vincentfretin:fix-premultipliedAlpha
Apr 12, 2026
Merged

Expose premultipliedAlpha on material component#5810
dmarcos merged 1 commit intoaframevr:masterfrom
vincentfretin:fix-premultipliedAlpha

Conversation

@vincentfretin
Copy link
Copy Markdown
Contributor

Summary

Since three.js r178 (mrdoob/three.js#31246), THREE.MultiplyBlending emits a repeated console warning unless the material has premultipliedAlpha = true:

THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true

A-Frame's material component exposes blending: multiply but does not expose premultipliedAlpha, so users had no way to silence the warning from markup alone.

This PR:

  • Adds premultipliedAlpha to the material schema (default false), giving users direct control from markup.
  • Forces premultipliedAlpha = true whenever blending is multiply, regardless of the user-supplied value, so the three.js warning cannot accidentally be triggered through the component's public API.

Changes

  • src/components/material.js — add premultipliedAlpha schema property; force it on for blending: multiply, otherwise pass through the user value.
  • docs/components/material.md — document the new property.
  • tests/components/material.test.js — four tests in the blending suite covering:
    • forced on when blending is multiply
    • forced on even when user sets it to false with multiply
    • defaults to false for non-multiply blending
    • respects user value for non-multiply blending

Test plan

  • npm test — all tests pass.
  • Manually verified the warning no longer appears on an entity using material="blending: multiply; transparent: true".

Since three.js r178, THREE.MultiplyBlending emits a repeated console
warning unless material.premultipliedAlpha is true. Expose
premultipliedAlpha as a material schema property and force it on
whenever blending is multiply.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dmarcos
Copy link
Copy Markdown
Member

dmarcos commented Apr 12, 2026

Thank you!

@dmarcos dmarcos merged commit dd6709c into aframevr:master Apr 12, 2026
1 check passed
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.

2 participants