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

Add ASTC to image and VRAM compression for better quality on mobile platforms #5313

Closed
fire opened this issue Sep 3, 2022 · 6 comments
Closed

Comments

@fire
Copy link
Member

fire commented Sep 3, 2022

Describe the project you are working on

Godot Engine, and Social VR 3d game.

Describe the problem or limitation you are having in your project

As described by @reduz, Godot Engine doesn't understand what ASTC is and this means that visual quality is poor on mobile platforms.

Also ASTC in my experience tends to slowly encode.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Mobile devices uses ASTC, while PC uses BPTC and DXT5. So we need to support both.

ASTC also supports hdr textures.

Basisu is also able to transcode to ASTC.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  1. Add support for ASTC to Image. Image is designed for blocksizes powers of 2. ASTC has all sorts of blocksizes.

  2. Add
    https://github.com/ARM-software/astc-encoder to image and compression / or transcode UASTC.

  3. Pick fastest encoding quality because past experience says astc is slow

  4. Investigate https://github.com/Themaister/Granite/blob/master/assets/shaders/decode/astc.comp ASTC compute shader decoder

  5. Create a "default, quality" toggle in the texture import.

If this enhancement will not be used often, can it be worked around with a few lines of script?

ASTC is not trivial in compute time to encode.

Is there a reason why this should be core and not an add-on in the asset library?

Mobile platforms is part of our supported list.

@reduz
Copy link
Member

reduz commented Sep 3, 2022

The way I was proposing this to work is to have a "high quality" toggle in the texture import. If on, PC will import BPTC while mobile will use ASTC (high quality).

@Calinou Calinou changed the title Add ASTC to image and compression Add ASTC to image and VRAM compression for better quality on mobile platforms Sep 3, 2022
@Calinou
Copy link
Member

Calinou commented Sep 3, 2022

The way I was proposing this to work is to have a "high quality" toggle in the texture import. If on, PC will import BPTC while mobile will use ASTC (high quality).

For context, this approach is needed because BPTC/ASTC are notoriously slow to compress compared to S3TC and ETC2 (with libsquish and etcpak respectively).

ASTC is also not supported on old/low-end mobile devices, and as far as I know, BPTC isn't supported on macOS. Therefore, this has to be opt-in and should be enabled on a per-texture basis (as not all textures may benefit from the increased quality).

@reduz
Copy link
Member

reduz commented Sep 4, 2022

@Calinou M1 supports ASTC, so I guess if you want to use high quality stuff, either you support both or make two separate builds.

@Calinou
Copy link
Member

Calinou commented Feb 7, 2023

Is this implemented by godotengine/godot#72031?

@fire
Copy link
Member Author

fire commented Feb 7, 2023

As far as I know this is complete. I don't have an android device and exporting to ios is a pain.

@clayjohn
Copy link
Member

clayjohn commented Feb 7, 2023

Yep, this is implemented by godotengine/godot#72031. I tested on Android and ASTC is working there

@clayjohn clayjohn closed this as completed Feb 7, 2023
@clayjohn clayjohn added this to the 4.0 milestone Feb 7, 2023
@Calinou Calinou moved this from In Discussion to Implemented in Godot Proposal Metaverse Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Implemented
Development

No branches or pull requests

4 participants