It is expected as it draws everything twice, so twice the faces.
Got it, it seems that when using the GlowLayer
, i need to control which meshes need to be addIncludedOnlyMesh
yes but be careful to also add any blockers within the layer, not only the glowing meshes should be in, but also the things hiding the glow.
1 Like
const oldMesh = this._glowLayer.hasMesh;
this._glowLayer.hasMesh = (mesh: Mesh) => {
const status = oldMesh.apply(this._glowLayer, mesh);
if (!status) return status;
const materials: Material[] = [];
if (mesh.material instanceof MultiMaterial) {
materials.push(...mesh.material.getChildren());
} else {
materials.push(mesh.material);
}
for (const mtl of materials) {
if ("emissiveColor" in mtl) {
const color = mtl.emissiveColor as Color3;
if (!color.equals(Color3.Black())) {
return true;
}
}
if (mtl["emmissiveTexture"]) {
return true;
}
}
return false;
};
}
Whether to provide an injection function to determine whether the grid is allowed to emit light