# PCF and PCSS on mobile

**URL:** <https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327>\
**Category:** Bugs\
**Created:** [February 10, 2021, 5:27pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327 "2021-02-10T17:27:33Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiendstear](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fiendstear/32/11807_2.png) [@fiendstear](https://forum.babylonjs.com/u/fiendstear)\
**Post date:** [February 10, 2021, 5:27pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/1 "2021-02-10T17:27:33Z")

</div>

Hello everyone.  
There seems to be a problem with shadow filtering on mobile devices. In my project i tried to use pcss and pcf and there’s no shadows at all. Tried playground examples like this one: [https://playground.babylonjs.com/#B48X7G#2](https://playground.babylonjs.com/#B48X7G#2)  
and it doesn’t work as well. Babylon says that device supports webgl2 and this [https://get.webgl.org/webgl2/](https://get.webgl.org/webgl2/)  
site says the same as well. Tried several other devices - same thing. On PC it works great.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 10, 2021, 5:51pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/2 "2021-02-10T17:51:30Z")

</div>

Hey which device do you use? on iPhone it cannot work as they report support for webgl2 but it is not complete yet

---

<div class="post-metadata">

**Author:** ![fiendstear](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fiendstear/32/11807_2.png) [@fiendstear](https://forum.babylonjs.com/u/fiendstear)\
**Post date:** [February 10, 2021, 6:04pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/3 "2021-02-10T18:04:50Z")

</div>

Samsung Galaxy A8+, for example. Tried on iphone too, but it’s clear they have problems with webgl2

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 10, 2021, 6:26pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/4 "2021-02-10T18:26:02Z")

</div>

Ok so let’s add @sebavan and @Evgeni_Popov

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [February 10, 2021, 6:42pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/5 "2021-02-10T18:42:37Z")

</div>

@Evgeni_Popov do you have an android device to check on it ?

or maybe @fiendstear do you see an error message in the console ?

---

<div class="post-metadata">

**Author:** ![fiendstear](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fiendstear/32/11807_2.png) [@fiendstear](https://forum.babylonjs.com/u/fiendstear)\
**Post date:** [February 10, 2021, 7:08pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/6 "2021-02-10T19:08:11Z")

</div>

Yes, there was an error message saying something about webgl. I’ll post it here tomorrow.

---

<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:** [February 10, 2021, 7:37pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/7 "2021-02-10T19:37:42Z")

</div>

Sorry, I only have a iPhone SE.

---

<div class="post-metadata">

**Author:** ![fiendstear](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fiendstear/32/11807_2.png) [@fiendstear](https://forum.babylonjs.com/u/fiendstear)\
**Post date:** [February 11, 2021, 7:15am UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/8 "2021-02-11T07:15:33Z")

</div>

Hello again.  
Here’s a full log from console [https://drive.google.com/file/d/1EmX5-Yn5h7ROJs0A\_8u8L8eeGqg2Xrh\_/view?usp=sharing](https://drive.google.com/file/d/1EmX5-Yn5h7ROJs0A_8u8L8eeGqg2Xrh_/view?usp=sharing)  
and a screenshot of how it looks.

 ![screenshot](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/b/bcef9213daf8b42b7258395cda377e2c5d38f2df.png)  
device is samsung SM-G920 this time.

---

<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:** [February 11, 2021, 11:51am UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/9 "2021-02-11T11:51:35Z")

</div>

We can’t access the file, it is protected:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/0/07b196bc92ffc6f0a9093cfa831b2a29e54348f1.png)

---

<div class="post-metadata">

**Author:** ![fiendstear](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fiendstear/32/11807_2.png) [@fiendstear](https://forum.babylonjs.com/u/fiendstear)\
**Post date:** [February 11, 2021, 12:03pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/10 "2021-02-11T12:03:04Z")

</div>

Sorry. I’ve changed access rules, try again please.

---

<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:** [February 11, 2021, 12:27pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/11 "2021-02-11T12:27:17Z")

</div>

It does work now.

The error is:

```auto
babylon.js:16 BJS - [11:04:12]: Error: FRAGMENT SHADER 0:97: S0032:
  no default precision defined for parameter 'webgl_4aeb46af4241331f'

```

It does not make sense to me, line 97 is `in vec3 vNormalW;` and there’s no variable named `webgl_4aeb46af4241331f` in our code…

[…] We already got this error:

> [@Contact hardening shadow error in chrome x android](https://forum.babylonjs.com/t/contact-hardening-shadow-error-in-chrome-x-android/10511/4):
>
> Pinging @sebavan

> **[WebGL2 shadow fallback - bug?](https://www.html5gamedevs.com/topic/36934-webgl2-shadow-fallback-bug/)**
>
> Hello, As per the docs, the WebGL2 shadows are meant to fall back to Poisson Sampling on non compatible devices. However, Chrome 65.0.3325.109 on Android (Samsung S6 edge+) only display a red cube on this PG without ground and no shadows. That said,...

> **[usePercentageCloserFiltering shadow doesn't work on Samsung S8+](https://www.html5gamedevs.com/topic/38818-usepercentagecloserfiltering-shadow-doesnt-work-on-samsung-s8/)**
>
> Hello, When using "usePercentageCloserFiltering" on Samsung S8+ (Android 8.0.0) I get "Unable to compile effect" after that any texture that can receive shadows doesn't work, reproduce with the doc's playground...

> **[ShadowGenerator usePercentageCloserFiltering breaks Android](https://www.html5gamedevs.com/topic/38473-shadowgenerator-usepercentagecloserfiltering-breaks-android/)**
>
> https://playground.babylonjs.com/indexStable.html#MK6IZ7#1 Hi there, if you use usePercentageCloserFiltering (Shadowgenerator) it will break Android and only Android (iOS, Safari, Chrome desktop works fine). BJS - \[10:25:40\]: Unable to compile...

This latter post suggests that CSM is working even using PCF (so maybe it will also work with PCSS), so you can try it (but be warned that CSMs are even more taxing on performance than standard shadow generator!)

---

<div class="post-metadata">

**Author:** ![fiendstear](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/fiendstear/32/11807_2.png) [@fiendstear](https://forum.babylonjs.com/u/fiendstear)\
**Post date:** [February 11, 2021, 1:13pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/12 "2021-02-11T13:13:11Z")

</div>

Yes, both filters work when using CSM.  
Anyway, I’m going to stick with CSM cause performance drop isn’t terrible and looks acceptable to me. Thank you very much.

---

<div class="post-metadata">

**Author:** ![PichouPichou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pichoupichou/32/316_2.png) [@PichouPichou](https://forum.babylonjs.com/u/PichouPichou)\
**Post date:** [August 2, 2021, 9:32am UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/13 "2021-08-02T09:32:47Z")

</div>

> [@Deltakosh](#):
>
> on iPhone it cannot work as they report support for webgl2 but it is not complete yet

Do we know if it will be supported soon? In our test, we still can’t make it work when WebGL2 feature is activated on Iphone.  
Thanks 😉

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 2, 2021, 1:44pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/14 "2021-08-02T13:44:42Z")

</div>

Nope no idea when they ll release fully ☹

---

<div class="post-metadata">

**Author:** ![DarraghBurke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/darraghburke/32/10621_2.png) [@DarraghBurke](https://forum.babylonjs.com/u/DarraghBurke)\
**Post date:** [August 2, 2021, 7:34pm UTC](https://forum.babylonjs.com/t/pcf-and-pcss-on-mobile/18327/15 "2021-08-02T19:34:57Z")

</div>

WebGL 2 will (almost certainly) be [enabled by default](https://caniuse.com/webgl2) in Safari 15, so it should be fully supported. [Historically](https://en.wikipedia.org/wiki/Safari_version_history#iOS) Apple has released new major versions of Safari in the middle of September every year, so we can probably expect that this year.
