Being able to exclude meshes from being affected by decals is very important, especially if the targeted decal surface isn’t flat. Is there a way to do that currently in URP and if not, is it a planned feature?
Example below: is it possible to project a decal ONLY onto the terrain?
Do URP decals really not have a way to filter which objects receive decals? Seriously? Who thought that would be a good idea? It’s not a very useful system if it doesn’t have this feature. If you were designing a decal system, and thinking of what features it should have, it would say “filter which surfaces it can project on” would be on top of the list.
To give us some confidence? Outside of small decals ie blood splats and bullet holes I am not sure what more you could do with this?
I was imagining using for drop/blob shadows, large painted decals on grounds (road symbols etc) or on walls (spray paint/graffiti). These use cases are not possible at all without some way to filter?
Ofcourse this release is better than nothing - it is nice to get an early preview of how the system will work. I would love to see something on the road map about this!
Edit: can we opt out of receiving decals for meshes? Our hero characters renderers can opt out of them and we could get by for now without Layers. I should download and give it a try
I’ve notified the team about it and they will look into it. It would also be helpful if you could submit a request for it on the roadmap page.
It is possible to draw the characters after decals, for example by adding them to a specific layer and rendering them with the RenderObjects feature after sky/before transparent.
It is road mapped to be added. It’s also on our public roadmap here if you want to provide feedback on specific use cases you might have so we can have visibility to address them.
With the decal renderer technique of ‘DBuffer’ (or ‘Automatic’), I wasn’t able to get this to work unless I also set the new RenderObjects feature’s event to ‘AfterRenderingPrePasses’. If I used a technique of ‘Screen Space’, then I could set the feature’s event to ‘AfterRenderingSkyBox’.
I found a much simpler work around for this.
If you only want the decals to appear on the floor geometry, but ignore all the geometry above the floor (architecture and characters), all you have to do is change the render queue of the materials.
The render queue determines when the material is going to be drawn by the GPU.
So, say your decal material has a queue of 1800. Every material with a queue below that value will be rendered before. So the decals will show on top of those materials. So, you put everything you want to be affected by decals (all your floor and floor details) with materials with a queue lower than 1800.
Then, everything with a material who’s render queue is above that value (1802, 1803, etc.) will render on top, and so it’ll ignore the decals. So, you put your characters, furniture, arquitecture, etc. with a highter queue than 1800.
You can set the render queue of any material in the inspector. If you don’t see it, you may have to the upper right corner of the inspector, click on the three dots and choose “Debug”. Then it’ll show, and you can later switch back to normal.
Wouldn’t changing the rendering order mess up the optimizations that GPU’s have when rendering front to back? With front to back, if a fragment would not be visible because something is already rendered in front of it, the GPU can discard it. By doing it the opposite way, you no longer have that optimization. Whether that way is faster than whatever decal layer method Unity is implementing is something that will have to be seen.
Is there a workaround for this issue until that feature is implemented? Because in most situations you wouldn’t want a decal to affect dynamic objects, only static ones like walls and so on.