There is an issue with HDR disappearing when embedding PlayCanvas through a webview on iOS

We placed the packaged PlayCanvas files in the iOS installation package for local preview. We encountered a strange issue where the car model would turn black if we switched to another tab during loading and came back later. Sometimes it works fine, but it seems to be a probability issue. If you stay on other pages for a long time before coming back, it will happen 100% of the time. What causes this issue and how can we fix it?

I have put the iOS project engineering files on GitHub, and the address is: GitHub - sunday20120713/hdrLost: Example of hdr lost projects.

I also recorded a video that can be viewed.

Hmm, difficult to say. When the issue happens, do you have any errors or logs in the browser dev console?

Could be related to the memory management of iOS.

In case you use image based lighting, and generate the prefiltered cubemap in the Editor, the issue could be in the engine. At runtime, this prefiltered cubemap gets converted to envLighting format (new format the engine uses), but when the device is lost, this texture is not regenerated and stays black.

A workaround here is to use envLighting directly … see here how this can be done:

@slimbuck will be addressing this soon.


No errors,There are no other log prints either。

We have embedded vconsole in our production project, so we can see error messages and print information.

We’ve also encountered this issue, and our solution was to refresh the HDR every 0.2 seconds using reload. However, there’s still a chance of losing the HDR, resulting in the loss of scene lighting. I’m wondering if the loading method in this case can completely solve this problem?

Typically, this only happens when the device context is lost. (when the tab goes inactive, or the app goes to background on the device or sleep).

Instead of reloading every 0.2, you can handle an event that the graphicsDevices fires on itself, called “devicerestored” - that is where the cubemap needs to be re-generated.

@slimbuck for visibility

1 Like