Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

URP soft shadows for 2D renderer?

Discussion in '2D' started by alesimula, Feb 13, 2020.

  1. alesimula

    alesimula

    Joined:
    Mar 27, 2019
    Posts:
    7
    Hello, I want to obtain a "soft shadow" effect (example on the right image) for a 2D game instead of the default one (left image).

    I enabled "soft shadows" in the UniversalRenderPipelineAsset settings but it does not seem to affect 2D games at all, is there a way (or a plugin) to be able to do this?

     
  2. waniakay

    waniakay

    Joined:
    Feb 26, 2020
    Posts:
    2
    Droper will be solve your problem...!
     
  3. alesimula

    alesimula

    Joined:
    Mar 27, 2019
    Posts:
    7
    What? can you elaborate?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  5. NainBR

    NainBR

    Joined:
    Apr 13, 2020
    Posts:
    2
    I really would love to understand how to implement those shadows too. Since the Shadow Caster 2d only allow to cast a a single shadow type, and each light only allow to have a single behavior of Shadow Intensity.
     
    Charlivi likes this.
  6. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    I second this! Could really use some soft shadows with the 2D Lighting system. Lights with a gradual falloff look really weird when they cast really sharp shadows.
    sharp_shadow.PNG
     
    Charlivi, UnitedWolf and Holoday like this.
  7. Zyneak

    Zyneak

    Joined:
    Aug 11, 2013
    Posts:
    1
    I'd like to bump this. My team is having the same issue with 2D shadows in URP.
     
    Charlivi likes this.
  8. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    Bump. Unity, please add this!
     
    Charlivi likes this.
  9. ShadowLairGames

    ShadowLairGames

    Joined:
    Jan 17, 2019
    Posts:
    45
    Another bump for the neccessity of soft shadows.
    upload_2020-9-25_17-9-35.png
     
  10. Carocrazy132

    Carocrazy132

    Joined:
    Aug 16, 2015
    Posts:
    15
    Another vote for needing soft shadows
     
  11. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    Can someone tell the URP team about this idea? What's the URP team's email? Anyone got contacts? Maybe, we can attend the conference and directly tell them.
     
  12. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Haha EGA, that would be nice! Another good reason for us to be able to say hi to you guys at the conference. ;)

    Anyway, thank you guys for the feedback! We see the importance of having a feature for soft shadowing for 2D Lights too. I, for one, am waiting in bated breath. In fact, I've already feedbacked this to the team. Let's wait and see!
     
  13. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Sorry to tag in here but, when can we expect some update/release to the 2drenderer? It has been so long since the first experiment release, but then there has not been any solid news about what is coming, when it will land, what the plan is..?
     
  14. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    Thanks. I'd switch to URP when/if this feature gets done, and willing to donate $30-50 for this.

    URP + ShaderGraph really impressed me and was the highlight "feature" of 2019/2020 for me. The interface of using the shadows was really easy to use compared to some assets.

    Another less-critical idea is "bending" the shadows (e.g. shadow against a wall - example image file attached).
     

    Attached Files:

    Last edited: Oct 6, 2020
    Xiangting_Su likes this.
  15. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Hey Castor! Great to bump into you again!

    Good question: I'll need to check with the team specifically on the 2D Renderer and get back to you on this again.
     
  16. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253

    Hey EGA! Oh wow! That's really kind of you. Great to hear such excitement! :)

    Shadows bending sounds like a really interesting proposal. I personally never thought of that.

    This may seem like a really silly question: I'm really curious as to when do shadows bend? Like I'm trying to think of the possible use cases of shadows bending. Do they bend when they get distorted through water's refraction?
     
  17. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I have such case actually.

    If you make a game that is semi - top down like RPG maker style, the 2D shadow should bend on the wall to simulate the height. Shadow on the ground should display like normal and then once hit the side wall, it should bend so that it looks like there is wall vertically.

    Having said that, I feel like doing this with 2D Shadow is just .. a wrong way to approach the problem. I think this is best achieved using 3D, but represent to the viewer in 2D just like how Gungeon guys did.
     
  18. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Oh yes, you are right Castor! Bending shadows on a semi-top down 2D game to simulate height is an excellent example!

    Achieving this in 3D also sounds like a viable way. I mean Dodge Roll pulled off an excellent 2D-looking 3D game. But I've also heard of players experience lags in their PC during gameplay. Which also makes me wonder if achieving this shadow bending in 2D would be more optimal? At least from a performance stand-point since 2D lights are more optimised than 3D lights.

    I'm also curious how are others achieving this said shadow-bending effect at the moment? Like what are their creative workarounds?
     
  19. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    Hi! My use case, is when the shadow "touches" a 2D wall. So it's not only through water.

    Depending on the direction of the shadow and the wall (and wall's parameters/refractive index), maybe the shadow can refract it.

    So the cyan/blue rectangle in my image I attached on Post #14 was intended to be a 2D wall. I use 2D walls in my game, and the shadow looks more natural if it "bends" a bit when touching a wall.

    A real-life 3D example:


    But the bending suggestion is not high-priority, it is more of a "want" for me than a need. I don't know how hard it is to make and it is a unique feature I have not seen on asset stores.

    The only important feature/need for me is soft shadows, and after adding the soft shadows, I personally think that would make Unity's URP shadows become better than the 2D shadow/lighting paid assets I've tried out so far.
     
  20. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yeah, exactly. Bending shadow is not a priority over softshadow.

    Having said that, we dont even know what to talk about when it comes to the priorities, because we dont even know what is being worked on...
     
  21. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    I tried out URP for several hours to see how it'd work in my game.

    It looks great so far, and the highest priority feature (higher priority than soft-shadow) in my opinion is:
    * Custom Post Processing: https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/c/37-post-processing-custom-effects

    I voted on the link and marked as CRITICAL. I only just found out about the roadmap page where users can vote which feature is more important. The custom post processing was the only issue, as I need to have my own effects in (Custom Render Passes is good but it doesn't fully solve it).

    I can rely on a paid soft-shadows Unity asset until URP adds 2D soft-shadow to their inbuilt shadow/lighting.

    Although the bending shadow is a "want", it could also be used to simulate different "floor" heights, e.g. stair cases, and different "floors". It's low priority IMO, but it's incredibly impactful. It's not a need but as a consumer, I would pay $100 for such an Asset. I don't see many game engines having this feature.
     
    Xiangting_Su and NotaNaN like this.
  22. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Yeah! I personally would love to play with soft shadows myself too.

    So, I've just gotten some updates from the team. The Graphics Team is currently heavily dedicating their efforts in optimising the lights and shadows for better performance and stability at this moment. But they definitely see the importance of rolling out the soft shadows too. I wish I could give a proper timeline as to when but it seems like the guys are on full-steam in optimisation at the moment.

    Let me keep checking back with them and I'll post an update as soon as I receive newer updates.
     
    NotaNaN likes this.
  23. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Yeah! Simulating different levels/ floors sounds like another interesting use case!

    I'm glad you found your way to our URP Roadmaps. Interestingly, after a similar thread with Castor and feedbacking back to the team, there have been new initiatives in creating a public roadmap for 2D where we could show you guys the upcoming features, their statuses and the dates of our releases in advance. I'm definitely keeping my eyes peeled for any newer updates and will keep you guys posted.
     
    Last edited: Oct 23, 2020
    NotaNaN likes this.
  24. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Oh. I see. Thanks for the update. Performance Optimization. Any idea when will Emission channel and Opaque texture support will be available?
     
  25. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    There seem to be some on-going technical deep-dive for Opaque Texture Support to reduce overdraw and I did hear some discussions related to the creation of the emissive materials during one of the team meetings.

    Let me check on their statuses and get back to you.
     
  26. Holoday

    Holoday

    Joined:
    May 15, 2020
    Posts:
    8
    Can we get an update on this? Soft shadows seems like a crucial element of the 2D renderer. Honestly, I'd accept overdraw and inefficiencies right now just to get this working.
     
  27. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    It has been months after months.. Emissive channel happening anytime soon? We dont have control of how lighting is done. It is not like we can do it ourselves like the old legacy pipeline. Give us ability to change the lighting code inside custom shader ourselves or this kind of feature needs to be implemented without delay.
     
    Holoday likes this.
  28. Sydanyo

    Sydanyo

    Joined:
    Aug 21, 2019
    Posts:
    3
    I'm making a fully top-down game currently (not isometric), so in the vein of Into the Eagle's Nest, Alien Breed and so forth, where I need indoor areas to be pitch black, which means having opaque shadows for tilemap walls and so on, but then I'd rather not have all shadows be 100% opaque - for example, enemy shadows could be transparent. Being able to control shadow opacity (intensity) on the shadow caster instead of it being on the light (thus affecting all the shadows) would be amazing. This would also allow us to have windows and other transparent objects cast transparent shadows. But, they really should also blend into the same larger composite shadow then, if at all possible, so there's no weird overlaps.

    Soft shadow edges would be great, but then also shadow length; if I have, for example, a chair in the scene, I don't want its shadow to be infinite in length, which it seems to be currently. This would then also require the shadow to fade out softly, preferably with a slider. So the shadow could start at intensity X, then fall off to intensity Y across its length. Then, optimally, we'd want the shadow length to be dynamic, based on the distance of the light source. Although, to be fair, I suppose this could be scripted.

    I believe these would all be beneficial things regardless of the view model (top-down, isometric, side.)

    As an aside, would be amazing if it would be a bit easier to create a proper flashlight - personally for a top-down game, but in any view really. It is slightly difficult with the URP lights. You know, a flashlight beam that dynamically changes size, shape and intensity based on how far you're aiming it, and if it hits a shadow caster, then behaves like a flashlight beam would. I had a flashlight with the old light system, where I managed to script the light "template" that hits the ground (the end of the beam) to change shape and size based on how far I was aiming it, but it has turned out to be rather difficult (at least for me with my absolute beginner knowledge) to reproduce with URP, so I've just given my player character a torch instead.

    Anyways, yeah... I for one love the shadow caster system of URP, but the whole system feels quite..."beta" still, which is why I'll personally be happy with any additions you can make to it. Shadow stuff like soft edges and so forth will be amazing.
     
    Xiangting_Su likes this.
  29. Holoday

    Holoday

    Joined:
    May 15, 2020
    Posts:
    8
    I believe this can be accomplished with multiple lights and sorting layers. But yes, unity, PLEASE GET US SOME SOFT SHADOWS SOON or give us a method to write our own. Thank you for all the work on this pipeline.
     
  30. ak2286658

    ak2286658

    Joined:
    May 30, 2020
    Posts:
    2
    Any update on the soft shadows guys, it's December 26th, I'm in a solid need of one, I recently decided to recreate my whole libGdx project in unity, gladly I wasn't already too ahead into the project in libGdx, so it took only a few days to recreate everything in unity, but soft shadows is missing, I don't think this should really be that difficult, since it was also available in libGdx with box2d lights. Unity nevertheless is far more better engine than that, reason why I'm migrating, but this little missing feature is costing me a lot of time. And I also didn't find any better assets regarding that in asset store. I'm not a 3d guy btw, so going 3d is just simply not an option for me.
     
    MrPaparoz likes this.
  31. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am guessing that the year is done now.. I think almost everyone at Unity is probably at holidays now... better to hope for the early next year.. :(
     
    MrPaparoz likes this.
  32. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Heya guys, we hear you there. Yes, we have been upvoting for soft shadows (and shadow length too) and feedbacking back to the team. And they have been working hard on R&D to figure out how to best implement them performance-wise.

    Based on our conversations, it seems like we may only get them in the later versions. The priority is to roll out soft shadows while still maintaining good performance and it may take good chunks of time and R&D. The team has also been dedicating lots of efforts in optimising and stabilising the 2D lights and also looking into extending shadow support to other areas of 2D.

    We are in the midst of discussing our deliverables for 21.2 and nothing is set in stone yet. The R&D and conversations are still on-going and I'm hoping to get more updates.
     
    Last edited: Dec 29, 2020
    Charlivi and Sydanyo like this.
  33. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Heya Castor! We currently don't have any updates on the emissive channel but we'll definitely update the moment we do.
     
    Holoday likes this.
  34. Holoday

    Holoday

    Joined:
    May 15, 2020
    Posts:
    8
    Thanks for your reply! It's great to know that it's being worked on. Keep us updated! :D
     
    Xiangting_Su likes this.
  35. Charlivi

    Charlivi

    Joined:
    Feb 1, 2021
    Posts:
    8
    Thank you so much for all the follow ups Xiangtingsu, it's super valuable for our project planning.
    Since the 2021.1.3f1 is out and you mentioned 21.2, I was wondering if we could have an estimation of when the soft shadows would be available?
     
  36. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Hey Charlivi! Thanks for checking back. We've got a great piece of news and that is we have rolled out a 2D Public Roadmap which we believe would help our users plan better.

    Regarding soft shadows, we know it's a highly requested feature and there have been on-going discussions in the R&D. Based on the latest update, it seems like we may only roll them out in later versions.
     
    Charlivi and Lo-renzo like this.
  37. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Still..... any news with emission channel? It is such a critical and basic feature that any rendering pipeline should have...
     
    scorpioservo likes this.
  38. Charlivi

    Charlivi

    Joined:
    Feb 1, 2021
    Posts:
    8
    Hi @xiangtingsu !
    Is there any updates on the soft shadows? Are they in the pipeline for 21.2?
    Our project can't release without this feature, it is very important to us.

    Thanks a lot for your time!
     
    Holoday likes this.
  39. postmortembg

    postmortembg

    Joined:
    May 23, 2020
    Posts:
    3
    Are 2d lights and shadows not supporting perspective camera now? I'm pretty sure they were fine before, now can't get them to work at all with 2021.1.15.
     
  40. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    It's probably been around a year or even more or so , since I asked about the Emissive channel. And I still don't hear anything about adding that support for URP 12 or anything positive actually happening. Can you imagine any rendering pipleline without Emissive channel? It's practically not usable to make any game. Development of 2DRenderer is soooo slow. So much pain.
     
  41. Holoday

    Holoday

    Joined:
    May 15, 2020
    Posts:
    8
    At least emissives can be janked together with a bloom volume and shaders, though that mixes with 2D lights and ends up being a suboptimal solution... soft shadows are harder to mimic. I was hoping, since the original request was submitted over a year ago, that they would be available, perhaps in a beta form by now, as they have been created for 2D before in other render pipelines. Also, I no longer see them on the roadmap, unless it doesn't specify them for some reason?

    Anyway, this is holding back my team's progress, and we'd be happy to hear some sort of update. I hope I don't seem to pessimistic in my comment here as I understand that the Unity team is quite busy and I appreciate their work.
     
  42. GradientOGames

    GradientOGames

    Joined:
    Feb 8, 2021
    Posts:
    28
    I would really like to relight this discussion and ask, its been a year, what's the holdup?
     
  43. frulica

    frulica

    Joined:
    Jul 6, 2013
    Posts:
    4
    Another bump!
     
  44. Akukukun

    Akukukun

    Joined:
    Sep 15, 2020
    Posts:
    1
  45. qwench

    qwench

    Joined:
    May 2, 2022
    Posts:
    13
    One more.
    Please.
     
  46. juicedup

    juicedup

    Joined:
    Aug 18, 2019
    Posts:
    47
  47. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I gave up on the soft shadow. It's been discussed like 3 years and still nothing.
     
  48. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Thank you all for checking back and apologises for the delayed response.

    Regarding Emissive, good news is that it's already possible now using the 2D Light Texture Node in Shader Graph. We've put together a neat sample here in 2D Renderer samples (updated for 2021.2) to demonstrate exactly how that works. The Light Textures generated by the 2D Renderer are sampled and modulated by an Emissive mask Secondary Texture on the Sprite. The sample also includes a Bloom post-process to extend the glow beyond the pixels of the Sprite.

    Regarding shadows in general, the team has been dedicating efforts to support the highly requested interoperability across the different 2D areas such as Tilemaps, Sprite Shapes, Animated Sprites, Colliders etc. And there has been good progress on this.

    As for soft shadows, as far as I'm aware, this is still in R&D. We know this is yet another highly requested feature and it's something we would really like to push for. I have also shared this full thread with our team for greater awareness of the urgency of this request. If there are any updates, we'll be sure to keep you guys posted in our 2D Public Roadmap.

    Also, if there are more specific soft shadows use cases you need, it would also be super helpful for us to see some screenshots too so that we can better understand them and consider them in our implementations.

    Once again, thank you for chiming in and letting us know your concerns and requests.
     
  49. FrancoisKruger

    FrancoisKruger

    Joined:
    Jan 27, 2021
    Posts:
    4
    Yeah Xuabgting_Su no offence but you might as well just stop replying about any updates. This thread was literally started 3 years ago and clearly nothing has been done regarding soft shadows. You literally cannot build any believable world with only hard shadows. Here is a simple example (attached image) put down a box (imagine a house) with lights around it (like street lights or torches). You end up having the most disgusting looking shadow system ever. Now imagine a world full of these "street lights".

    And just to make the point even more clear about how useless shadows in URP are, I moved two boxes to the right and I have 4 lights on the left (imagine 4 candles). That shadow system is UNUSABLE. This would never look like this in real life, and no artist is trying to "achieve this look" in a game either.

    Xuabgting_Su I don't think we need more examples of why this is important. If you don't want to fix it, just say so, so that people can just drop URP instead of trying to make it work. I've battled with this for so long and I thought I was being dumb, but after reading through this 3 year old thread it's becoming clear that URP's 2D shadows are unusable in any real game. I'll be moving away from URP now.
     

    Attached Files:

    Last edited: Aug 31, 2022
    reza_b_mirzaei likes this.
  50. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,503
    reza_b_mirzaei and Gibbonfiend like this.