# ShadowGenerator Blur inside ImportMesh

**URL:** <https://forum.babylonjs.com/t/shadowgenerator-blur-inside-importmesh/35165>\
**Category:** Questions\
**Tags:** lighting, material, shadowgenerator\
**Created:** [October 27, 2022, 6:18am UTC](https://forum.babylonjs.com/t/shadowgenerator-blur-inside-importmesh/35165 "2022-10-27T06:18:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![3dwebgs](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/3dwebgs/32/13909_2.png) [@3dwebgs](https://forum.babylonjs.com/u/3dwebgs)\
**Post date:** [October 27, 2022, 6:18am UTC](https://forum.babylonjs.com/t/shadowgenerator-blur-inside-importmesh/35165/1 "2022-10-27T06:18:17Z")

</div>

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

> **[Babylon.js Playground](https://playground.babylonjs.com/#QCU8DJ%23276)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

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](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

```auto
        // 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.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 27, 2022, 9:31am UTC](https://forum.babylonjs.com/t/shadowgenerator-blur-inside-importmesh/35165/2 "2022-10-27T09:31:50Z")

</div>

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:

> **[Babylon.js Playground](https://playground.babylonjs.com/#QCU8DJ%23279)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![3dwebgs](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/3dwebgs/32/13909_2.png) [@3dwebgs](https://forum.babylonjs.com/u/3dwebgs)\
**Post date:** [October 27, 2022, 6:48pm UTC](https://forum.babylonjs.com/t/shadowgenerator-blur-inside-importmesh/35165/3 "2022-10-27T18:48:55Z")

</div>

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

```auto
    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](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.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 27, 2022, 7:04pm UTC](https://forum.babylonjs.com/t/shadowgenerator-blur-inside-importmesh/35165/4 "2022-10-27T19:04:53Z")

</div>

The filter used in both PGs are not the same: [one](https://playground.babylonjs.com/#QCU8DJ#279) is using “Blurred close exponential” whereas [the other](https://playground.babylonjs.com/#G3HSAW#33) is using “Blur exponential”.
