Decals

How to Use Decals

These are usually used to add details on meshes (bullets hole, local details, etc...), a decal is a mesh produced from a subset of a previous one with a small offset in order to appear on top of it.

Creation Example :

var decal = BABYLON.MeshBuilder.CreateDecal("decal", mesh, {position: myPos}, scene);

Don't forget the mesh parameter; this is the mesh to which the decal is applied.

Properties, all optional :

propertyvaluedefault value
property
position
value
(Vector3) position of the decal (World coordinates)
default value
(0, 0, 0)
property
normal
value
(Vector3) the normal of the mesh where the decal is applied onto (World coordinates)
default value
Vector3.Up
property
size
value
(Vector3) the x, y, z sizes of the decal
default value
(1, 1, 1)
property
angle
value
(number) the angle to rotate the decal
default value
0

Simple Example of Decals click on the cat.

Further reading