ShadowGenerator Blur inside ImportMesh

So I’m trying to get a shadow to blur and I got this far:

This is the first time I’ve messed around with ShadowGenerator. I just copy pasted what worked in a playground scene from the documentation in Background Materials (https://playground.babylonjs.com/#G3HSAW#330) , but applying it within ImportMesh to the boombox asset.

When I uncomment out lines 21-25 though, the shadow disappears. These would be the lines

        // shadowGenerator.useBlurCloseExponentialShadowMap = true;
        // shadowGenerator.useKernelBlur = true;
        // shadowGenerator.blurScale = 4;
        // shadowGenerator.blurKernel = 0;
        // shadowGenerator.depthScale = 0;

It’s actually just the line with the useBlurCloseExponentialShadowMap that makes the shadow disappear. If i comment that line out, the shadow reappears but without the other lines creating any blurring effects. I’d normally just look at the API, but I’m not really sure what it means.

Straightforward I think, for whoever knows, thanks.

That’s because the values you set for blurScale/blurKernel/depthScale are not ok. Try tweaking the values until you are happy with the shadows. For eg:

3 Likes

Thanks. I see how the visibility changes when you alter blurKernel, and blurScale for example.
Another thing is you added:

    light.shadowMinZ = 0;
    light.shadowMaxZ = 200;

It won’t show up without that, with blur methods at least. I actually referenced the incorrect playground. The one i was looking at for comparison was this one: https://playground.babylonjs.com/#G3HSAW#33

Here, the sphere is a lot more blurry. But I think its the shape of the casting object. The boombox antennae is being blurred out, where as the sphere has no hard edges, so its more observable. The difference is still kind of weird though. But in this application, with a different model I’ll be using, I actually like the nonblurry shadow better.

The filter used in both PGs are not the same: one is using “Blurred close exponential” whereas the other is using “Blur exponential”.