Search Unity

Capsule shadow - Dynamic object soft shadow (fake indirect)

Discussion in 'General Discussion' started by Nocturness, Jun 20, 2017.

  1. Nocturness

    Nocturness

    Joined:
    Nov 10, 2015
    Posts:
    7
    Hi guys,

    I'm currently dealing with unity nin realtime lighting . There is no problem with static objects, but dynamic objects are supported with light probes, but lightprobe has no indirect or soft shadow support(no direct light). It creates a fake situation with skylight illumination, like objects standing in the air. The ambient occulision effect is also bad for realism.

    any solution? im searching for but no answer. if there is a solution and works with unity realtime lighting (or light probe) it might be a game changer.

    unreal capsule shadows example from another user :



    lighting study with realtime :
     
    Last edited: Jun 20, 2017
    AntonioModer likes this.
  2. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    There is mixed lighting in 5.6
     
  3. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    328
    Robert Cupisz was working on it a while ago but the project seems dead:

    http://robert.cupisz.eu/

    "Soft character shadows in Unity, The Last of Us style.

    Character approximated by a bunch of scaled sphere occluders. Directional component of the directional lightmaps is occluded “directionally” and the directionless remainder gets AO from the occluders. :)"




    You could ask him on Twitter about it: https://twitter.com/robertcupisz
     
  4. Nocturness

    Nocturness

    Joined:
    Nov 10, 2015
    Posts:
    7
    That's what I was looking for. Thx for the reply. I hope the project will continue.

    Unfortunately, mixed lighting does not fully meet. The closest result is this:
     
  5. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    I'd love it if someone got this working.
     
    Deleted User and tatoforever like this.
  6. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,369
    We are working on it. ;)
     
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    I was thinking about capsule shadows today. Was this resolved in some other way or just abandoned.
     
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    There was a branch exactly for this effect on HDRP repo long time ago, but last commit was 17 months ago. . . :(
    it have capsule soft shadow, capsule AO, even Capsule Specular AO/proxy reflection like the Last of us 2
     
    Last edited: Dec 15, 2021
  9. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    btw. During net surfing I have noticed Unreal got it built-in.
     
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's just getting position in shader and comparing it against a point in 3D space which is defined by a coordinate, or SDF.
     
  11. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    https://github.com/Unity-Technologies/Graphics/tree/draft/rp/capsule-shadows seems like shadows only though
    been active for the last few weeks, hopefully it doesn't get abandoned again
     
  12. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    If It is so simple and looks super useful.
    Why unity don't have it built in?
     
  13. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Not really.

    If you want subtractive shadows, in forward rendering you'd need to extract surfaces affected by them and draw them again. Then you'd need to predict volume taken by the penumbra and make sure it blends properly with existing geometry.

    If you have flat floor and want the shadow affect nothing else, then yeah, it is simple.

    The thing is similar to decals.... speaking of which, what's the unity status when it comes to decals? I only recall HDRP having some deferred ones...
     
  14. Last edited by a moderator: Dec 16, 2021
  15. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    That... doesn't sound very lightweight.
    What happened with traditional decals?
     
  16. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Unity actually implemented a version per vertex on shadowgun "character AO" shadow underneath, the problem is that it's not a generic solution, you have to author "capsule" per object and discriminate them per pixel, it's very close to what lighting compute is (ie a bunch of analytic primitives you need to resolve per lighted points) and thus similar problem (discrimination contributing primitive per points). Which like increase workflow in an arbitrary way (there is no good generic automation), whereas other solution like shadowmap are straight forward (depthmap takes arbitrary shapes and resolve arbitrary geometry).
     
  17. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
  18. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
  19. cgDoofus

    cgDoofus

    Joined:
    Jun 15, 2021
    Posts:
    48
    I made an implementation of this Here
    I can imagine the official implementation would only be in HDRP for a while :D
     
    blueivy and PutridEx like this.