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

feat: Add compressed textures support #72

Merged
merged 6 commits into from
Sep 3, 2024

Conversation

ddenisyuk
Copy link
Contributor

The image compression extension has been enhanced with the ability to generate ASTC, BC7, and supercompressed Basis textures.

ddenysiuk added 2 commits July 24, 2024 20:53
…ons runner: "error while loading shared libraries: libomp.so.5: cannot open shared object file: No such file or directory"
@Zyie
Copy link
Member

Zyie commented Jul 29, 2024

hey @ddenisyuk just back from holiday so will review this soon!

@norflin321
Copy link

norflin321 commented Aug 7, 2024

hey guys do you have an example of loading a spritesheet compressed with astc (either inside ktx container or not) in pixi 8?
i recently was trying to implement it, and encounter some issues:

  1. i am unable to load a astc texture or spritesheet without ktx container
  2. texture loaded from astc.ktx, looks dark and oversaturated
  3. i was able to load and render astc.ktx astc-4x4, but rendering astc-12x12 gives the following error: [.WebGL-0x138005ba100] GL_INVALID_VALUE: Compressed texture dimensions must exactly match the dimensions of the data passed in.
    I am using [email protected], and TexturePacker. Maybe these issues is not relevant to AssetPack?

also it it possible to specify either 4x4 or 12x12 astc pixel format, in implementation from this PR?) default 4x4 is mostly useless because textures takes more space than PNG, and ASTC usually used for mobile where game size is really important

@ddenisyuk
Copy link
Contributor Author

Hey @norflin321, it's hard to help you without examples, but you can check the test file to see how to load textures: https://github.com/pixijs/pixijs/blob/dev/tests/compressed/CompressedTextures.test.ts. Pixi, by default, expects a specific naming format for compressed textures: {name}.{format}.{extension/container}, like my-texture.astc.ktx.

Regarding item # 2, it could be related to a misconfiguration of 'Premultiplied Alpha' and/or 'Colorspace'.

also it it possible to specify either 4x4 or 12x12 astc pixel format, in implementation from this PR?) default 4x4 is mostly useless because textures takes more space than PNG, and ASTC usually used for mobile where game size is really important

yes, you can define preferable blocksize:

 compress({  
      png: true,
      webp: true,
      astc: {
          blocksize: "12x12"
       },
  }),

@ddenisyuk
Copy link
Contributor Author

hey @ddenisyuk just back from holiday so will review this soon!

hey @Zyie, any updates?

Copy link
Member

@Zyie Zyie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ddenisyuk sorry it took so long to review this

Overall this is a great PR, would it be possible to update the docs for this as well?

  • compress.mdx
  • texture-packer.mdx
  • spine.mdx

packages/assetpack/src/image/utils/compressSharp.ts Outdated Show resolved Hide resolved
packages/assetpack/src/image/utils/compressGpuTextures.ts Outdated Show resolved Hide resolved
@Zyie Zyie changed the title Compressed textures support feat: Add compressed textures support Aug 28, 2024
@Zyie Zyie merged commit 80d7e77 into pixijs:main Sep 3, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants