Background:
In our game (The Universim), we sometimes need to draw decals that project onto the terrain, but is rendered in front of everything. For example, when placing certain buildings, we draw a radius projection onto the terrain, but this projection is rendered over trees and everything else (note, not projected onto the trees, which of course would look very different).
Here is the working example:
We achieve this technique by using a modified version of the old “Dynamic Decals” system that used to be available on the asset store. The technique relies on settings ZTest to Always within the shader. This is all running on the classic rendering pipeline. The shader also happes to be hand-written.
More recently, we have switched to HDRP for a new project.
I’m now trying to achieve a similar overlay decal effect using HDRP Decal Projectors.
My first approach was to create a simple Shader Graph - but no joy, because there are no adjustable properties available for messing with ZTest.
I then switched over to Amplify to try to achieve the desired result. At first I was hopeful, because I could see the ZTest property exposed in the decal shader editor.
But alas, no matter what I set ZTest to, I’m unable to achieve overlay rendering. See here:
Note - we use decal layers to selectively project onto the terrain.
So finally to the questions:
- Is it possible to achieve overlay rendering like this with HDRP Decals? It is crucial NOT to project onto the obscuring object (like the box shown), but simply to DRAW OVER the obscuring object.
- If not possible with HDRP Decals, does anyone know of some other technique? Custom pass of sort? Some kind of custom projection renderer with total control over the shader code?
Any help or advice is greatly appreciated!
Thanks!