Search Unity

URP Opacity and shadows.. is this even supported anymore?

Discussion in 'Universal Render Pipeline' started by Slashbot64, Jan 25, 2021.

  1. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    A pretty basic shader I have working in built in... I just can't find a way to achieve the same thing in URP now.. is it even possible..seriously disappointing if not, the closet I can get with URP is a cutout alpha, it is ugly :(

    ...Built in... URP can't do this..lame
     
    Last edited: Dec 14, 2021
    Noisecrime and MP-ul like this.
  2. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Maybe someone at unity graphics team can explain why something that worked just fine in built in, no longer works in URP..

    Discord_zwqdUhZI6nt.png
    unknown.png
     
    MP-ul, devreaction and PutridEx like this.
  3. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Already into April.. going on 3months since posted....
     
  4. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Well it's a been a whole year.. is URP still not going to support this built in feature?
     
  5. Kinami37

    Kinami37

    Joined:
    Jun 12, 2016
    Posts:
    17
    im curious too, any update on this? dear unity devs
     
  6. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    726
    Last I checked, built-in did not support semi transparent shadows either. The built-in workaround is they would actually just dither based on the alpha, and do a clip() on the light's shadow pass shader. Then if you had soft shadow sampling enabled, this would cover up the dither and it would look semi transparent.

    Looking over the URP source code, it looks like they no longer do this dither method. You could probably override the shadow pass and add it in yourself, though.
     
  7. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    All I know is that I can get working opacity and shadows in amplify's better shader graph.. while using Built in renderer.

    Yet while using URP using amplify or unity not so good shader graph I can't...

    It's good to hear from someone who has taken a look at the code to see what is going on.. Why Unity dev's can't be bothered to say why this doesn't work in URP or when it ever will I have no idea... would be good if they fixed it.

    If I knew how to do that I would, I'm really not into things that technically.. why else would be using shader graphs.
     
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Why not ask Amplify? They're an open crowd filled with smart people. I mention them since ASE still supports URP.
     
  9. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    :rolleyes: I did over a year ago.. this post is what they found.. screenshots

     
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Thing is this visual is easily obtained in other ways. Have you tried asking how to do the same effect in the shader forum? It seems to me that you either log a bug, or you use a different shader / technique.
     
  11. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    I mean if someone showed me how achieve that opacity effect like shown in the animation above ie via shader graph for URP.. I'd be happy.. I find it very odd that despite this post being up for a over year no one using URP does anything with opacity and hasn't noticed this doesn't work like it did with built in... aside from the odd couple of posts I've seen of similar reported issues and complete dead silence from Unity as to it being supported in future or not or will be fixed... or it does work and no one can be bothered to say it does ‍♂️

    Half the reason I never bothered filing a bug is because.. is it a bug? ...

    I lean more to it's not supported and URP is some sort of low end mobile renderer and no one even bothers touching URP for this stuff..All of a bit of disappointing to me whatever the reasons.
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Seems like you've decided what things are.
     
  13. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    Seems like Unity has show us "what things are" Just look at their github and check updates to URP vs HDRP. It has been ages.

    Point is, they want to turn a profit. They do this by buying tools like Weta Digital, and providing them as services. They also want people using these services to use HDRP, so they are 100% focused on that. They just aren't honest about it.

    In other words, Unity has chosen, since going public, to focus on Film and other media at the expense of games.
    And they DON'T CARE!

    These are the facts. So, while some may chose to lecture frustrated devs in the forum for problems that Unity has created for themselves, the truth is - this is on Unity (executives), and Unity alone.

    Edit: To clarify, this isn't directed at hippocoder (who is typically very helpful), or anyone else on this thread. Just generally from my experience in these forums.
     
    Last edited: May 1, 2022
    AGregori, MP-ul and hippocoder like this.
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Heh I get how you feel, I have felt this way a few times. I think a lot of the issues at Unity are becoming somewhat unblocked. It's not that they wanted to annoy you, but couldn't move fast. Structural changes in how source code is committed, staff moving around and plain waiting for feature A to land before B has all made it seem like it's taken too long.

    (It has taken too long) - but it is changing as far as I can see. Forward+ is a pretty wild improvement plus this lot: https://unity.com/roadmap/unity-platform/rendering-visual-effects

    I know, I know. It's a long time :)
     
  15. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    726
    I feel ya. I've considered setting up a browser extension to append the unity stock price to every reply I make to a unity developer. Maybe it'll get the point across that they're not focusing on the right things, most of the time, nowadays.
     
  16. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    https://docs.unity3d.com/Packages/c...l/universalrp-builtin-feature-comparison.html

    What part of this feature table from Built In and URP.. isn't being covered by URP to support this feature which still remains broken in URP ...it's both a shadow and alpha transparency issue to me...

    Would just be nice to have a clear answer as to what Unity will actually intend support in URP in the future as this doesn't seem to be covered in the roadmap either.... https://unity.com/roadmap/unity-platform/rendering-visual-effects
     
  17. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I've ported built-in style dithering to URP in past. Basically everything what @funkyCoty said applies, this was how they did semitransparent shadows on built-in.

    Here's how it looks like without soft shadow filtering:


    You can't do it on SG alone since you need to do customized shadow caster pass for it. You might be able to do this with ASE if you are willing to roll out your own template for this (or modify existing URP template they have). How I did it myself was that I just added the dithering function to URP's own SG ShadowCasterPass.hlsl:
    Code (csharp):
    1. half dither(half2 uv, half alpha)
    2. {
    3.     const half DITHER_THRESHOLDS[16] =
    4.     {
    5.         1.0 / 17.0,  9.0 / 17.0,  3.0 / 17.0, 11.0 / 17.0,
    6.         13.0 / 17.0,  5.0 / 17.0, 15.0 / 17.0,  7.0 / 17.0,
    7.         4.0 / 17.0, 12.0 / 17.0,  2.0 / 17.0, 10.0 / 17.0,
    8.         16.0 / 17.0,  8.0 / 17.0, 14.0 / 17.0,  6.0 / 17.0
    9.     };
    10.     uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
    11.     return alpha - DITHER_THRESHOLDS[index];
    12. }
    and in it's frag function change the place with #if _ALPHATEST_ON to:
    Code (csharp):
    1.     #if _ALPHATEST_ON
    2.         clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold);
    3.     #endif
    4.     #if _DITHER_SHADOWS
    5.         clip(dither(unpacked.positionCS.xy, surfaceDescription.Alpha) + 0.001);
    6.     #endif
    7.  
    You then need to add Dither Shadows keyword boolean to your shader graph so you can toggle the feat on and off.

    This is how it looks then in 2022.2's URP with High shadow filtering enabled (High is using Tent 7x7, older URP's Tent 5x5 still can leave the dithering effect visible at some alpha values):
    https://www.dropbox.com/s/gbvaewijc3obh6f/urp-dithered-shadows.mp4?dl=0
     
    Last edited: Jul 4, 2022
    Meceka likes this.
  18. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Well thanks, it's a bit of a hack and not sure how that would work with the current ASE shader I had... maybe @JasonBooth would implement in the BetterLit.
     
  19. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
  20. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    well ok simple

    URP you just use the URP templates

    under the Cast Shadow check box find the option for Use Shadow Opacity and it will open the port for Alpha Clip Threshold Shadow upload_2022-10-1_14-22-15.png
     
  21. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Did you even look at the first post? have you tied to get those sorts of shadows using that option you pictured?
     
  22. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    sorry my bad yes i agree its not good
     
  23. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Any updates on this?
     
  24. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    Hi, it's possible to implement dithered transparent shadows in URP or HDRP shader graph. You can refer to this thread (doing the opposite thing).

    I'm also looking forward to seeing improvements of URP shadows.
     
  25. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Yeah I'm not touching dithered shadows, it's a disgustingly ugly look to be replicating just to achieve the style of some 90's game, when Unity had smooth transparent shadows working in Built-In... Like I'm waiting for them to actually get URP on par with Built In.. it's really disappointing how long this is taking, frankly wish they had never done this whole HDRP/URP nonsense just really been :(all around. Then there is UE5 with its single render pipeline for all platforms
     
    Last edited: May 23, 2023
    wwWwwwW1 likes this.
  26. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    Dithered transparent shadow works pretty well with high quality shadow filtering in URP 14 (or above).

    You can give it a try when using 2022.2:
    DitheredTransparentShadow.jpg
     
  27. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    bumping this after 3years... as I've yet to find a way to do this with URP shadergraph.. nothing but ugly dithered alpha and dithered shadows... built in still proving to be better
     
  28. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    I think funkyCoty has already mentioned that the shadows transparency in BiRP also uses dithering.

    If you need to do dithering in shader graph for the shadows pass only, you may refer to this thread.

    BTW, you can still use BiRP if you feel that switching to URP (or HDRP) won't help developing the project.
     
  29. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    yes but the actual color/albedo surface of a transparent area on the material isn't some ugly dithered look in BIRP which doesn't seem possible with URP shadergraph, you either have ugly dither dots on the surface of the material and get the shadows at least looking somewhat more realistic than just fully opaque shadows with dithering.. or you go with transparent alpha or whatever the combination of settings are and then you can sort of get albedo texture or color alpha that looks correct without any ugly dither dots.. except then you don't get any shadows casted that represent a realistic example of light shining though those transparent areas of the material surface.. .instead you just get fully opaque despite the surface areas being transparent.:confused:

    So for 2024 URP it seems like this is the best you get out of Unity is worse than BIRP

    "If you need to do dithering in shader graph for the shadows pass only, you may refer to this thread."

    that is for having just the surface using dithering and the shadow is just full opaque. kinda ugly and unrealistic no?... not at all what I'm looking for. I'd accept dithering for the shadows.. but to have dithering on the surface to represent the alpha/opacity is just rubbish... like URP is just steps back and extra pain for developers, while it gets development attention in other areas that make BIRP dated in performance ..Years wasted on SRP pipelines and all these constant breaking update of third party assets and upheavels for what.. its barely paying off imo, this one issue I find really annoying with URP doesn't look like it will ever be adequately resolved.

    Is this an issue HDRP? who knows I'm sure barely many even use HDRP on the overall usage numbers yet it gets the most attention.

    Doubt will ever see it handle color shadows either https://wickedengine.net/2018/01/18/easy-transparent-shadow-maps/
     
    Last edited: Mar 23, 2024
  30. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Maybe some setting combination or custom shader input I'm missing to achieve something that looks better than this in URP.... explorer_eTd2aauCrC.png
     
  31. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    You can set the alpha to 1 (instead of dither value) when the current shader graph pass is not for shadow casting.

    Screenshot in the thread I mentioned before:


    It mentioned a way to tell if the current shader graph pass is for shadow casting.

    That thread:
    Disable dithering when "IsSC" is true.

    To support shadow transparency, you need:
    Enable dithering only when "IsSC" is true.
     
  32. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    Unity_MoqY3KPkoJ.png You don't seem to get what I'm saying... I don't want the shadow to be a solid bock of color of whatever shape the 3d model is... I want that to be atleast a dithered shadow. While the surface of the material should adhere to the albedo alpha or color opacity... without being dithered... URP just fails at both... the far left cube is an AutodeskInteractiveTransparent shader that I found actually comes close to being like the original BIRP standard default shader with Rendering on 'Fade' (this option doesn't exit in URP for default shader)... the shadows suck of course but atleast the image transparency is correct, its not dithered and it doesn't have a weird white edge color on the borders of transparent areas. Unity_HZmCxKEaio.png

    Below BIRP.... Default shader on the left with ball using 'Fade' rendering...a default shader...back when things like this just worked, the shadow is dithered with smooth shadows on, and the image alpha is correct.

    The right object is a custom shader in birp... again this stuff works.. in URP how to achieve this? why is it seemingly not possible?
    Unity_vPp55eIUFf.png
     
  33. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    Well, I already said how to achieve that. You need to apply dither only for the shadow caster pass.

    It's not that convenient compared to standard shader since people need to create their own shader graph.
    ShadowTransparency.jpg
     
  34. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    You can avoid it by unchecking the "Preserve Specular Lighting". This is useful when creating materials like glass.
    PreserveSpecularLighting.jpg
     
    Slashbot64 likes this.
  35. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    where and how? none of this looks like its documentated anywhere and it all just looks under developed and broken to me.
     
  36. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    Apply dithering only when "IsShadowCasterPass" returns true.
    ShaderGraphURP.jpg

    Code (CSharp):
    1. isShadowCasterPass = false;
    2. #if defined (UNITY_PASS_SHADOWCASTER)
    3.     isShadowCasterPass = true;
    4. #endif
     
  37. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    So headache with URP still ain't finished, I did manage to get alpha surface textures/colors working without any dithering, which is a improvement along with dithered shadows where things look correct... only with exceptions... again back to BIRP just working better, where at the top of this post I have draw front and back faces on and things are drawn correctly with correct shadows and surface ordering textures etc you see past the front facing surfaces to the back surfaces with correct alpha and no hidden textures etc.., the issue on URP is there is no combination where you can have draw front and back faces on, where it doesn't mess the order of the texture or block it when it shouldn't.. I can't explain it, no combination or Depth Write/Depth Test will get a correct rendering of when you want Render Face Both on...

    What is missing still no idea... sick of it, also find it ironic that Unity have put out node example pack to help with URP, and not single example of transparency/alpha handling or this special define of UNITY_PASS_SHADOWCASTER Unity_PLsATddEZQ.png Unity_kyaZuK3O3m.png
     
  38. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    765
    I'm just helping you (and other people) with this problem (apply dithering on shadows only).

    It seems that you're using ASE shaders. Are you sure that there's no transparency sorting + two-sided issue in Standard shader?

    My suggestion is that if URP doesn't make your development easier (help you achieve things that are impossible in BiRP), why not stay on BiRP at least for now?
     
  39. Slashbot64

    Slashbot64

    Joined:
    Jun 15, 2020
    Posts:
    321
    hmm yeah there is actually...in that image above, its been a while since I checked ASE BIRP shader above.. still the point remains that it's an issue with URP and that is meant to be better and the way forward now right?

    Staying on BIRP has it's advantages in less asset store package shader hassles, clearly its not getting any further improvements though.