So here I am again with a new issue with DecalGeometry.
I need to make decals from meshes with a transparent material, and moving.
For some reason, the decals sometimes become transparent when made from a moving mesh with a transparent material.
Not systematically though, and not for rotation.
I changed the example to show the problem here : https://felixmariotto.github.io/decal_bug_transparent
Try creating decals before ticking the box to wave the model position : no problem when the material becomes transparent.
Then tick the box “shake_model” : decals that you add subsequently MAY disappear when the mesh from which it was created disappear.
I also show the issue in the following video :
I assume it’s related to the decal material’s parameters, as its creator indicated on the GitHub page of DecalGeometry that
The decal material can be any material, just make sure to have this attributes enabled:
var decalMaterial = new THREE.MeshNormalMaterial( {
transparent: true,
depthTest: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -4,
});
Of course I use these parameters, though I don’t really know what they do but for ‘transparent’.