diff --git a/fission/src/mirabuf/MirabufInstance.ts b/fission/src/mirabuf/MirabufInstance.ts index 2cf818e640..6c20162ac0 100644 --- a/fission/src/mirabuf/MirabufInstance.ts +++ b/fission/src/mirabuf/MirabufInstance.ts @@ -116,9 +116,14 @@ class MirabufInstance { Object.entries(this._mirabufParser.assembly.data!.materials!.appearances!).forEach( ([appearanceId, appearance]) => { let hex = 0xe32b50 + let opacity = 1.0 if (appearance.albedo) { const { A, B, G, R } = appearance.albedo - if (A && B && G && R) hex = (A << 24) | (R << 16) | (G << 8) | B + console.log(A) + if (A && B && G && R) { + hex = (A << 24) | (R << 16) | (G << 8) | B + opacity = A / 255.0 + } } let material: THREE.Material @@ -126,16 +131,14 @@ class MirabufInstance { material = new THREE.MeshPhongMaterial({ color: hex, shininess: 0.0, + opacity: opacity, + transparent: opacity < 1.0, }) } else if (materialStyle == MaterialStyle.Normals) { material = new THREE.MeshNormalMaterial() } else if (materialStyle == MaterialStyle.Toon) { material = World.SceneRenderer.CreateToonMaterial(hex, 5) console.debug("Toon Material") - } else if (materialStyle == MaterialStyle.Transparent) { - material = new THREE.MeshStandardMaterial({ - transparent: true, - }) } this._materials.set(appearanceId, material!)