mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 05:48:57 +00:00
fix(skins): translucency issues with outer layer (#6345)
fix(skins): translucency issues with outer layer in main renderer
This commit is contained in:
@@ -32,7 +32,7 @@ function configureSkinPreviewMesh(mesh: THREE.Mesh) {
|
|||||||
materials.forEach((material) => {
|
materials.forEach((material) => {
|
||||||
if (!(material instanceof THREE.MeshStandardMaterial) || material.name === 'cape') return
|
if (!(material instanceof THREE.MeshStandardMaterial) || material.name === 'cape') return
|
||||||
|
|
||||||
material.transparent = false
|
material.transparent = isSkinLayer
|
||||||
material.alphaTest = 0.1
|
material.alphaTest = 0.1
|
||||||
material.depthTest = true
|
material.depthTest = true
|
||||||
material.depthWrite = true
|
material.depthWrite = true
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ export function applyTexture(model: THREE.Object3D, texture: THREE.Texture): voi
|
|||||||
model.traverse((child) => {
|
model.traverse((child) => {
|
||||||
if ((child as THREE.Mesh).isMesh) {
|
if ((child as THREE.Mesh).isMesh) {
|
||||||
const mesh = child as THREE.Mesh
|
const mesh = child as THREE.Mesh
|
||||||
|
const isSkinLayer = mesh.name.endsWith('_Layer')
|
||||||
const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material]
|
const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material]
|
||||||
|
|
||||||
materials.forEach((mat: THREE.Material) => {
|
materials.forEach((mat: THREE.Material) => {
|
||||||
@@ -168,7 +169,7 @@ export function applyTexture(model: THREE.Object3D, texture: THREE.Texture): voi
|
|||||||
flatShading: true,
|
flatShading: true,
|
||||||
side: THREE.FrontSide,
|
side: THREE.FrontSide,
|
||||||
toneMapped: false,
|
toneMapped: false,
|
||||||
transparent: false,
|
transparent: isSkinLayer,
|
||||||
})
|
})
|
||||||
|
|
||||||
setCommonMaterialProperties(mat)
|
setCommonMaterialProperties(mat)
|
||||||
|
|||||||
Reference in New Issue
Block a user