Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020.2 has been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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?

     
    EGA likes 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 Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,760
  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.
     
  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
     
    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.
     
  8. EGA

    EGA

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

    ShadowLairGames

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

    Carocrazy132

    Joined:
    Aug 16, 2015
    Posts:
    3
    Another vote for needing soft shadows
     
  11. EGA

    EGA

    Joined:
    Sep 12, 2014
    Posts:
    80
    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. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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!
     
    GliderGuy and EGA like this.
  13. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,994
    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. EGA

    EGA

    Joined:
    Sep 12, 2014
    Posts:
    80
    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
    xiangtingsu likes this.
  15. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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.
     
    EGA likes this.
  16. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42

    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?
     
    EGA likes this.
  17. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,994
    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.
     
    EGA likes this.
  18. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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?
     
    GliderGuy and EGA like this.
  19. EGA

    EGA

    Joined:
    Sep 12, 2014
    Posts:
    80
    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:
    1,994
    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. EGA

    EGA

    Joined:
    Sep 12, 2014
    Posts:
    80
    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.
     
    xiangtingsu and GliderGuy like this.
  22. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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.
     
    GliderGuy likes this.
  23. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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
    GliderGuy likes this.
  24. castor76

    castor76

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

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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:
    5
    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:
    1,994
    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:
    1
    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.
     
    xiangtingsu likes this.
  29. Holoday

    Holoday

    Joined:
    May 15, 2020
    Posts:
    5
    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:
    1,994
    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. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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
    Sydanyo likes this.
  33. xiangtingsu

    xiangtingsu

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    42
    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:
    5
    Thanks for your reply! It's great to know that it's being worked on. Keep us updated! :D
     
    xiangtingsu likes this.
unityunity