HDRP Shader Graph material being incorrectly rendered in front of other materials

I have a game object with a “dissolve” material, implemented via an HDRP Shader Graph, that is being incorrectly rendered in front of other game objects. The dissolve effect occurs when the item spawns or is destroyed. The game object is a capsule presently, which is just a stand in for a more complicated mesh I haven’t yet developed.

The two items which are being rendered behind the capsule are…

  • a laser beam implemented via a Line Renderer with its own Shader Graph based material
  • a spark effect implemented via a VFX Graph, the effect component being attached to an empty which is housed in a prefab

I’ve attached two pictures illustrating the problem. Any idea why this happening and what needs to be changed to fix it?

9066283--1254139--shader.jpg 9066283--1254142--vfx.jpg

So the image on the left shows the capsule rendered over the background effects, which seems correct. The image on the right is trickier to make out - it seems the laser is rendered behind the capsule, and the capsule is transparent?

In both cases, the object is in fact in front of the capsule. The beam image doesn’t show that well due to the perspective. The sparks are on a game object on the near side of the capsule.

Solved.

  • The sparks were showing behind due to the capsule’s shader being transparent.
  • The beam problem is due to using the eye vector as the source of the aim raycast. The beam line renderer is passing through the capsule mesh. The fix is to raycast from the weapon muzzle.