Jump to content

Recommended Posts

Posted

Looking for some assistance in regards to KTX2 texture sizes.

I have converted my PNG files to KTX2 format using ImageToMSFSKTX2-main, but some of the textures sizes are double the size compared to the orginal house livery. For example...

PMDG House Livery:
77F1_A.PNG.KTX2 43,692 KB
77F2_A.PNG.KTX2 43,692 KB
77F3_A.PNG.KTX2 43,692 KB
77GE_A.PNG.KTX2 43,692 KB
77TAIL_A.PNG.KTX2 43,692 KB

My Livery:
77F1_A.PNG.KTX2 87,382 KB
77F2_A.PNG.KTX2 87,382 KB
77F3_A.PNG.KTX2 87,382 KB
77GE_A.PNG.KTX2 87,382 KB
77TAIL_A.PNG.KTX2 87,382 KB

I have tried using NVIDIA Texture Tools Exporter 2024.1.1 to convert the textures, but I have no idea what settings I should use for each textures.

With DDS textures, I could simply open the original texture file in Adobe Photoshop to be able to determine what the image should be saved as (DXT1, DXT5, Alpha, No Alpha, MipMaps, etc.)

How can I determine what settings I should use when saving each KTX2 files so that they match what the original PMDG textures are?

Thanks in advance,

CXA001-1.jpg

VATSIM: P2 | I1

Posted

Hi, I wrote the ImagetoMSFSKTX2 script. All it does is call the FS2024 SDK and ask it to compile a bunch of source images into KTX2 format. The actual creation of those KTX2 files is all done by the SDK, and to my knowledge there are no parameters you can set which influence the file size. I don’t own the aircraft you are working on, but I’m interested in figuring out the reason for the difference in the KTX2 files. Would you be able to share one set of example files with me? I.e one original KTX2 file plus your KTX2 file. 

Posted

Absolutely!  https://canadianxpress.ca/GetFile.aspx?File=KTX2Textures

I am not a KTX2 expert, but if I use a MSFS 2020 DDS file as an examoke, I think this is what is happening with the MSFS 2024 SDK.

The DDS texture in MSFS 2020 is saved as DTX1, No Alpha w/MipMaps.

The KTX2 texture in MSFS 2024 is saved as DTX5, w/Alpha w/MipMaps which explains the increase in texture size.

 

Regards,

CXA001-1.jpg

VATSIM: P2 | I1

Posted (edited)

Thanks for sharing those. Looks like I was wrong with my earlier statement "and to my knowledge there are no parameters you can set which influence the file size"!

I used NVIDIA Texture Exporter to view the "Input info" data embedded in the two KTX2 files - I think I found the difference - it's the x00QUALITY_HIGH flag. I can see the Vulkan format is also different but I see no way whatsoever to change that, unless it's perhaps driven by the x00QUALITY_HIGH flag.

Original KTX2 file

KTX file, version 2
Type: 2D
Extent: 8192 x 8192 px
Vulkan format: BC1_RGBA_UNORM_BLOCK (133)
Mips: 14
Is array texture: false
Faces: 1
Is premultiplied: false
Color space: Linear
Swizzle: {R, G, B, A}
Key/value data:
 ASOBO_flags: BILINEAR\x00COMPRESSION\x00MIPMAP\x00REDUCE_LESS\x00PLATFORM_FORMAT
 ASOBO_opacities:
 ASOBO_transp:
 ASOBOtexversion: \x01\x00\x00
 KTXwriter: ASOBO_FlightSim

Your KTX2 file

KTX file, version 2
Type: 2D
Extent: 8192 x 8192 px
Vulkan format: BC7_UNORM_BLOCK (145)
Mips: 14
Is array texture: false
Faces: 1
Is premultiplied: false
Color space: Linear
Swizzle: {R, G, B, A}
Key/value data:
 ASOBO_flags: BILINEAR\x00COMPRESSION\x00MIPMAP\x00REDUCE_LESS\x00PLATFORM_FORMAT\x00QUALITY_HIGH
 ASOBO_opacities:
 ASOBO_transp:
 ASOBOtexversion: \x01\x00\x00
 KTXwriter: ASOBO_FlightSim

When I first created my script I added that QUALITYHIGH flag to replicate whatever KTX2 I was generating from another 3rd party aircraft dev, they must have also used it. However I guess I should make it optional in my script.  I'll add this in the settings for the ImageToMSFSKTX2 script, however in the short term you can manually remove it from the XMLs generated by the script before running the command to generate the KTX2 files; just delete the QUALITYHIGH text from the <UserFlags> section; I haven't tested this but I think it should work. And actually the potential for manual edits to the XML files is exactly why I made it a two step process in the script! For details on the user flags check on this page in the MSFS 2024 SDK.

<BitmapConfiguration><BitmapSlot>MTL_BITMAP_DECAL0</BitmapSlot><UserFlags Type="_DEFAULT">QUALITYHIGH</UserFlags></BitmapConfiguration> 
 

Edited by FlakNine
Posted (edited)

This is great news!

I tested this on a smaller aircraft livery that does not have many textures and it works perfectly!

I have another question.

Most of my Albedo textures do not require the alpha channel. Can I just put these in the COMP folder that has a ForceNoAlpha: True flag or do I need to run the script and the add the ForceNoAlpha: TRUE in the XML File?

 

 

Edited by CXA001

CXA001-1.jpg

VATSIM: P2 | I1

Posted
3 hours ago, CXA001 said:

This is great news!

I tested this on a smaller aircraft livery that does not have many textures and it works perfectly!

I have another question.

Most of my Albedo textures do not require the alpha channel. Can I just put these in the COMP folder that has a ForceNoAlpha: True flag or do I need to run the script and the add the ForceNoAlpha: TRUE in the XML File?

 

 

Glad it's working! No you won't be able to put the Albedo images into the Comp folder, because they'll be assigned the wrong texture type by the SDK. Short term you can manually add the ForceNoAlpha flag to the XML, however I should have this feature added to my script fairly soon, along with the HighQuality flag.

Posted

 I have been working on a couple different liveries and by modifying the XMLs, I am getting the desired results.

I REALLY appreciate your help on this as well as all your hard work on this this tool.

They certainly have not made it easy in MSFS 2024.

CXA001-1.jpg

VATSIM: P2 | I1

Posted (edited)

OK so I think I got this working correctly in the new version of ImageToMSFSKTX2. Take a look at v0.13 here and see what you think.  You need to go into the settings page, and there you can toggle the state of the QUALITYHIGH and ForceNoAlpha flags.

At the moment I only made this change for Albedo textures. I can have independent settings for each texture type if it makes sense.

Edited by FlakNine
Posted

It would make sense to have independtent settings for each texture type, except for the DECAL which "normally" requires ForceNoAlpha to be set to False, but there always exceptions to the rule. 🙂

CXA001-1.jpg

VATSIM: P2 | I1

Posted

Do you know which are relevant for each texture type?

  • Albedo: can have both flags
  • Composite: not sure
  • Normal: always uses QUALITYHIGH, as per info in the SDK. Not sure if ForceNoAlpha is relevant here.
  • Decal: can probably have both flags
Posted

I added flags for DECAL too. For now I left Composite and Normal as hard-coded, but these can of course be added if there's a reason to do so.  Also did a small bit of UI rework - check out version 0.14 here.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...