Skip to content

Commit

Permalink
Transparent Materials Mirabuf (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay authored Jul 16, 2024
2 parents e97d4f7 + 09377a6 commit 99f8ecc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fission/src/mirabuf/MirabufInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,22 @@ 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
if (A && B && G && R) {
hex = (A << 24) | (R << 16) | (G << 8) | B
opacity = A / 255.0
}
}

let material: THREE.Material
if (materialStyle == MaterialStyle.Regular) {
material = new THREE.MeshPhongMaterial({
color: hex,
shininess: 0.0,
opacity: opacity,
transparent: opacity < 1.0,
})
} else if (materialStyle == MaterialStyle.Normals) {
material = new THREE.MeshNormalMaterial()
Expand Down

0 comments on commit 99f8ecc

Please sign in to comment.