iPad2 Textures not rendering, or device crashing

iPad2 is obviously a very old device, and I’ve been struggling with large textures crashing browser tabs.

This post (https://blog.playcanvas.com/webgl-texture-compression-made-easy/) is amazing, as it lays out PlayCanvas’ compression tools. I resolved the crashes on iPad2 by using PVR compression, however, I had a runaround trying to solve models (with compressed textures) rendering as ‘grey boxes’ (i.e. as if the texture was unavailable). It turns out that PVR requires square textures - not just power-of-two! With square textures and PVR compression, iPad2 crashes went away in my case.

Hope this helps someone else one day.

2 Likes

I don’t have this issue, but I just stumbled upon this post and wanted to say I think you are awesome for posting this.

1 Like

Oh I should add another learning I just found: If you turn on compression, know that the compensation for the thing now working on iPad2 because reduced VRAM usage is a larger asset download -

e.g I had a 2k square texture, which read as 16MB original VRAM usage. PVR compression at 4BPP (via Playcanvas) reduced this to 2.8MB VRAM - amazing… BUT, the asset is no longer a 300KB download as the original, it’s now a 2.8MB ktx file! (https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/)

So know that this is a hard trade-off - you can have an asset download size be teeny tiny, but a massive VRAM usage (which may kill iPad2 and the like), or a massive download, and teeny VRAM usage. Pick your poison, it’d seem!

Edit - adding more info on ktx files: https://doc.babylonjs.com/resources/multi-platform_compressed_textures

1 Like

One more bit of info learned: You can squash the compressed ktx file a little bit smaller by turning off mip maps; useful if your texture is only presented at one ‘size’ on screen.

Hold on - you wouldn’t be downloading 2.8MB because you should be configuring your web server to serve your KTX files with GZIP compression/encoding. It may (but not necessarily) still be a bit bigger than the original JPG/PNG, but the difference should be a lot less.

1 Like

Oh sweet! Is that the other estimate listed on the compressed image then? It’s a tad, but not much higher, than original. I did wonder if .ktx could be compressed- what a superb feature :smile:

image

After each ‘variant’, the first number is the download size assuming GZIP is enabled and the second number is the VRAM consumed by the variant.

1 Like