Fast Volumetric Blob Shadows

I’ve been looking for a good solution for blob shadows in Unity for a long time now, but I’ve never been able to find one that met all of my needs. I finally decided that I should just figure out how to implement my own, and this is the result!

All you need to do is drop the material onto a cube or sphere mesh, place it in the world, and adjust the color, sharpness, and intensity as needed. For dynamic objects, you can position it with a simple script or constraint. The shadow volume geometry can be moved, rotated, and scaled. I’ve used it in situations when full shadows are enabled but a little bit of cheap extra occlusion is desired. It can easily be GPU instanced, but static and dynamic batching do not work, because batching removes transformation information necessary for the shader to function.

The primary advantage this asset has over the standard Unity projector is that the projector will re-render all of the objects it affects, which can potentially increase the number of draw calls and overall cost of a scene dramatically, especially if there are multiple objects casting shadows on multiple environment objects, or the objects receiving the shadows are large or complex. The FVBS shader doesn’t suffer from this issue, and will have the same cost regardless of the complexity of the scene being shadowed.

Builtin, URP, and HDRP are all supported. Works in forward and deferred pipelines, the only requirement is there must be a depth texture.

I’m looking to give out a few vouchers to people who’re working on a project that would be interested in trying it out and giving me some feedback, especially on mobile or VR. Please let me know if you think it’d be useful for you!

Purchase FVBS on the Asset Store!

3 Likes

Hi, I testing yours blob shadows in my project… FOG not works with shadows ?

Hey! Sorry I didn’t see this message earlier. The fog not working with the shadows is something I overlooked and am going to fix in the next update. You can edit BlobShadow.shader and remove the word “nofog” from line #24 in BlobShadow.shader, that should fix it!

V1.1 is now live on the Asset Store! Lots of minor bug fixes (including the fog issue!) and improvements, and major improvements to the smoothness of the square version of the shadow:

5772289--608458--ezgif.com-optimize (88).gif

Great asset,
is it besed on depth buffer?

Yes it is. Needing to enable the depth buffer is the primary cost, the shadows themselves are quite cheap to render.

1 Like

Hi can they have a direction, not just downwards?
I guess they do not cast a long way as they are inside the placed volume box?
Could you use for fake lighting effects too?

They don’t really have a direction, but you can scale them arbitrarily, so you can make them longer as needed. You can use them for fake lighting, the color of the “shadow” is an HDR color so you can make them as bright as you want.

Hi, thanks for this great asset!

One question, does this asset support single-pass VR?
We’re targeting Quest single-pass, and the shadows are rendering incorrectly.
Multi-pass works as expected.

It should work, but with single-pass it’s generally a crapshoot. I’m happy to look into that. What version of Unity are you using and what rendering pipeline?

1 Like

Appreciate the help!

We’re using the default renderer pipeline, on 2019.4.11 LTS.

Okay, I was able to reproduce the problem, and I think I know why it’s happening. Looks like the depth textures for the Quest multiview rendering are stacked in a texture array, rather than a doublewide texture. I am now trying to figure out either how to access that array manually so I can pick the index based on the eye, or see why the helper methods Unity provides do not seem to be working correctly.

I have the same issue with this asset on the quest as well.

So I haven’t been able to make any progress on getting the shadows working in Builtin on Quest with Multiview, and at this point I’m unfortunately not sure I’ll be able to find a way to get at the textures I’d need access to in the Builtin pipeline. However, I’ve done some testing and confirmed that it does work in the URP with Multiview. I’m happy to offer a refund if that isn’t a solution that works for either of you.

Hello,

I have been using FVBS shadow asset for some of the objects in my VR scene.
The shadows are flickering when I am at far, and as I approach near them at close enough distance they stop flickering.
The VR camera is moving forward at a constant speed.

Video Reference for this issue :

Could you tell me how to solve this flickering ?

Are you using the URP? There are a couple of depth related issues I’ve seen show up in older versions of the URP. If you can upgrade to 7.4 or newer and make sure to try using the shader at FastVolumetricBlobShadows\URP\AmplifyBlobShadow.shader it may fix the issue.

I am using Built-in Render pipeline. Is there any solution or suggestion for this issue in Buit-in ?

Does this work for mesh shapes too? I would like a shadow beneath my model with the same shape as the model, and I want it to always render directly below the model.

Here’s a clip from F-Zero GX showing what I’m hoping to achieve:
clcog9

So it’s difficult to tell exactly what might be causing it from the video, but my next guess would be that it’s just ordinary aliasing. One trick you could try is just scaling the shadows up a little bit in the Z axis (or whatever axis is forward) when they’re far away so they don’t alias as bad. Unfortunately, in general aliasing like that can be incredibly difficult to solve.

It doesn’t currently support that but it’s a potential use-case I’m interested in. I could send you over a prototype shader to see if it works in your case.

Sure, I’d love that! This kind of shadow is a great feature in platformers and arcade races, and it’s a shame Unity URP doesn’t support it out of the box.