Skip to content

Commit

Permalink
Merge pull request #4808 from mozilla/personal-bubble-fix
Browse files Browse the repository at this point in the history
Fix bubble transparency issues
  • Loading branch information
keianhzo authored Nov 5, 2021
2 parents 6360f0a + 1b74385 commit e2606df
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/systems/personal-space-bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ AFRAME.registerComponent("personal-space-invader", {
if (!material.userData.originalProps) {
originalProps = material.userData.originalProps = {
opacity: material.opacity,
transparent: material.transparent
transparent: material.transparent,
format: material.format,
blending: material.blending,
side: material.side
};
}

Expand All @@ -263,6 +266,13 @@ AFRAME.registerComponent("personal-space-invader", {
// not across avatars in the room.
material.opacity = invading ? this.data.invadingOpacity : originalProps.opacity;
material.transparent = invading || originalProps.transparent;

// Note: Since ThreeJS 0.132 the default format for GLTF imported opaque materials is RGBFormat
// so we need to switch before enabling transparency.
material.format = invading ? THREE.RGBAFormat : originalProps.format;
material.blending = invading ? THREE.NormalBlending : originalProps.blending;
// This shouldn't be necessary but for some reason transparency doens't work on some models if they are single sided.
material.side = invading ? THREE.DoubleSide : originalProps.side;
});
});
} else {
Expand Down

0 comments on commit e2606df

Please sign in to comment.