Capsule shadow - Dynamic object soft shadow (fake indirect)

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 :

1 Like

There is mixed lighting in 5.6

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: x.com

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:

https://www.youtube.com/watch?v=sQPa8sLtICs

I’d love it if someone got this working.

2 Likes

We are working on it. :wink:

6 Likes

I was thinking about capsule shadows today. Was this resolved in some other way or just abandoned.

There was a branch exactly for this effect on HDRP repo long time ago, but last commit was 17 months ago. . . :frowning:
it have capsule soft shadow, capsule AO, even Capsule Specular AO/proxy reflection like the Last of us 2

btw. During net surfing I have noticed Unreal got it built-in.

It’s just getting position in shader and comparing it against a point in 3D space which is defined by a coordinate, or SDF.

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

If It is so simple and looks super useful.
Why unity don’t have it built in?

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…

HDRP indeed has them: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@13.1/manual/Decal-Projector.html
URP has them as well: https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@13.1/manual/renderer-feature-decal.html

That… doesn’t sound very lightweight.

What happened with traditional decals?

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).

Oh that branch is new, I think the old one was this
https://github.com/Unity-Technologies/Graphics/tree/hw20/capsule-soft-shadows-cleanup-2
https://github.com/Unity-Technologies/Graphics/tree/9.x.x/backport/hw20/capsule-soft-shadows

Doesn’t mean to double post but go vote for this
https://portal.productboard.com/unity/1-unity-platform-rendering-visual-effects/c/1265-capsule-shadows-experimental

I made an implementation of this Here
I can imagine the official implementation would only be in HDRP for a while :smile:

2 Likes