engine icon indicating copy to clipboard operation
engine copied to clipboard

PCF Shadow render issue with IPhone

Open flyingbaba opened this issue 3 years ago • 15 comments

Shadows are looking weird, pixelated on the edges.

PCF Shadow render issue with Iphone7, iOS 15.0 Tested also with Iphone5 SE, iOS 11 (same result)

Steps to Reproduce

  1. Open https://playcanvas.com/editor/scene/1252918
  2. Hit Launch

On a real scene with lots of models it is very obvious that PCF is broken.

flyingbaba avatar Oct 18 '21 14:10 flyingbaba

Please attach a screenshot if you can for those of us without and iphone?

slimbuck avatar Oct 18 '21 14:10 slimbuck

We got the same rendering issue on our project in the following device:

Running on an iPad 2020 (8th generation) on iOS 15: image

Up close the issue isn’t that obvious because the resolution is high, though if you go close filtering is still bad on the edges: image

leonidaspir avatar Oct 18 '21 14:10 leonidaspir

@leonidaspir Thanks for the screenshots. We have a blank Iphone without apps and it is a nightmare to transfer a file from it (((

flyingbaba avatar Oct 18 '21 14:10 flyingbaba

Side note: If you have a Mac, you can take screenshot on device and transfer via USB using Image Capture app on the Mac.

yaustar avatar Oct 18 '21 14:10 yaustar

I did some testing, and it seems the hardware PCF compare is not working in iOS devices. This requires iOS 15, as that's where the WebGL2 is enabled, and so the hardware PCF is used.

@grorg - I wonder if you give this a test on your side as well please.

Steps to repro: http://playcanvas.github.io/#/graphics/shadow-cascades in Controls, set Count to 1, resolution to around 512, filtering PCF3 (it's easier to click on sliders than slide them)

iPhone XR (iOS 15) - incorrect iphoneXR

Mac OS (Safari 15) - correct MacOS

Google Pixel 3A XL - correct google pixel

I also modified code (don't have a repro available to public) to do a single sample from depth shadow sampler. On iOS, this comes up as black & white shadow iphone_single_sample

on other devices, it does 2x2 PCF filtering as expected pixel3a_single_sample

The shadow map seems to be set up correctly for PCF filtering Screenshot 2021-10-18 at 18 18 34

mvaligursky avatar Oct 18 '21 17:10 mvaligursky

I also tried xcode Simulator, iPhone 8 Pro, iOS 15, Simulator 13.0 (970), and in both cases get no shadow at all (or more like full shadow everywhere) emulator_single_sample

mvaligursky avatar Oct 18 '21 17:10 mvaligursky

WebKit issue: https://bugs.webkit.org/show_bug.cgi?id=232071

mvaligursky avatar Oct 21 '21 09:10 mvaligursky

Sorry for the delay. I have not forgotten!

grorg avatar Oct 21 '21 21:10 grorg

Thank you so much for filing a bug report (and your investigation).

grorg avatar Oct 21 '21 21:10 grorg

status of the webkit bug was just changed. Fingers crossed we'll se it soon in Safari. Resolution | FIXED

mvaligursky avatar Nov 30 '21 21:11 mvaligursky

Still not released on iOS 15.2

yaustar avatar Jan 11 '22 16:01 yaustar

update from the webkit ticket: This change should be present in STP 139, iOS 15.4 Beta, and macOS 12.3 Beta.

mvaligursky avatar Feb 07 '22 11:02 mvaligursky

Still not functioning on iPhone XR running 15.5, both in Safari and Chrome. @grorg - should this be part of 15.5 yet?

mvaligursky avatar Jun 23 '22 14:06 mvaligursky

Note that this still does not work on iPhone XR 16.1.1, tested in Safari. I'll update the mentioned webkit ticket.

mvaligursky avatar Nov 15 '22 12:11 mvaligursky