fix: stabilize water depth and rounded mask

This commit is contained in:
Tom Boullay
2026-05-26 22:56:50 +02:00
parent 1c27d55e5a
commit d6d3d5b685
9 changed files with 126 additions and 8 deletions
@@ -25,6 +25,23 @@ function applyTerrainMaterialSettings(
scene.traverse((child) => {
if (child instanceof THREE.Mesh) {
child.receiveShadow = receiveShadow;
const materials = Array.isArray(child.material)
? child.material
: [child.material];
for (const material of materials) {
const materialWithAlphaMap = material as THREE.Material & {
alphaMap?: THREE.Texture | null;
};
material.depthTest = true;
material.depthWrite = true;
if (material.opacity >= 1 && !materialWithAlphaMap.alphaMap) {
material.transparent = false;
}
}
}
});
}