Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed file texture atlas example does not load textures (3.80.X) #6756

Open
yaustar opened this issue Mar 1, 2024 · 3 comments
Open
Assignees

Comments

@yaustar
Copy link

yaustar commented Mar 1, 2024

Version

  • Phaser Version: 3.80.1
  • Operating system: Mac OS
  • Browser: Tested on Chrome

Description

Example shows black squares instead of the compressed texture for 3.80.X but not for 3.70.0 https://labs.phaser.io/view.html?src=src\textures\compressed%20texture%20atlas.js

image
@yaustar yaustar changed the title Compressed file texture atlas example does not load textures Compressed file texture atlas example does not load textures (3.80.X) Mar 1, 2024
@BenjaminDRichards
Copy link
Collaborator

Phaser 3.80 introduced new checks to ensure the validity of compressed textures. This is probably tripping those checks.

This example will use ASTC texture compression if it's supported on the current hardware. When I checked with my Android phone, it did indeed fail. This is because the ASTC texture it uses is 915x775px, but it has MIPMaps. MIPMaps under WebGL must have width and height both be powers-of-two, so it would have to be 1024x1024px to be valid.

The tools let us generate these invalid files, because they might be valid on some other systems. For example, OpenGL has some extensions which support non-power-of-two MIPMaps. But it's not valid on the Web.

There is probably a console warning in Chrome to let you know why Phaser rejected the file. Is that so?

There are two other compressed texture options in this example: PVRTC and S3TC. I can verify that S3TC works fine on Windows, which doesn't support ASTC or PVRTC. I think your Mac must be using ASTC, because the PVRTC texture appears to be well-formed. Can you confirm that? https://labs.phaser.io/view.html?src=src\textures\compressed%20texture.js should show which hardware feature the machine supports. (I tried to see for myself, but BrowserStack gave me a Mac with S3TC support.)

Compressed texture rules can be a bit obscure. The most general guideline is "everything supports power-of-two sizes". In fact, PVRTC and any format using MIPMaps require POT sizes. S3TC/S3TCSRGB, RGTC, and BPTC require sizes that are a multiple of 4. Everything else should just work. We're putting the finishing touches on an article about this, because compressed textures are so confusing and it's not always clear what you should and shouldn't do with them.

@yaustar
Copy link
Author

yaustar commented Mar 12, 2024

Can you confirm that? https://labs.phaser.io/view.html?src=src\textures\compressed%20texture.js should show which hardware feature the machine supports. (I tried to see for myself, but BrowserStack gave me a Mac with S3TC support.)

On my Mac, it's loading as
image

@BenjaminDRichards
Copy link
Collaborator

As I suspected. The Mac supports ASTC, so it's getting a file with problems we didn't know were problems until we went hard into WebGL's compressed texture treatment. I'll have to set aside time to recompress everything in the Examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants