Which texture format to use?

Can anyone recommend a texture format for use in lwjgl for 3d games? I need textures that support alpha, mipmaps, and texture compression. Obviously DDS is probably the best format for this but microsoft standards make me feel icky. I also have not found any java Image readers for DDS, and I don’t really want to write my own Image reader.

The java Image class only appears to support PNG, JPG, and GIF. None of these formats appear to properly support the alpha channel, although I could be mistaken.

Any advice?

A

PNG supports alpha perfectly well (1/8/16 bit). See my avatar? If you don’t use a crap browser you can see alpha transparency there.

And you could use even jpg - just use a rgb image plus a grayscale image (However, jpg for alpha can produce rather visible artifacts).

So just use PNG and walk over those files with PNGOUT at the end (for maximum compression).

There’s also a TGA loader floating around.

<- avatar infront of another background color :wink:

Thanks for the response.

Hmm I must be commiting User Error in photoshop 6.0. Whenever I save my pngs out it strips the alpha channel. Maybe I need a new file plugin for photoshop.

Assuming I get my PNG writing fixed, how do you handle mipmaps?

A

Whenever I save my pngs out it strips the alpha channel.

Hold ctrl and click on the alpha channel - now you have it as selection (eventually you have to invert the selection now… I’m not sure). Swith over to rgb and delete.

how do you handle mipmaps?

GLU can create’em for you. GLU.gluBuild2DMipmaps(…) does the trick. See here:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=LWJGL;action=display;num=1083425041

Hmm sorry this is getting offtopic but you seem to be able to help me :slight_smile:

I can follow your instructions but what I end up with is only RGB channels with the transparent areas ‘deleted’ from the channels. Most artists require the alpha channel to be seperate from the RGB so it can be painted onto.

If I attempt to save as PNG while I have my ARGB channels intact, photoshop cleverly unchecks & greys out the ‘Alpha Channels’ checkbox. It also annoys me with this message: “Some of the document’s data will not be saved using the chosen format and options.” Argh! I tried the SuperPNG plugin and that doesn’t seem to help.

Do you know of a plugin that lets you save and load the PNG with the alpha channel intact? The nvidia DDS plugin does this perfectly.

Thanks!

A

[quote]Do you know of a plugin that lets you save and load the PNG with the alpha channel intact? The nvidia DDS plugin does this perfectly.
[/quote]
With Photoshop I can’t help, but I can recommend Xnview to view, convert etc PNGs with our without alpha channel (it’s free for non-commercial usage).

Btw does anyone know how you could create a 32bpp alpha channeled PNG with Xnview when you’ve got a 24bpp picture plus an 8bpp alpha channel picture as input?

[quote]I can follow your instructions but what I end up with is only RGB channels with the transparent areas ‘deleted’ from the channels.
[/quote]
Yes, it’s deleted then if the default background was set to transparent then you have your final image. (You don’t need the seperate alpha channel anymore)

[quote]Most artists require the alpha channel to be seperate from the RGB so it can be painted onto.
[/quote]
Well, that’s just the finishing step. You can just go the 32bit tga route (I mean a sperate alpha channel) till the end, if you like.

Ahh cool. My photoshop problems are over. I even found a plugin floating around that saves/loads PNGs with a seperate alpha channel here:

http://www.shiftermod.com/board/index.php?showtopic=1715&st=0&#entry15638

Thanks all!

[EDIT 2005-08-02]
The link above seems to have broken, try this one instead:

http://www.fnordware.com/superpng/
[/EDIT]

Ah thanks for the link.

One thing to note: the way it’s implemented in PS makes more sense for most cases (were alpha is used for transparency) - all RGB values wich are in a 100% transparent area gets trashed and the remaining space gets filled with the last used color. That might sound a bit odd, but it results in better compression.

Well, no big deal as long as you don’t fill the 100% transparent areas with random dithered pixels :wink:

Hi, just wanna let u know I just finished a small tutorial for writing a DDS loader, currently works with DXT1-5 for 2d textures and cube maps. Mipmaps also supported.
Any feedback very much appreciated.
U can find it @ http://www.chriscohnen.de

yours
/Chris

[quote] Obviously DDS is probably the best format for this but microsoft standards make me feel icky. I also have not found any java Image readers for DDS, and I don’t really want to write my own Image reader.

The java Image class only appears to support PNG, JPG, and GIF. None of these formats appear to properly support the alpha channel, although I could be mistaken.

Any advice?

A
[/quote]