# Texture compression formate for desktops, specifically osx?

**URL:** <https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567>\
**Category:** Questions\
**Created:** [January 5, 2019, 12:59am UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567 "2019-01-05T00:59:23Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [January 5, 2019, 12:59am UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/1 "2019-01-05T00:59:23Z")

</div>

I am trying to experiment with compressed textures as a means of improving performance, but I’m not sure which format I need to use for my app, which is osx/windows (and trying on osx first, as that is what I am developing on) – I made a script to compress my assets based on this library [GitHub - TimvanScherpenzeel/texture-compressor: CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container.](https://github.com/TimvanScherpenzeel/texture-compressor) which lists S3TC as the correct format for OSX / win - But it does not seem to be working, and I can’t find anything about OSX on [Babylon.js Documentation](https://doc.babylonjs.com/resources/multi-platform_compressed_textures) – Anyone know which format I should be using for OSX?

---

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [January 5, 2019, 4:25pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/2 "2019-01-05T16:25:36Z")

</div>

Ok so, I’m not sure about S3TC or whatever, but the script output the files as .dxt3.ktx - I was doing 2 things wrong, needed to change the file extension to .dxt.ktx, and needed to set:

```javascript
    var available = ['-astc.ktx', '-dxt.ktx', '-pvrtc.ktx', '-etc2.ktx', '-etc1.ktx'];
    var formatUsed = engine.setTextureFormatToUse(available);

```

At which point it will make requests to the server for -dxt3.ktx files. HOWEVER:  
It’s still broken in my app. Running electron / still stuck on babylon 3.1 alpha 7 release. – Does anyone know if something changed in babylon to add support or fix a bug with those texture files? I am getting a

[29365:0105/091850:ERROR:gles2\_cmd\_decoder.cc(8605)] [.Offscreen-For-WebGL-0x7f8e978fc200]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

Error whenever I try to load a compressed texture. (And here is a working example of using one of the textures my script output in a playground)

[https://www.babylonjs-playground.com/#1SCH7H#23](https://www.babylonjs-playground.com/#1SCH7H#23)

---

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [January 5, 2019, 4:38pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/3 "2019-01-05T16:38:55Z")

</div>

GL version in my app is  
\_glVersion:"WebGL 2.0 (OpenGL ES 3.0 Chromium)  
So I assume I can safely rule out electron as the problem?

---

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [January 5, 2019, 6:49pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/4 "2019-01-05T18:49:53Z")

</div>

Also found an issue with older chromium regarding ktx, so I updated my electron app to most recent version, which uses Chrome/69.0.3497.106 – Still same issue. So I’m thinking it’s babylon, just not sure what would have changed or how to backport it.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 7, 2019, 5:28pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/5 "2019-01-07T17:28:52Z")

</div>

There were a couple of fixes on ktx in the latest version and the previous. Could you try with latest ? or create a play ground using some of the broken textures ?

So that we could pin point the issue ?

---

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [January 8, 2019, 1:20am UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/6 "2019-01-08T01:20:35Z")

</div>

@sebvan well I don’t think the issue can be recreated on PG now since it seems to be only in my local project (on 3.1.alpha6), I’m version locked by a really nasty bug ATM, so can’t upgrade for now. But that’s helpful to know that fixes happened, maybe I can backport the fixes into my version

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 8, 2019, 12:21pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/7 "2019-01-08T12:21:34Z")

</div>

Are you blocked by a BJs bug? Can we help?

---

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [January 8, 2019, 2:41pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/8 "2019-01-08T14:41:27Z")

</div>

@Deltakosh TBH, I’m still not sure, it’s [Huge performance hit after upgrading from 3.1.0-alpha3.5 to 3.1.0-alpha3.7 - Questions & Answers - HTML5 Game Devs Forum](http://www.html5gamedevs.com/topic/33800-huge-performance-hit-after-upgrading-from-310-alpha35-to-310-alpha37/)

I THINK, it’s an issue with my app that surfaced due to changes to clone behavior (or rather the helper method used within the clone method), but not an issue with babylon itself. – I spent so much time trying to figure it out unsuccessfully that I promised myself I would finish game before attempting to upgrade again. Though I suppose I’ve refactored enough since then and fixed enough other issues, that maybe I should give it another try.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 8, 2019, 3:45pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/9 "2019-01-08T15:45:40Z")

</div>

Ok let us know:)

---

<div class="post-metadata">

**Author:** ![Alex\_B](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Alex\_B](https://forum.babylonjs.com/u/Alex_B)\
**Post date:** [December 2, 2019, 12:20am UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/10 "2019-12-02T00:20:44Z")

</div>

I’m running into the same issue. Just as a test, I downloaded this example normal map:

[![](https://docs.unity3d.com/uploads/Main/BumpMapTexturePreview.png) ](https://docs.unity3d.com/uploads/Main/BumpMapTexturePreview.png)

I ran it through the texture-compressor [npm](https://www.npmjs.com/package/texture-compressor) module and outputted a dxt file using all defaults, but when I try and use it I get the same error.

Looking at the playground above, it seems as though the issue is still present in v4.1:

[https://www.babylonjs-playground.com/#1SCH7H#23](https://www.babylonjs-playground.com/#1SCH7H#23)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [December 2, 2019, 3:50pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/11 "2019-12-02T15:50:34Z")

</div>

Well in your PG you are using ktx format but you are pointing to a jpg

---

<div class="post-metadata">

**Author:** ![Alex\_B](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Alex\_B](https://forum.babylonjs.com/u/Alex_B)\
**Post date:** [December 2, 2019, 4:10pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/12 "2019-12-02T16:10:57Z")

</div>

I think that’s the way it’s supposed to work? You reference a png or jpg, and the `createTexture` method subs out the extension. So in this case, it’s subbing out `myfile.jpg` with `myfile-dxt.ktx`

The issue is that ktx files created with texture-compressor are not working with Babylon. If you look at the code for that library, it’s just a wrapper for the PVR Tex tool, and the same files work with ThreeJS.

EDIT: I just referenced this PG because the actual files I’m working with are IP and I can’t share them 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [December 2, 2019, 4:25pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/13 "2019-12-02T16:25:12Z")

</div>

> [@Alex\_B](#):
>
> I just referenced this PG because the actual files I’m working with are IP and I can’t share them

Ok so thats why 🙂

Pinging @sebavan if he has a few cycles

---

<div class="post-metadata">

**Author:** ![Alex\_B](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Alex\_B](https://forum.babylonjs.com/u/Alex_B)\
**Post date:** [December 2, 2019, 4:29pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/14 "2019-12-02T16:29:52Z")

</div>

Thanks 🙂

I searched for this issue and found that someone had already discovered the same problem so I just piggybacked on this thread 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 2, 2019, 4:44pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/15 "2019-12-02T16:44:47Z")

</div>

it is because by default Babylon use mipmaps (opposite of three), and you need to disable them on this texture: [https://www.babylonjs-playground.com/#1SCH7H#33](https://www.babylonjs-playground.com/#1SCH7H#33)

Most of the time they would be needed 🙂

---

<div class="post-metadata">

**Author:** ![Alex\_B](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Alex\_B](https://forum.babylonjs.com/u/Alex_B)\
**Post date:** [December 2, 2019, 7:48pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/17 "2019-12-02T19:48:29Z")

</div>

Yep, that solves the problem. So mipmaps won’t work with KTX? Or the KTX has to be created with mipmaps as a setting?

---

<div class="post-metadata">

**Author:** ![Alex\_B](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Alex\_B](https://forum.babylonjs.com/u/Alex_B)\
**Post date:** [December 2, 2019, 8:01pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/18 "2019-12-02T20:01:08Z")

</div>

Answered my own question. In `texture-compressor`, there’s a flag for mipmaps. Set that to “true” and that also solves the problem.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 2, 2019, 8:02pm UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/19 "2019-12-02T20:02:04Z")

</div>

yup you can not generate mip maps at runtime if the base level is compressed.

---

<div class="post-metadata">

**Author:** ![thrice](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thrice/32/105_2.png) [@thrice](https://forum.babylonjs.com/u/thrice)\
**Post date:** [December 3, 2019, 1:49am UTC](https://forum.babylonjs.com/t/texture-compression-formate-for-desktops-specifically-osx/567/20 "2019-12-03T01:49:56Z")

</div>

Not a direct answer, but I’d recommend looking into using basis compression instead, as that’s what I ended up doing and it’s been great so far
