Decals: How do they work?


How the heck do they work.

Here’s what I’m doing:

		var prim = new h3d.prim.Cube();

		var tex =;
		var mat = h3d.mat.Material.create(tex);

		var shader = Defaults.makeVolumeDecal( prim.getBounds() );
		mat.mainPass.addShader( shader );

		var obj1 = new Mesh(prim, mat, s3d);

This yields a pretty broken result. If you look at it straight on, it renders a few angle-dependent texels at the source mesh’s height (ie, not projected on the intersecting target). Once you move away from that dead-on angle, the whole thing just vanishes.

I feel like I’m probably doing something very wrong, but can’t find any examples of Decal being used either in the code or online.


Yes this is supposed to work but it seems there was some kind of regression in the standard API. Decals still works (we use them in production) but I have to look exactly what’s wrong with the default setup.