Make Decal Projector Only Render On Certain Layers

I don’t have the very latest version of Unity HDRP yet, but is there a way to make the decal projector (HDRP) to only render on certain layers? For example, I only want a decal to render on the terrain/ground.

If not, is this a feature that could be worked on/implemented soon?

Thank you.

I saw this feature in HDRP 10.x. To test it I had to download whole repository (GitHub - Unity-Technologies/Graphics: Unity Graphics - Including Scriptable Render Pipeline) and added then as local package for 2020.2a with all related packages before.

1 Like

Excellent. If it’s in the works already, then that would be great.

Decal layers will be available in 10.x.x pacakge with 2020.2.
you can indeed test it in the future 2020.2b1 that should be out soon (but summer vacation delay it a bit)

1 Like

Everybody is speaking of HDRP 10 but where can I get it? It’s not released yet?

Hi, 10.x is currently only accessible from the git hub repository: GitHub - Unity-Technologies/Graphics: Unity Graphics - Including Scriptable Render Pipeline

A preview 10.x.x-preview package should be release in few weeks with 2020b1

Some extra info

i haven’t used light layers? in hdrp yet. i think there are to many reports about breaking other stuff.
but you can limt a decal to just the terrain using the stencil buffer.
make the terrain depth prepass write out a specific stencil value like 3.
then hack into the decal shader and set up its stencil values accordingly:
Ref 3
Comp Equal
works in hdrp 7 and 9

i haven’t used light layers? in hdrp yet. i think there are to many reports about breaking other stuff.
I haven’t heard about such a thing. Light layers work well and is use in several projects.
We have good example: Unity Blog

However if you have reference on issues, please report link here, thanks :slight_smile:

make the terrain depth prepass write out a specific stencil value like 3.
I would really recommend to not use an arbitrary number :slight_smile:
We have a file name HDStencilUsage.cs. There is only two bit available for custom usage in HDRPReservedBits
if you use the stencil use those one otherwise you will break an effect or an optimzation in HDRP

We haven’t use stencil for decal layers (due to too few bits available) but an extra buffer to allow to have up to 8 layers.

sure :slight_smile:
but we reset the stencil buffer in the gbuffer pass. so deferred lighting, sss, taa and here specifically ssr all work fine afaik.

Be ware that we also tag stencil during depth prepass (For forward material)

i haven’t come into this. but i will look for it. thanks for pointing this out!

Maybe I did something wrong but I tested HDRP v10.0.0-preview.27 from UPM with 2020.2a21 and I cannot make it work.

So what I did step by step.

  1. Enabled decal layers
    6249948--688788--upload_2020-8-27_15-12-35.png

  2. Added puddle decal from sample and changed layer to 1

  3. Added two cubes. One with layer Light Layer 4, one with everything.

I also tried few diffirent layers variations but still did not see any impact.

Am I doing something wrong or it is not working yet?

Well, there’s that: https://discussions.unity.com/t/789745

I am still experiencing this problem. Has anyone tested this feature?

Hi, are you sure Decal layers are enabled in both your HDRP settings and your FrameSettings? (Check in Edit → Project Settings → Default HDRP settings) and look at if Decal layer are enabled

6332904--702828--upload_2020-9-21_13-5-58.png

1 Like

Oh, thank you! I forgot that i need to check Frame Settings for enabling some features. Always great to find that I am just missing something:)