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

Fix bubble transparency issues #4808

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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