Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Feature Request Make Decal Projector Only Render On Certain Layers

Discussion in 'High Definition Render Pipeline' started by Velo222, Jul 17, 2020.

  1. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    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.
     
  2. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Velo222 likes this.
  3. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Excellent. If it's in the works already, then that would be great.
     
  4. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    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)
     
    Velo222 likes this.
  5. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Everybody is speaking of HDRP 10 but where can I get it? It's not released yet?
     
  6. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,909
    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
     
  8. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    >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: https://blogs.unity3d.com/2020/01/0...-render-pipeline-for-high-end-visualizations/

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

    >make the terrain depth prepass write out a specific stencil value like 3.
    I would really recommend to not use an arbitrary number :)
    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.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,909
    sure :)
    but we reset the stencil buffer in the gbuffer pass. so deferred lighting, sss, taa and here specifically ssr all work fine afaik.
     
  10. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    Be ware that we also tag stencil during depth prepass (For forward material)
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,909
    i haven't come into this. but i will look for it. thanks for pointing this out!
     
  12. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    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
    upload_2020-8-27_15-12-35.png

    2. Added puddle decal from sample and changed layer to 1
    upload_2020-8-27_15-13-23.png

    3. Added two cubes. One with layer Light Layer 4, one with everything.
    upload_2020-8-27_15-14-53.png

    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?
     

    Attached Files:

  13. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    440
    Well, there's that: https://forum.unity.com/threads/lightlayers-with-instanced-rendering.885772/
     
  14. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    I am still experiencing this problem. Has anyone tested this feature?
     
  15. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    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
     
  16. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
  17. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    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:)