Out of curiosity, I've tried the decals branch. It's really nice overall, but I found two bugs:

1. If I only use emissive decals, not diffuse/normal decals, I would get the following shader compilation error:
...\HlmsDebug\537035522PixelShader_ps.hlsl(800,42-70): error X4000: variable 'decalMask' used without having been completely initialized

Then it works most of the time. However, sometimes part of the decals just "disappear". Looks like a bug in Forward Cluster intersection code? Anyway, I've simplified my use-case and modified the sample. When you hit F4, some parts of the spheres are not covered by the decal. Here is the diff:

As you can see the decal is working as intended, it's just that either you misunderstood how it works, or you thought the orientation you thought you set is different from the actual orientation.

Thanks! It looks like I misunderstood how it works, and I still don't know... Could you briefly explain it? Also, in my real use case, the disappearing part is view-dependent. The area of influence is a long and narrow vertical cube, which intersects a big vertical plane, and I want to project the decal onto the plane. When I go approaching the vertical plane, sometimes a part of the decal disappeared, but when I move the camera closer/farther, the SAME part appear again. Is that possible?

Thanks! It looks like I misunderstood how it works, and I still don't know... Could you briefly explain it?

Decals are 2D in nature, like a sticker. Their natural representation is being a plane in the XZ space, which can be rotated in XYZ space.

However a 2D plane has infinitely small thickness. And we also need a way to tell the rendering engine where the sticker is pasted onto.
That's where the 3rd component enters into action:

This is the decal, acting like a sticker on the floor:

When we activate the debug visualization, we see the sticker was placed slightly above the ground (this is not relevant) and it has depth:

Everything that is inside that cube will be affected by the "sticker" and now's when the sticker analogy begins to fall part, because even if it's from behind the spheres get affected:

With debug visualizer off:

If we rotate the sticker, we'll see it gets "plastered" into the objects that are within the cube, in the direction of the arrows:

With debug visualizer off:

The sticker analogy is not entirely correct: With a sticker in real life, if you paste that sticker into a tube, the sticker will bend and envelop the tube.
With decals, the texture gets projected into the tube, giving you a distorted image. See slide 60 "Side Stretching" of the Warhammer's Screen Space Decals presentation.

Also, in my real use case, the disappearing part is view-dependent. The area of influence is a long and narrow vertical cube, which intersects a big vertical plane, and I want to project the decal onto the plane.

Mmm... while making the photos above for your example, I noticed this bug. Requires further investigation.

Decals are 2D in nature, like a sticker. Their natural representation is being a plane in the XZ space, which can be rotated in XYZ space.

So when in its natural representation, it's only projecting from top of the cube to the bottom of the cube?

Everything that is inside that cube will be affected by the "sticker" and now's when the sticker analogy begins to fall part, because even if it's from behind the spheres get affected:

This is where I'm confused. By setting the postion/orientation/scale of the decal's parent scene node, are we manupulating the "area of influence cube"? If so, how is the "sticker" determined? Just the bottom side of the cube (before rotating) with some depth?

If we rotate the sticker, we'll see it gets "plastered" into the objects that are within the cube, in the direction of the arrows:

In the picture, it looks like only the sticker is rotated, but the cube is not. How is it possible???

Everything that is inside that cube will be affected by the "sticker" and now's when the sticker analogy begins to fall part, because even if it's from behind the spheres get affected:

This is where I'm confused. By setting the postion/orientation/scale of the decal's parent scene node, are we manupulating the "area of influence cube"? If so, how is the "sticker" determined? Just the bottom side of the cube (before rotating) with some depth?

Perhaps a different way of looking at it is: Forget about stickers, and think about a rectangular flashlight with a texture on it. Everything hit by the flashlight will have the texture on it.... even if it's facing away from the light (i.e. normals are ignored)

In the first video, the projection deforms as the objects stop being aligned with the decal.
In the second video, I am using a very depth decal so that it affects many objects. Note that going from the front or from behind the texture is the same.

Note that we can customize the shader code further so that the object's normal is taken into account and prevent the decal from showing if it's receiving it "from behind". That would be a 5 minute tweak to the shader code.

Note that we can customize the shader code further so that the object's normal is taken into account and prevent the decal from showing if it's receiving it "from behind". That would be a 5 minute tweak to the shader code.

That would be helpful (maybe a switch?). Usually I don't want other 4 sides except top/bottom of the "area of influece" cube to receive decals. These are not receiving "from behind", but perpendicular.

It turns out that sometimes dot is negative, causing artifacts around the edges of the decals. I added four clamp(dot(...), 0.0f, 1.0f) around each of the four dot calls and it solves the problem. I've only tested DX11, though.