Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question URP Decal Layers?

Discussion in '2021.2 Beta' started by zhujeff, Jul 6, 2021.

  1. zhujeff

    zhujeff

    Joined:
    Mar 15, 2015
    Posts:
    1
    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?

    decalBleeding.jpg
     
    Gravesend, SunnyChow, Joshdbb and 3 others like this.
  2. Remer

    Remer

    Joined:
    Mar 24, 2013
    Posts:
    76
    HDRP have it, but I don't know if they will implement it also inside the URP. Obviously it's a must have feature...
     
  3. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    222
    Agreed and +1. This is a must have feature indeed.
     
  4. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,013
    It's a complex issue to solve, for HDRP they had to resort to reusing the first 4 light layers iirc.

    I agree it's important, but I wouldn't expect this to be implemented over night ;)

    Haven't tried this myself, but it may be possible to use the Render Objects render feature to render a specific layer on top of all the decals.
     
    tarsss likes this.
  5. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    663
    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.
     
    Maskeowl, faraguay, lacas8282 and 8 others like this.
  6. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,064
    Hi everybody,

    This is not supported yet but the team is planning to add this. I don't have an ETA to share at this point.
     
  7. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,105
    Thanks for update Leonhard!

    Can we have an entry for Decal Layers on the URP roadmap

    https://portal.productboard.com/uni...sual-effects/tabs/3-universal-render-pipeline

    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
     
    Last edited: Jul 22, 2021
    mariandev likes this.
  8. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,064
    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.

    https://docs.unity3d.com/Packages/c...ures/how-to-custom-effect-render-objects.html
     
    Gravesend, Jes28 and Prodigga like this.
  9. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,105
    Request submitted..

    I tried your suggestion and it is indeed possible. So we've got a workaround for now.

    upload_2021-7-23_10-46-11.png

    upload_2021-7-23_10-47-0.png

    It was nice to be able to do this without any scripting! Now if only we could filter what is rendered by Rendering Layers and not standard Layers... :)
     
    lacas8282, neputanu, vuthang and 8 others like this.
  10. akalegman

    akalegman

    Joined:
    Feb 23, 2019
    Posts:
    26
    Any update on the progress for this @LeonhardP?
     
  11. ali_mohebali

    ali_mohebali

    Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    114
    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.
     
    reinfeldx, adamgolden and LeonhardP like this.
  12. beevik_

    beevik_

    Joined:
    Sep 27, 2020
    Posts:
    80
    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'.
     
    Last edited: Nov 2, 2021
    BlipB and p3king like this.
  13. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    392
    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.
     
    Last edited: Feb 9, 2022
    jiyarza likes this.
  14. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    663
    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.
     
  15. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    226
    killer feature to use decal for rpg/rts-style worldspace GUI, which affect decoration, but not gamplay-active gameObjects
     
  16. snowandball

    snowandball

    Joined:
    Apr 11, 2019
    Posts:
    21
    Any progress on this ?
     
  17. StuwuStudio

    StuwuStudio

    Joined:
    Feb 4, 2015
    Posts:
    150
    Any progress on this ?
     
  18. QuinnCG

    QuinnCG

    Joined:
    Jan 30, 2020
    Posts:
    4
    But really,
    Any progress on this ?
     
  19. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,064
    Hi,

    It's actively being worked on and the plan is to have something in time for 2022.2. However, things might still change so this is not guaranteed.
     
  20. Liderangel

    Liderangel

    Joined:
    Jul 8, 2018
    Posts:
    95

    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.
     
  21. Liderangel

    Liderangel

    Joined:
    Jul 8, 2018
    Posts:
    95
    Gravesend likes this.
  22. Hinkle

    Hinkle

    Joined:
    Sep 10, 2013
    Posts:
    8
    Thanks! This setup is indeed a nice workaround. I had to set the decal technique to 'screen space' to get it to work, but it does the job.
     
  23. ali_mohebali

    ali_mohebali

    Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    114
    BTW this has already landed in 22.2 latest alpha
     
    jiyarza, psuong and adamgolden like this.
  24. SweetBro

    SweetBro

    Joined:
    Jan 14, 2013
    Posts:
    69
    Are there any plans for the LTS to get support for this?
     
  25. ali_mohebali

    ali_mohebali

    Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    114
    The standard process is that we don't backport new features, but let me check the effort needed for this since this is essential for some of the users to efficiently utilize Decals. I will get back.
     
  26. ali_mohebali

    ali_mohebali

    Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    114
    Unfortunately, we won't be able to backport this as this workflow is tied to the new rendering layers feature in URP that has introduced core changes.
     
  27. TreyH

    TreyH

    Joined:
    Feb 6, 2014
    Posts:
    8
    Are there any less-optimal implementation suggestions for folks working with 2021 LTS atm? The official solution isn't going to be compatible, but sticking decals onto flat surfaces with thin projectors has always been a severe limitation of their use etc.

    The Lux URP package has decal shaders that can be adjusted with the stencil buffer, but an official solution with layers was really anticipated after the absence of an official decal solution in LWRP/URP for years since their release.
     
  28. Deornoth

    Deornoth

    Joined:
    Oct 8, 2021
    Posts:
    10
    I attempted the workaround above (Render Objects - see Prodigga's post above); however, I had this strange effect of the decal correctly being projected onto the terrain; however, it was still visible in front of objects on top of it:


    upload_2022-7-18_14-1-19.png

    I then changed my render object (ignore decal layer) to : "AfterRenderingPrepasses" and this seems to work:


    upload_2022-7-18_14-3-18.png

    However, as I will be putting almost all objects (characters, enemies, probs) into this layer, I'm worried about other side effects.


    Anyone know when this will be supported properly in the URP?
     

    Attached Files:

  29. NovaesDev

    NovaesDev

    Joined:
    Jul 22, 2018
    Posts:
    1
    Thanks <3
     

    Attached Files:

    Prodigga likes this.
  30. vuthang

    vuthang

    Joined:
    Mar 7, 2017
    Posts:
    29
    Thank for this. I update for decal only "Ground" layer
     

    Attached Files:

  31. unity_QJ7RazXzghZCzA

    unity_QJ7RazXzghZCzA

    Joined:
    Jul 9, 2021
    Posts:
    42
    Why did you bring to us this very basic feature for any modern engine in 2022 without even layer-based filters? Do you at least imagine by the way that layers is not only required option for us? We also need object-based filter. For example to render blood splats only on specific character(that was hit by the bullet, sword etc.).
    So what the hell with you, Unity?
     
    CYING7 and derkoi like this.
  32. unity_QJ7RazXzghZCzA

    unity_QJ7RazXzghZCzA

    Joined:
    Jul 9, 2021
    Posts:
    42
    Also how do we should fix "floating" blood decals on our skinned mesh renderers? When skin of character stretch decals should stretch with it and shrink too, but now it just like float above it. Why you NEVER notice such basic cases while implementing your features?
     
    lacas8282 likes this.
  33. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    663
    URP decals seem to have some aliasing issues...This is in URP 14 with or without decal layers.
    upload_2023-1-3_21-48-21.png

    EDIT- I played around with what could be causing this and determined that it happens only when the decal texture has mipmapping enabled.
     
    Last edited: Jan 4, 2023
  34. lacas8282

    lacas8282

    Joined:
    Apr 25, 2015
    Posts:
    81
    Any news in this? I am using unity 2021, and I need layers on decals on URP
     
  35. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    663
    Unity 2022 version of URP has render layers.
     
    lacas8282 likes this.
  36. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    431
    note they forgot to add _lightLayerMask inside ForwardLights.cs
    this was only added by unity after 2022.2.4 api 14.0.5 and higher

    upload_2023-2-7_10-23-33.png
     
    lacas8282 likes this.
  37. lacas8282

    lacas8282

    Joined:
    Apr 25, 2015
    Posts:
    81
    Good but I need it in 2021.3.16f1 or up. I don't want my project broke
     
  38. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,223
    Another unity fail. Another half baked feature.
     
  39. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    663
    It's not that bad with the render layers. Way better than the asset store options for decals for the built-in render pipeline, which never worked all that well. Only thing I see missing is an Unlit Decal option.
     
  40. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    663
    Here is another example of the fringing caused by the decal rendering layers. I submitted a bug report but haven't gotten a case number yet.
    upload_2023-3-18_11-48-44.png
     
  41. Maskeowl

    Maskeowl

    Joined:
    Apr 24, 2021
    Posts:
    8
    hey howeru did you know about sprite rendering on a mesh for a blood effet (2d) on a box or floor or wall u know and cloths of who get shoot to drop blood its voxely topdown game i suppose can you help with that i cant find any way to mask sprte work with meshes
     
  42. JanJulin

    JanJulin

    Joined:
    Mar 17, 2020
    Posts:
    2
    Hi! I'm having an issue related to this. Decal layering works just fine on the editor, but not on Android build on Oculus Quest 2. PC build seems to work correctly.


    DecalEditor.png
    Decals on editor playmode, working correctly. Floor is set to render decal light layer and cube is not.

    DecalBuild.jpg
    Decals on build, not respecting light layers.

    "Use rendering Layers" option on URP asset did not seem to affect anything. I have only one render pipeline asset and quality level, so they should not affect things.

    Unity 2022.2.20
    URP 14.0.7
     
    DingusAUS likes this.