Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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:
    79
    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:
    262
    Agreed and +1. This is a must have feature indeed.
     
  4. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,297
    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:
    700
    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.
     
  6. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,138
    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,127
    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,138
    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, JesOb and Prodigga like this.
  9. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,127
    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... :)
     
  10. akalegman

    akalegman

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

    ali_mohebali

    Graphics Product Management Lead, Unity Engine Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    119
    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:
    108
    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:
    427
    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:
    700
    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:
    262
    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:
    25
    Any progress on this ?
     
  17. StuwuStudio

    StuwuStudio

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

    QuinnCG

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

    LeonhardP

    Unity Technologies

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

    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:
    101
    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

    Graphics Product Management Lead, Unity Engine Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    119
    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

    Graphics Product Management Lead, Unity Engine Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    119
    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

    Graphics Product Management Lead, Unity Engine Unity Technologies

    Joined:
    Apr 8, 2020
    Posts:
    119
    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:
    17
    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:
    14
    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:
    4
    Thanks <3
     

    Attached Files:

    Prodigga likes this.
  30. vuthang

    vuthang

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

    Attached Files:

  31. unity_QJ7RazXzghZCzA

    unity_QJ7RazXzghZCzA

    Joined:
    Jul 9, 2021
    Posts:
    104
    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:
    104
    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:
    700
    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:
    139
    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:
    700
    Unity 2022 version of URP has render layers.
     
    lacas8282 likes this.
  36. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    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:
    139
    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,271
    Another unity fail. Another half baked feature.
     
  39. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    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:
    700
    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. jamppajoo1

    jamppajoo1

    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
     
    MetalInvador and DingusAUS like this.
  43. Ran-Quan

    Ran-Quan

    Joined:
    Mar 16, 2017
    Posts:
    5
    To make decal layers work properly on Quest 2, the graphics API must be set to Vulkan.

    Tested with Unity 2022.3.0.
     
  44. Eck0

    Eck0

    Joined:
    Jun 6, 2017
    Posts:
    48
    Hello, is there any news on this topic? i have no way to ignore layers on different projectors ie projector 1 ignore layer 1, projector 2 ignore layer 2
     
    tonyomendoza likes this.
  45. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    any updates?
     
  46. WalterEspinar

    WalterEspinar

    Joined:
    Aug 23, 2011
    Posts:
    84
  47. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    140
    Bump? Any ETA for decals with proper layers?
     
  48. Watsuby

    Watsuby

    Joined:
    Jun 16, 2015
    Posts:
    9
    Unity 2022.3.4f1 (LTS)
    URP 14.0.8

    Decal layers are working in editor playmode. Haven't tested with an actual build.
    https://docs.unity3d.com/Packages/c...al@14.0/manual/features/rendering-layers.html
    Link has everything in detail but below is a summary of what I did.

    You need to checkmark the "Use Rendering Layer" option in 2 separate places.
    1. Universal Render Pipeline Asset -> Lighting dropdown -> 3 dot option -> Show Additional Properties -> Use Rendering Layer
    2. Universal Renderer Data -> Decal feature dropdown -> Use Rendering Layer
    Then you need to go into Project Settings -> Graphics -> URP Global Settings -> Your render layers are here -> I replaced Light Layer 1 with my Decal Layer

    Now tweak your surface to accept decals. Your GameObject -> Mesh Renderer -> Additional Settings -> Rendering Layer Mask -> Add the light layers you want that object to accept.

    Now tweak your Decal Projector to only project onto light layers you want. Your GameObject -> URP Decal Projector -> Rendering Layers -> Select the layer you want it to project
     
    batixd, ludumez, bisewski and 2 others like this.
  49. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Good but, rendering layers are not working on OpenGL ES API nor Shader Graph supports Stencil Buffer
    No easy way to mask out decals for Android builds
     
    Last edited: Aug 23, 2023
  50. vuthang

    vuthang

    Joined:
    Mar 7, 2017
    Posts:
    54
    I have this issue when try decal near edge object. Anyone have solution to fix this?
     

    Attached Files: