Home Technical Talk

Dxt 5 to dxt1 without recompressing

polycounter lvl 18
Offline / Send Message
oXYnary polycounter lvl 18
Is there any tools that will allow me to take the data from the rgb and make a dxt1 with no alpha? I thought the only difference between the formats was the full greyscale alpha the dxt5. So, in theory, if something could strip away that channel. It would work as a dxt1? Glancing over the nvidia texture tools command line. I dont see a command like this.

Replies

  • Eric Chadwick
    Nope don't think so. I would suggest recompressing from a lossless source, like a PSD or TGA.

    But recompressing shouldn't change it drastically anyhow, they use the same basic RGB compression. Just load the dxt5 in Photoshop, ditch the alpha, and save as dxt1.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    oXYnary wrote: »
    Is there any tools that will allow me to take the data from the rgb and make a dxt1 with no alpha? I thought the only difference between the formats was the full greyscale alpha the dxt5. So, in theory, if something could strip away that channel. It would work as a dxt1?.

    No, this is not how DXT compression works.
    More info: http://en.wikipedia.org/wiki/S3_Texture_Compression

    You're going to have to re-save it, saving from the DXT5 to DXT1 is probably gonna lose a little more quality but hopefully not too much. I would definitely re-save from the original PSD or lossless image if possible.
  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    Resaving a dxt texture over and over again does not reduce it's quality. I've had to do this a couple times at work and compared the before and after. It's true with a format like .jpg each time you save it gets worse and worse. I just tested going from dxt5 to dxt1 no quality loss there either.
  • Jonathan
    Unless you're using a shader permutation, you aren't going to notice a quality increase going from DXT1 to DXT5, you'll just have an alpha channel that now has the same compression quality of all three (RGB) channels combined, hence the doubling of memory going from DXT1 to DXT5. Unless I'm mistaken, the RGB channel compression ratio of a DXT1 and DXT5 are both a 5:6:5 compression ratio.
    http://www.3dfergy.com/3.html
    RGBcomprEx2.gif
  • oXYnary
    Offline / Send Message
    oXYnary polycounter lvl 18
    Phoey! Well there goes the shortcut idea. (Goes and looks for psds of all files)

    Thanks for the responses.
  • Jonathan
    Why don't you just open the DXT file in Photoshop, and resave it as DXT1 (4bpp)?
    http://developer.nvidia.com/object/photoshop_dds_plugins.html
  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    oXynary our tech artist at work is using the nvidia texture tools command line to convert whole folders of tga's into dxt1 perhaps you can do the same for dxt5 to dxt1?
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    I'm curious as to how many studios actually save out stuff directly to DDS format?

    Our engine automatically converts TGA files to the appropriate file format at run-time so we never even have to deal with DXT compression. Everything gets flagged as the correct type and compressed accordingly - LATC for normal-maps, DXT5 for specular with gloss in alpha channel, DXT1 for diffuse only or DXT5 if the diffuse has opacity in the alpha channel.
    It seems like Unreal tech works in a similar way - you load in TGAs and they get compressed accordingly (and in both engines you get the option to specify texture flags which affect how it's compressed)

    I always found this pretty nice since you never deal with compressed textures yourself, it just happens magically in the background. Are there any real upsides to directly using DDS?
    The only thing I can think of is that you get to edit mip-maps manually if you need to. Personally I have never had to do this, but I've heard some people occasionally need to edit mip maps for quality reasons.
  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    Hi Mop, yes there are upsides to directly using dds textures. In most 3d apps psd and tga both take a lot of memory so loading big scenes becomes a huge hassle and crash often due to memory constraints. On need for speed undercover we authored the whole world directly in max and using psd's plugged into the shaders killed us, we were seriously loading the world in chunks in max in wireframe and if you accidentally turned textures on you got about 3 clicks before it ran out of memory and crashed. dds is much smaller in the video memory so I strongly recommend viewing these directly in your 3d app. It's also nice to see in the 3d app what the texture actually looks like compressed. Another advantage is if you are authoring dds directly rather than tga's other team members don't need to build the textures folder when they get a new build or open your level for the first time and export. I never understood why artists save as tga and then have the pipe generate dds files from the tga's. Why not cut out the middle man and just save the dds, you're already saving the tga so now you're doing a manual save step and then waiting for the pipe to build your textures as well? Ideally for artists I would recommend just using psd's and having the pipe automatically create dds versions of them when the artist saves the texture in photoshop. We had something similar working back in 2005 on nba street home court. Our texture pipe was save psd visible layers would get into the game, reload the texture in the 3d app and it would generate a tga for viewing in the 3d app. When you exported the scene it would look for what tga's had been updated and create updated dds textures for those only to save on build time. There's no reason you couldn't cut out the middle man there too and just go from psd directly to dds in the pipe. Sorry that is a big block of text, for me it's time saved in the build step and memory saved in the viewport.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Thanks for the run-down Malcolm, that's good information and interesting points.

    I hadn't considered the memory-in-application thing, since I'm a character/weapon/item guy at work I tend to deal with scenes that only contain a few textures (a bunch of 1k - 2k diffuse, normal, spec etc) so texture memory and load time is never really a problem.

    Good point about getting to see the compressed image in the 3d app, although in our pipeline we tend to view our stuff directly in the game's model viewer (everything gets exported and processed immediately, so reloading the current model & textures only takes a fraction of a second in most cases), and we get to see it using the compressed textures at that point, with all the postprocessing and colour correction from whatever game atmosphere is applied. We can't do that in Maya without writing a custom OpenGL renderer for the viewport, the closest you can get is a .fx shader (which we have, and it works fairly well, but it's still not a 1:1 correspondance with what you will see in-game with all the bloom/tinting/Depth-of-Field etc going on).

    Everything gets exported from Maya and Photoshop using custom scripts and the game detects changed files to auto-reload them, so it's a pretty fast turnaround time (hit F8 in PS to save your layer groups to separate TGA files, then alt-tab to the game's model viewer and they auto-update and compress on the fly).

    We don't tend to build large levels in Maya alone, we have the in-game editor for that, so again texture memory isn't a problem as it's all streamed and managed by the game itself rather than Maya or Max (which always seem to be hugely inefficient when it comes to managing texture memory!).

    Interesting points though, I guess it really depends on the sort of work you're doing and what tech you're working with, which will determine the best workflow.
  • oXYnary
    Offline / Send Message
    oXYnary polycounter lvl 18
    That or you work with older tech and dont have the resources of a huge company to make transparent/hidden conversions for the artist like you AA spoiled artists get.

    jk ;)
  • malcolm
    Offline / Send Message
    malcolm polycount sponsor
    oXYnary, actually it's funny I work for tiny company of 60 people now and our texture pipe is save psd, save dds through nvidia photoshop plugin. All the pipe does is look for a time stamp and copy the dds file to the xbox360. I find this method to be the most efficient in terms of time wasted after hitting the export button but it would be nice for the artists if they could just save the psd and it would magically work out in the end.

    Mop, yeah my whole career I've been creating environments in maya or max as the level editor rather than an external editor/viewer, you guys are probably way more used to what you see is what you get. All we see in maya is diffuse textures and our blend shader, lighting, post fx, and atmosphere all need to be viewed in game.
Sign In or Register to comment.