Iris2.de

Iris2-Forum
It is currently Sat Dec 21, 2024 2:27 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon Jun 25, 2007 12:48 pm 
Offline
iris2-developer
User avatar

Joined: Mon Aug 09, 2004 12:20 pm
Posts: 1431
hi,

currently we have many different texture formats. I want to consolidate this, because of better handling. I thought of converting all current Textures to DDS.

Wikipedia:
http://en.wikipedia.org/wiki/S3_Texture_Compression

benefits:
- DDS is a raw surface dump and can be loaded directly into the graphiccard staying compressed in video ram
- it supports different compressions
- it supports different kinds of alpha channels (partial alpha if you use DXT2-5)
- it supports prcalculated Mipmaps in the same file
- Ogre uses a custom DDS codec and works also for OpenGL and Linux
- OpenGL + Linux Mipmap supported

drawbacks:
- real benefit only for DirectX (Windows) Users, because as far as I know it don't work with OpenGL (windows/linux). Using OpenGL, it must be decoded as all other Fileformats (png, tga, jpg).

addition: Using S3 (dxt) Texture Compression also in OpenGL - NVIDIA document

Quote:
steve (ogre developer):Thinking about it, our DDSCodec is only used for GL anyway since we short-circuit it for loading DDS in DirectX, since the DDS format is a raw surface dump and can be loaded directly into D3D with no decoding.



There are several types of DXT compression offered by DirectX:

DXT1
0 or 1 bit alpha
DXT2
Explicit 4-bit alpha, color data is premultiplied by alpha – UnrealEd does not use this format
DXT3
Explicit 4-bit alpha, not premultiplied
DXT4
Interpolated alpha, color data is premultiplied by alpha – UnrealEd does not use this format
DXT5
Interpolated alpha, not premultiplied

Which DXT Compression to Use?
Obviously, there are some trade-offs between the different formats which make them better or worse for different types of images. Some general rules of thumb for good use of DXT textures are as follows:

1. If your image has no alpha, use DXT1 compression. Using DXT3/5 will double your image size over DXT1 and not gain anything.
2. If your image has 1-bit (on or off) alpha information, use DXT1 with one-bit alpha. If the DXT1 image quality is too low and you don't mind doubling image size, use DXT3 or DXT5 (which one doesn't matter, they'll give the same results).
3. If your image has smooth gradations of alpha (fading in/out slowly), DXT5 is almost certainly your best bet, as it will give you the most accurate transparency representation.
4. If your image has sharp transitions between multiple alpha levels (one pixel is 100%, the next one is 50%, and another neighbor is 12%), DXT3 is probably your best bet. You may want to compare the alpha results in DXT1, DXT3 and DXT5 compression, however, to make sure.

Specification:
http://oss.sgi.com/projects/ogl-sample/ ... n_s3tc.txt

NVidia has some Tools on their Homepage to produce DDS files from Commandshell or Photoshop.

http://developer.nvidia.com/object/nv_t ... tools.html

The GIMP also has a plugin which can handle DXT-compressed DDS images.


Please tell me what you think of it.
This is a talk...so please write your opinions down.

regards

SiENcE


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 4:34 pm 
Offline
iris2-developer
User avatar

Joined: Tue Apr 18, 2006 10:28 pm
Posts: 823
Location: Munich, Bavaria, Germany
i would prefer sticking to standard formats (jpg,png,tga..) that can be saved, edited and viewed in all common graphic programs without installing third party plugins.
there might also be legal issues, microsoft and directx stuff tends to be proprietary.
we cannot convert the granny textures anyway so it will not improve the performance hit when a model appears, and we don't load static textures every frame, so i don't see much performance benefit either....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 5:53 pm 
Offline
iris2-developer
User avatar

Joined: Mon Aug 09, 2004 12:20 pm
Posts: 1431
Why you are talking about Microsoft? Please dont think every time on Microsoft and I dont want to talk every time against or pro MS with you. ok!

It's from S3. "All" Graphiccard use this Hardware Texture DeCompression.

DXT1-5 compression is Standard for most 3D Games.

I wrote the benefit already.
-precalc Mipmaps
-better handling of Alphachannels
-i posted links to tools supporting dds (also gimp)

I dont want to convert Granny stuff. I talk about the new Terrain Engine Textures and the Static Model Textures.

We need to consolidate the texture fileformats!

I dont like the mix of tga, dds, png aso. These are all picture formats...not for graphiccard textures.


Last edited by SiENcE on Mon Jun 25, 2007 6:03 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 6:00 pm 
Offline
iris2-developer
User avatar

Joined: Mon Aug 09, 2004 12:20 pm
Posts: 1431
Ah and i forgot.

big benefit:
-it saves vram, because the compressed dds file its directly transfered to vram

more Infos here:

http://www.sjbrown.co.uk/?code=squish


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 6:48 pm 
Offline
iris2-developer
User avatar

Joined: Mon Aug 09, 2004 12:20 pm
Posts: 1431
Here is a quick comparsion between dxt compressed files and png/jpg.

I converted only the last 4 Textures (that are not dds) from our Terrainshader Engine to DDS. The converted DDS Files also include "10" pregenerated Mipmaps.

Dirt_large_pattern_1024.jpg
Grass_large_pattern_1024.jpg
Mountain_large_pattern_512.jpg
Water01.png


Memory difference:
jpg:
44,39mb vram - Ogre internal vram usage
53,38mb vram - external Vram Watcher Tool

dds:
37,17mb vram - Ogre internal vram usage
43,76mb vram - external Vram Watcher Tool

2second scene:
jpg:
54,7mb vram - Ogre internal vram usage
63,7mb vram - external Vram Watcher Tool

dds:
49,3mb vram - Ogre internal vram usage
55.24mb vram - external Vram Watcher Tool

Only 4 files with mipmaps saves 10mb of vram. I think thats a very good argument.

Ah and its the same for DirectX or OpenGL. It saves on both 3D interfaces ~10mb vram. :)

ps: when i also convert the skybox to dds (without mipmaps) the first scene look like this:

32,79mb vram - Ogre internal vram usage
37,92mb vram - external Vram Watcher Tool


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 9:32 pm 
Offline
Power User
User avatar

Joined: Wed Jun 08, 2005 1:22 pm
Posts: 119
ghoulsblade wrote:
i would prefer sticking to standard formats (jpg,png,tga..) that can be saved, edited and viewed in all common graphic programs without installing third party plugins.
there might also be legal issues, microsoft and directx stuff tends to be proprietary.
we cannot convert the granny textures anyway so it will not improve the performance hit when a model appears, and we don't load static textures every frame, so i don't see much performance benefit either....


As with any asset, source file has to be included. Using dds as such file is not a good idea (obviously). I wouldnt be too concerned about this, as long as lossless version is provided so we dont end up in similar situation like we have with current models from first version of iris.

Other than that, dds is a good choice. However, only for final stuff, not for WIP.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 9:39 pm 
Offline
iris2-developer
User avatar

Joined: Mon Aug 09, 2004 12:20 pm
Posts: 1431
Yes.

Submitted in our graphic repository should be also the raw texture stuff (i prefer *.tga).


Another explanation about DXT texture compression from the "infinity" project.

found here:
http://www.gamedev.net/community/forums ... ?jn=263350

Quote:
My main work in the past 2 weeks has been to implement texture streaming. To do that, I introduced a new file format: .TXB files. TXB litteraly means "TeXture Binary". In a .TXB file is stored the texture in DXT compressed ( or uncompressed ) format, and all its mipmaps.

I'm using the squish library to perform texture compression. It's extremely easy to use, and features many encoding algorithms, of variable performance/quality. When a texture is stored compressed on disk, the compression ratio is around 1:4 to 1:6, and can be uploaded directly to the video card without any trick. It's an order of magnitude faster than the old way ( which was to upload the uncompressed texture, and do the texture compression on the fly via the driver ).

Small story: when I first benchmarked the upload of textures in compressed form, I was disapointed by the performance. It was slower than uploading an uncompressed texture and compressing it through the driver. After some debugging, I realized that I forgot to upload the mipmaps, and had let the driver do the mipmaps generation. I bet that internally, it had to decompress my newly-uploaded compressed texture, generate the mipmaps, and for each of those do the compression again :) After I submitted the mipmaps in compressed form too, performance went as expected :) End of small story.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group