# Shadow map filtering (PCF, POISSON, PCSS)

**URL:** <https://forum.defold.com/t/shadow-map-filtering-pcf-poisson-pcss/70142>\
**Category:** The Defoldmine\
**Created:** [January 17, 2022, 1:16pm UTC](https://forum.defold.com/t/shadow-map-filtering-pcf-poisson-pcss/70142 "2022-01-17T13:16:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Lytkin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ivan_lytkin/32/2654_2.png) [@Ivan\_Lytkin](https://forum.defold.com/u/Ivan_Lytkin)\
**Post date:** [January 17, 2022, 1:16pm UTC](https://forum.defold.com/t/shadow-map-filtering-pcf-poisson-pcss/70142/1 "2022-01-17T13:16:49Z")

</div>

Percentage-Closer Soft Shadows and other shadow map filters test.

> **[GitHub - abadonna/defold-pcss: shadow map filters test](https://github.com/abadonna/defold-pcss)**
>
> shadow map filters test

 ![Screenshot 2022-01-17 at 16.02.59](https://forum-defold.b-cdn.net/uploads/default/original/3X/2/2/226702e572617c55c98db41775dad5b98021b40f.jpeg)

But I can’t make PCSS look the same as they look in nvidia sample, so any suggestions and corrections are welcome.

To make things a bit different from [jhonny.goransson’s shadow maps example](https://forum.defold.com/t/simple-shadow-mapping-example/47628) I use view-space z value for shadow map and deferred shading (to keep shading in a separate pass).

Also, used orbit camera from this repository

> **[GitHub - abadonna/defold-orbit-camera: simple orbit camera example for defold](https://github.com/abadonna/defold-orbit-camera)**
>
> simple orbit camera example for defold

---

<div class="post-metadata">

**Author:** ![Ivan\_Lytkin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ivan_lytkin/32/2654_2.png) [@Ivan\_Lytkin](https://forum.defold.com/u/Ivan_Lytkin)\
**Post date:** [January 17, 2022, 9:38pm UTC](https://forum.defold.com/t/shadow-map-filtering-pcf-poisson-pcss/70142/2 "2022-01-17T21:38:31Z")

</div>

Just added a branch with perspective light projection.  
Probably PCSS looks better for non-linear depth (I couldn’t make it work with perspective light projection and view-space fragment position reconstruction, so in this branch I moved to gl\_FragCoord.z)

---

<div class="post-metadata">

**Author:** ![Ivan\_Lytkin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ivan_lytkin/32/2654_2.png) [@Ivan\_Lytkin](https://forum.defold.com/u/Ivan_Lytkin)\
**Post date:** [January 18, 2022, 10:55am UTC](https://forum.defold.com/t/shadow-map-filtering-pcf-poisson-pcss/70142/3 "2022-01-18T10:55:02Z")

</div>

Variance Shadow Map.

> **[GitHub - abadonna/defold-vsm: variance shadow maps for defold](https://github.com/abadonna/defold-vsm)**
>
> variance shadow maps for defold

But gauss filter adds some artefacts, so it’s disabled (lack of precision?)

---

<div class="post-metadata">

**Author:** ![jhonny.goransson](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jhonny.goransson/32/3864_2.png) [@jhonny.goransson](https://forum.defold.com/u/jhonny.goransson)\
**Post date:** [January 21, 2022, 11:42am UTC](https://forum.defold.com/t/shadow-map-filtering-pcf-poisson-pcss/70142/4 "2022-01-21T11:42:51Z")

</div>

Well done! So glad to see my (crappy) example is useful 🙂
