Minimum distance for decal placement

Hello,
What is the minimum distance for decal placement? In other words, when I call
let myDecal = BABYLON.MeshBuilder.CreateDecal(“decal”, mesh, {position: pos, normal: nrm, size: decalSize});

How far can pos be from mesh and this method can still succeed?
Does that matter if pos is above or below of mesh 's surface?
thank you,
David

There’s no z clipping of the projector, so pos can be as far as you want.

For eg:

You can see that the projector is well in front of the meshes and the decal is still projected.

For some reason, I cannot place a decal in the example below unless I am on the surface

I thought it is because of the distance to surface requirement
Any suggestions why?

Please let me know if this example is a separate issue and it should be moved to a different topic

thank you

My mistake, my PG is misleading, the point passed to the decal function is still near the surface, it’s only the visual representation of the projector which has been moved!

So, the decal size must be chosen so that the box it defines intersects the surface on which you want to project the decal:

I draw an approximate box in which the decal will be projected (it’s approximate because it does not take into account the normal): you can see that the first one does intersect the plane and that the decal is visible, but the second one does not.

You need to extend the box in the z direction so that it intersects the plane :

2 Likes

@Evgeni_Popov Thank you. That makes sense