It is currently 16 Apr 2024, 17:50
   
Text Size

Gibbed Tools modified to support compressing of images

Moderator: CCGHQ Admins

Gibbed Tools modified to support compressing of images

Postby RiiakShiNal » 23 May 2013, 23:13

This post is to give everyone a modified version of Rick's great Gibbed Tools. The modified version supports compressing of images to DXT1, DXT3, and DXT5 in addition to default uncompressed TDXs.

The only real visible changes for users is the addition of some command line parameters for TdxConvert:
--d1, --dxt1 - Compress image to DXT1 format when converting to TDX.
--d3, --dxt3 - Compress image to DXT3 format when converting to TDX.
--d5, --dxt5 - Compress image to DXT5 format when converting to TDX.
--nomip - Do not create MipMaps when compressing to TDX.

Notes:
  • Now will automatically convert to closest multiple of four (MoF) image size when compressing images to TDX and will automatically create MipMaps for DXT compressed images (unless user specifies --nomip as a command line parameter).
  • While the TdxConvert program will accept images of any size for compression (and will decompress them properly) the game will only accept the compressed images if both width and height are multiples of 4.

This is based on Gibbed Tools r6_b10, I only added a relatively small amount of code so I take no credit. All credit should go to Rick (aka Gibbed).

If you are looking to compress one or more images via drag and drop then you can use these batch files:
TdxConvertDXT1.bat | Open
Code: Select all
@echo off
for %%A in (%*) do (
Gibbed.Duels.TdxConvert.exe --dxt1 %%A
)
TdxConvertDXT3.bat | Open
Code: Select all
@echo off
for %%A in (%*) do (
Gibbed.Duels.TdxConvert.exe --dxt3 %%A
)
TdxConvertDXT5.bat | Open
Code: Select all
@echo off
for %%A in (%*) do (
Gibbed.Duels.TdxConvert.exe --dxt5 %%A
)
To be honest I don't really think this is important enough for it's own thread, but I also didn't want to clutter Rick's thread with modifications that he doesn't support (because he didn't make them).

Change History:
  • February 9th, 2014
    • Removed even mipmap sizing as it was apparently causing the mipmap image appearance corruption. The mipmap sizing is not stored in the TDX and the game apparently expects the mipmaps to be 1/2 of each dimension truncated to a whole integer and doesn't care if the integer is an odd number.
  • July 5th, 2013
    • Fixed a bug with already MoF sizes.
    • Added automatic Multiple of Four (MoF) image sizing when compressing to TDX (no change in sizing will occur if converting uncompressed or if already MoF sized).
    • Added generation of MipMap chain when compressing to TDX (--nomip parameter will disable).
Attachments
Modified Gibbed Tools r6_b10 Source.zip
Source code for the pieces I modified (TdxConvert, FileFormats, and Squish) to put in TDX DXT compression.
(74.57 KiB) Downloaded 1914 times
Modified Gibbed Tools r6_b10 Binaries.zip
Gibbed Tools r6_b10 with my modified TdxConvert, FileFormats, and Squish. (Everything you need)
(153.9 KiB) Downloaded 2395 times
Last edited by RiiakShiNal on 10 Feb 2014, 00:55, edited 3 times in total.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Gibbed Tools modified to support compressing of images

Postby RiiakShiNal » 05 Jul 2013, 17:48

Sorry for the double-post, but I added MipMap generation and automatic MoF sizing to it. Attachments in the original post have been updated.

I figured if I didn't add a post no-one would notice.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Gibbed Tools modified to support compressing of images

Postby thefiremind » 05 Jul 2013, 18:27

I tried to use your updated tool for the 1024x1024 image, and it resized to 1028x1028. Why? 1024 is MoF already.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Gibbed Tools modified to support compressing of images

Postby RiiakShiNal » 05 Jul 2013, 19:01

thefiremind wrote:I tried to use your updated tool for the 1024x1024 image, and it resized to 1028x1028. Why? 1024 is MoF already.
Due to a bug, sorry about that, now fixed.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Gibbed Tools modified to support compressing of images

Postby thefiremind » 08 Nov 2013, 13:48

Since I wasn't sure if I was the only one who experienced the following issue, I waited a long time before reporting it, but I just read this and I'm pretty sure it's the same issue.
You see, your modified Gibbed Tools work perfectly for me for all kinds of DotP art except for one: tokens. When I compress a token picture, I see it scrambled in game:
token.png
Official 3/3 Beast token recompressed with your tools
token.png (18.96 KiB) Viewed 16440 times
This happens only while the card is laid on the battlefield: when I zoom in, the picture is fine.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Gibbed Tools modified to support compressing of images

Postby RiiakShiNal » 09 Nov 2013, 00:47

It seems to happen because of the dimensions, I see it when I compress images too. It seems to be more pronounced if the source X dimension is not evenly divisible by 8 or 16. According to some source I read on the web when you drop down one level and the current level has an odd dimension you are supposed to truncate the decimal after dividing by 2 (which I do when calculating the mipmaps), if the dimension is 1 however it remains at 1 until both dimensions are 1x1 at which point mipmap generation ceases. I'm not sure exactly where the problem is and I have been looking into it so I'm not yet sure if the problem is in the image created by the DXT compression library or if the problem is in how the game handles such situations. It is possible that the source I read was wrong (as there don't seem to be that many sources on manual generation) and you are supposed to round the decimal (in which case it would always round up due to being .5). Some sizes show this problem while other sizes don't (this seems to be static sizes that work always work sizes that don't always don't), so a current workaround is to resize the image up or down to a size that does work properly.

In short, I am aware of the problem and I am trying to find a good solution. Regardless though right now updates are going to be slow as I am having some hardware problems (one of the fans in my laptop died [this isn't a big problem] and I have 2 hard drives going bad [they are still at the early stages of going bad, but it is still causing some major problems]). My laptop is my development machine (as well as e-mail) so this is slowing me down.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Gibbed Tools modified to support compressing of images

Postby thefiremind » 09 Nov 2013, 10:30

Well, the problem doesn't bother me much: I kept using Eglin's tool for compressing token images, and your tools for everything else. I just wanted to be sure that you are aware of it. :)
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Gibbed Tools modified to support compressing of images

Postby Drakno » 02 Dec 2013, 16:57

What other programs should I have installed for gibbed tools to work? At the moment it instantly crushes
Drakno
 
Posts: 52
Joined: 15 Oct 2012, 19:03
Has thanked: 33 times
Been thanked: 2 times

Re: Gibbed Tools modified to support compressing of images

Postby RiiakShiNal » 02 Dec 2013, 22:49

Gibbed Tools uses the .Net 4.0 Framework which is not included, but that should be the only requirement. It should also work with Mono assuming Mono has support for the .Net 4.0 interfaces.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Gibbed Tools modified to support compressing of images

Postby RiiakShiNal » 10 Feb 2014, 01:10

I have just updated the Modified Gibbed Tools to put in a fix for the scrambled mipmaps as reported earlier.

It seems the problem is that the TDX format does not store the mipmap sizes and the game expects the sizes to be 1/2 of each dimension with any decimals truncated. So if we have a 388x316 image the sizes that the game expects should be as follows:
  • 388x316
  • 194x158
  • 97x79
  • 48x39
  • 24x19
  • 12x9
  • 6x4
  • 3x2
  • 1x1

A token with size 356x512 should now have these image & mipmap sizes:
  • 356x512
  • 178x256
  • 89x128
  • 44x64
  • 22x32
  • 11x16
  • 5x8
  • 2x4
  • 1x2
  • 1x1

The TdxConvert program will now output the compressed TDX to these specifications. So this should solve the last of the issues regarding the compression to TDX.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times


Return to Utilities

Who is online

Users browsing this forum: No registered users and 16 guests


Who is online

In total there are 16 users online :: 0 registered, 0 hidden and 16 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 16 guests

Login Form