Jump to content

dds texture


Recommended Posts

Probably power of 2, and possibly being square.  Am in the process of re-designing compressed textures to also add the other types.  Did some work on 2.5, but did not actually change babylon.tools.dds.ts.  You might switch to 2.4, just to see if your DXT texture loads there, thus confirming my 2.5 engine changes or not.

Link to comment
Share on other sites

Try replacing with each of these one at a time from https://github.com/toji/texture-tester/tree/master/textures




when I downloaded your file, file explorer did not show a thumbnail.   I am getting thumbnails for these.  Also double check your rig is set to go by running :




Link to comment
Share on other sites

file explorer shows thumbnail in my PC (windows 10)

attached are two babylon files - "cube.babylon" and "boats.babylon" and two textures - .dds and .png

"cube.babylon" works, "boats.babylon" does not work

drag the file and texture into babylonjs sandox to see

if I edit the boats.babylon and change the texture to .png it works








Link to comment
Share on other sites

I am noticing that the existing implementation of the s3tc / dds texture container is missing a number of compressed formats:

  • DXT1 format with alpha
  • ATC format
  • ATC format with explicit alpha (ATCA)
  • ATC format with interpolated alpha (ATCI)

I have not figured out how to distinguish DXT1 from DXT1 with alpha in the dds container yet.  My changes expand the number of compressed formats from 3 to 50.  Also from a dds container, to dds, pvr, & ktx containers.  If you can get properties for your file from the program you used to convert to PNG, see if the format is one of the missing ones.

Will not be patching the existing code base.  Making all new classes.  Will see if your scene runs as getting closer to operational.

Link to comment
Share on other sites

I used one of the free online programs to convert DDS to png.

But let me see if I can find some more info about it.

"3 to 50" - impressive :)

Do not know much about DDS myself. I was trying to use some assets from the 0AD RTS game. Its an impressive open source game with lots of free nice low poly assets.Many of them use DDS.


Link to comment
Share on other sites

I have found a tool that will generate a wide variety of compressed textures in all 3 container formats, PVTTextTool.  When I open your file from this tool it identifies the format as BC2.


Here is where it gets confusing.  There are multiple names for the same thing that overlap.  In Wikipedia, s3tc / dds formats have FOURCC & DX 10 names.  BC2 corresponds to: DXT2 & DXT3.  WebGL only supports DXT1 (2 variations), DXT3, & DXT5.  Since you say it worked, but was garbled, I think it was DXT3.  DXT2 should generate an error in the console. 

Looks like existing code does not work.  I am not surprised.  The code looks very old, pre-typescript conversion.

Link to comment
Share on other sites

You are right. It is DXT3 format.

If I open the file as a binary file I see dwFourCC set to DXT3 (see attached screenshot)

I picked the structure info from








Link to comment
Share on other sites

  • 2 weeks later...


Did some more testing.

Looks like the DDS texture is being flipped along Y axis.

Tested on a simple cube.

Texture ended up being upside down on the cube face.

If I replace the texture co-ordinates U,V with U,1-V the mapping works perfectly 

issue seems similar to this



Link to comment
Share on other sites

Thanks,  I have done the first implementation of the Multi-Platform Compressed Texture feature.  Ended up only supporting Khronos Texture Containers (.ktx files).  .ktx worked so well, seems no reason to dink with DDS or PVR containers.  DDS is still there, but I did not touch it.

Am working on automated batch scripts to create all the formats of .jpg & .png files in a directory.  I converted the 100 images in the mansion demo, but when I ran the scene things looked out of place.  Think this is the same problem as you.

In Engine.createTexture(),  there is an invertY arg.  It value is set to true in the Texture constructor.  Looking down this function, we could easily disregard this for DDS & KTX and hard code where it gets passed to false.  It clearly needs to be true for image based textures.  @Deltakosh, does this make sense?

Link to comment
Share on other sites

Upside, I can generate the .ktx files pre-inverted.  Looks like no matter the value for gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, ...) it is effectively ignored.  I see others have reported the same thing

I re-generated the dxt mansion textures Y flipped, and they now work as expected.  The gl call is still ignored.

On to the next problem, on iOS what happens when pvrtc textures are not square.

Link to comment
Share on other sites

You do as you wish.  Should point out for historical purposes, that PVRTextTool also reads / writes .dds files. Link above.

Once file opened, you can goto Edit->Encode.  Pick bc2 & linear RGB after filtering for DirectX.  Check generate Mipmaps & Vertical Flip down at the bottom.  Click Encode button.  You will get 2nd picture, save that one with a .dds extension.

FYI, you should also include the .png when you publish.  If scene is loaded from Android, OSX, or iOS, it should fall back to the .png.  This was incorrectly changed in 2.6-alpha.  Fix will be part of my cleanup PR.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...