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

HTML5 - GPU / Game engine optimised textures #1351

Open
onelsonic opened this issue Jul 20, 2021 · 1 comment
Open

HTML5 - GPU / Game engine optimised textures #1351

onelsonic opened this issue Jul 20, 2021 · 1 comment

Comments

@onelsonic
Copy link

Fixing GPU memory bottleneck with GPU optimised Textures.

the HTML5 backend workflow picks up textures as PNG, JPG or HDR.

However these textures are not optimised for GPUs. Having optimised GPU textures can really improve real-time performances and GPU available memory.
It would be ideal to have ASTC format added.
https://www.khronos.org/blog/create-astc-textures-faster-with-the-new-astcenc-2.0-open-source-compression-tool

ASTC Textures can be loaded as javascript Blob objects and generated using the appropriate tool:

ASTC:
https://github.com/ARM-software/astc-encoder

Example :
how to load AST textures in HTML5/WebGL:

var ext = gl.getExtension('WEBGL_compressed_texture_astc');

var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);

gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_RGBA_ASTC_12x12_KHR, 512, 512, 0, textureData);
@RobDangerous
Copy link
Member

It's generally just called compressed texture formats and there's some support for that already, however not for html5. It's activated using something like project.addAssets('assets/**', { quality: 0.5 }); in your khafile. Feel free to send a pull-request to make it work in html5. Also please note that the astc-encoder is currently only compiled for Windows (see Kha/Kinc/Tools/kraffiti/Datatypes).

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

No branches or pull requests

2 participants