texture optimization
-
Paulov
- Greenskin
- Posts: 126
- Joined: Tue Apr 04, 2006 5:18 pm
- Location: San Sebastian / Europe
texture optimization
EO
I use Photoshop to edit my textures, then I save a hi-res PSD and export optimzed textures with different sizes to use them in RT.
I´ve been exporting everything in .jpg since I´ve been developing for RT in VRML and the sice did matter.
Now the sice does not matter so much because of the DSL´s and because Ogre content can go in other non online projects, I´ve started to use other formats such as .TGA & .DDS.
I like them because have alpha channel and dont expand their sice like gas when loaded in memory.
I love the tool of optimizing images for web that comes with Photoshop, it´s very nice because you can see the original one in one sice and the modified one in other and also show the filesice.
So is there any similar tool / plugin that works with .TGA & DDS files?
how do yo control the texture sices when exporting to those formats?
just that
byeee
PablO
I use Photoshop to edit my textures, then I save a hi-res PSD and export optimzed textures with different sizes to use them in RT.
I´ve been exporting everything in .jpg since I´ve been developing for RT in VRML and the sice did matter.
Now the sice does not matter so much because of the DSL´s and because Ogre content can go in other non online projects, I´ve started to use other formats such as .TGA & .DDS.
I like them because have alpha channel and dont expand their sice like gas when loaded in memory.
I love the tool of optimizing images for web that comes with Photoshop, it´s very nice because you can see the original one in one sice and the modified one in other and also show the filesice.
So is there any similar tool / plugin that works with .TGA & DDS files?
how do yo control the texture sices when exporting to those formats?
just that
byeee
PablO
-
irrdev
- Orc
- Posts: 420
- Joined: Sun Oct 15, 2006 7:30 pm
I can't speak for TGA, since I don't use it myself. However, the DirectX Texture Tool which comes with the DirectX SDK does a very good job of optimizing the dds format. You would create your entire texture in Photoshop, export to tga, jpg, bmp or hdr and then load the image as a surface in DX Texture Tool. 
FeedLaunch .NET RSS and ATOM feed editor- open-source and released under the GPL. Visit Feed Launch .NET Project Website hosted at sourceforge.net
-
Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Try the Nvidia photoshop dds plugin (no idea if it works on non-nvidia hardware).
http://developer.nvidia.com/object/phot ... ugins.html
It can provide side by side comparisons of 10 or so pixel formats (compressed and raw) of an image before saving.
http://developer.nvidia.com/object/phot ... ugins.html
It can provide side by side comparisons of 10 or so pixel formats (compressed and raw) of an image before saving.
-
Edman
- Silver Sponsor

- Posts: 76
- Joined: Fri Jun 30, 2006 6:57 pm
- Location: Prague, Czech Republic
dds plugin
It works well on non-nVidida hw. Good thing about this is that you also have some other export choices e.g. for normal maps. There is also another plugin from nVidia - theNormalMapFilter, which might be of good use and works perfectly with dds format export. One of my ex-colleagues made a beatiful tool too... the DDS Viewer... simulates ACDSee on dds format. I would recommend to use dds instead of tga, but there is one main glitch. Tga is rather big for larger amount of textures - the dds on the other hand has some nasty compression which might degrade te look of the entire texture if it is not hi-res. Normal maps on dds also have some unwanted noise in them (even if switched to tangent space).
"Threehandled Mosscovered Gredunza"
-
Paulov
- Greenskin
- Posts: 126
- Joined: Tue Apr 04, 2006 5:18 pm
- Location: San Sebastian / Europe
Hi
Thanks for your answers. I´m back from vacational stop.
I´ve exported the textures to TGA and DDS to see the variation in sice.
Hi res floor slab in 400x400px:
TGA: 469 Kb
DDS: 313 Kb
Lo res flor slab in 50x50px
TGA: 8Kb
DDS: 6Kb
There is not an enormous difference in sice.
DDS has one limitation that I really dislike and is that it forces you to have a texture sice that is "power of 2". It is quite anoying.
For example if you have a rectangular panel, whad should I do?
Make it square sice and fill the rest with a plain color?
Or resample de image so that is looses resolution in one direction?...
Also another thing that I´ve found in the DDS export options panel is the mipmap generation option, it looks interesting.
If I create tha DDs with those mipmaps can I forget from creating by hand the material LODs? I mean, does it create and automatic LOD according to the autogenerated mipmap images?
I´ve used the NVIDA'S photoshop pluggin for DDS.
And to controld the sices in "real time" I´ve put the output directory in the left monitor and photoshop in the right one, so I can see the final sice in a matter of seconds.
Another thing I would like to comment is about the expansion of the sice in memory, is there any average percentage of the variation in sice for TGA & DDS files? so that I can have a reference on how will a texture affect the general performance....
EDIT: now, when doing material LODs I´ma seeing that very low rex 50x50px textures show small white/bright borders, that dont look very nice. I´ll have to check what happens with DDS´s...
thanks
Pablo.
Thanks for your answers. I´m back from vacational stop.
I´ve exported the textures to TGA and DDS to see the variation in sice.
Hi res floor slab in 400x400px:
TGA: 469 Kb
DDS: 313 Kb
Lo res flor slab in 50x50px
TGA: 8Kb
DDS: 6Kb
There is not an enormous difference in sice.
DDS has one limitation that I really dislike and is that it forces you to have a texture sice that is "power of 2". It is quite anoying.
For example if you have a rectangular panel, whad should I do?
Make it square sice and fill the rest with a plain color?
Or resample de image so that is looses resolution in one direction?...
Also another thing that I´ve found in the DDS export options panel is the mipmap generation option, it looks interesting.
If I create tha DDs with those mipmaps can I forget from creating by hand the material LODs? I mean, does it create and automatic LOD according to the autogenerated mipmap images?
I´ve used the NVIDA'S photoshop pluggin for DDS.
And to controld the sices in "real time" I´ve put the output directory in the left monitor and photoshop in the right one, so I can see the final sice in a matter of seconds.
Another thing I would like to comment is about the expansion of the sice in memory, is there any average percentage of the variation in sice for TGA & DDS files? so that I can have a reference on how will a texture affect the general performance....
EDIT: now, when doing material LODs I´ma seeing that very low rex 50x50px textures show small white/bright borders, that dont look very nice. I´ll have to check what happens with DDS´s...
thanks
Pablo.
-
irrdev
- Orc
- Posts: 420
- Joined: Sun Oct 15, 2006 7:30 pm
Maybe the Photoshop exporters don't allow non-power of 2 dds textures, but Microsoft DirectX Texture Tool does. I recommend downloading the December 2006 DirectX 9.0c SDK and giving the tool a try.DDS has one limitation that I really dislike and is that it forces you to have a texture sice that is "power of 2". It is quite anoying.
FeedLaunch .NET RSS and ATOM feed editor- open-source and released under the GPL. Visit Feed Launch .NET Project Website hosted at sourceforge.net
-
Paulov
- Greenskin
- Posts: 126
- Joined: Tue Apr 04, 2006 5:18 pm
- Location: San Sebastian / Europe
Hi
Well Irrdev, I was a bit wrong, the limitation is that textures must be in length&width divideable / 4 (84/4=21) -->OK (85/4=16,8 )-->wrong sice.
i.e: 444x140px is a correct sice.
This is a very flexible limitation, so no problem with this.
___________________________________________________________
I export 2 resolution textures, HI & Lo res, for the material LODs, but I´m having a VERY strange ressult with lo-res ones, it uses to appear a group of pixels in the top, right corner of the texture that makes the tiling visible and destroy the visual effect.
as you can see in the fifth image also happens with Hi-res but less noticeable.
In the last image I´ve put the lo-res texture bigger to show that no black pixels are in it.

I´m also having problems with the material LODs, showing only the lo-res textures even the two tecniques ar ON and they are set in the correct order, can be something related with the DDS format?
Should I create a ingle texture with mipmaps and do all in a single technique??
I´v finally moved to DDS becaue its sice is lower than TGA, and because it can run compressed in most graphic cards, allowing me more textures.
Thanks.
PAblo
Well Irrdev, I was a bit wrong, the limitation is that textures must be in length&width divideable / 4 (84/4=21) -->OK (85/4=16,8 )-->wrong sice.
i.e: 444x140px is a correct sice.
This is a very flexible limitation, so no problem with this.
___________________________________________________________
I export 2 resolution textures, HI & Lo res, for the material LODs, but I´m having a VERY strange ressult with lo-res ones, it uses to appear a group of pixels in the top, right corner of the texture that makes the tiling visible and destroy the visual effect.
as you can see in the fifth image also happens with Hi-res but less noticeable.
In the last image I´ve put the lo-res texture bigger to show that no black pixels are in it.

I´m also having problems with the material LODs, showing only the lo-res textures even the two tecniques ar ON and they are set in the correct order, can be something related with the DDS format?
Should I create a ingle texture with mipmaps and do all in a single technique??
I´v finally moved to DDS becaue its sice is lower than TGA, and because it can run compressed in most graphic cards, allowing me more textures.
Thanks.
PAblo
-
Edman
- Silver Sponsor

- Posts: 76
- Joined: Fri Jun 30, 2006 6:57 pm
- Location: Prague, Czech Republic
DDS
Hi Paulov
The main problem about the forced size is that - well I´m not absolutely sure, but I think it is true after all - some graphic cards are doing it at the end, no matter what. There is no point to use textures with non-standard sizes. I mean sizes like 8x8, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512 etc. and their combinations e.g. 256x128. That is why they put this function in to the plugin. If you are not doing this - you might have already experienced some problems with mipmap. You should try to reduce one size of the texture to meet the requirements. It is always better to create textures at specified sizes (and in higher resolutin - to have the chance to reduce it if you overflowing the mem) you will have much less troubles then. Another tip is to create larger canvas and put some textures in it - and with your natural resolution. That is of course no good if you are planning to tile them. TGA format is not primarily created for textures so you can not blame DDS for not behaving like it. Well I must say I don´t like DDS because of its compression - but that is another song.
With the nVidia DDS exporter you have plenty choices what to do with mipmap and the texture itself. There is whole table for dozen of effects. I prefer Mitchell for filtering together with Sharpen Soft. Also do not forget to check the "color map" is selected in image options. With those settings I have never had any problems with low res images or the mips. I have no idea what are those dark spots and I must say I never saw anything like this. It may also be caused by non-standard resolution - but who knows. Btw you should be more careful when creating textures for tiling. DDS compression is somehow magnifying every detail in very strange way. Those bright lines in the tile are corrupted pixels, but they come from the original.
The main problem about the forced size is that - well I´m not absolutely sure, but I think it is true after all - some graphic cards are doing it at the end, no matter what. There is no point to use textures with non-standard sizes. I mean sizes like 8x8, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512 etc. and their combinations e.g. 256x128. That is why they put this function in to the plugin. If you are not doing this - you might have already experienced some problems with mipmap. You should try to reduce one size of the texture to meet the requirements. It is always better to create textures at specified sizes (and in higher resolutin - to have the chance to reduce it if you overflowing the mem) you will have much less troubles then. Another tip is to create larger canvas and put some textures in it - and with your natural resolution. That is of course no good if you are planning to tile them. TGA format is not primarily created for textures so you can not blame DDS for not behaving like it. Well I must say I don´t like DDS because of its compression - but that is another song.
With the nVidia DDS exporter you have plenty choices what to do with mipmap and the texture itself. There is whole table for dozen of effects. I prefer Mitchell for filtering together with Sharpen Soft. Also do not forget to check the "color map" is selected in image options. With those settings I have never had any problems with low res images or the mips. I have no idea what are those dark spots and I must say I never saw anything like this. It may also be caused by non-standard resolution - but who knows. Btw you should be more careful when creating textures for tiling. DDS compression is somehow magnifying every detail in very strange way. Those bright lines in the tile are corrupted pixels, but they come from the original.
Last edited by Edman on Fri Jan 26, 2007 10:08 pm, edited 2 times in total.
"Threehandled Mosscovered Gredunza"
-
Edman
- Silver Sponsor

- Posts: 76
- Joined: Fri Jun 30, 2006 6:57 pm
- Location: Prague, Czech Republic
Memory
About the memory consumption - as far as I know there is no difference between the actual size of the saved texture and its version in the mem. I used to have some problems of that kind with BMP format, they were always growing in the mem like hell. No such problem with DDS even if they have alpha. Also - did you try to use DX1 1bit aplha instead of DX5 iterpolated alpha. It has only "yes or no" pixels, but since we don´t have the "key colors" - it is a wonderful option and it is half the size of standard alpha.
"Threehandled Mosscovered Gredunza"
-
Edman
- Silver Sponsor

- Posts: 76
- Joined: Fri Jun 30, 2006 6:57 pm
- Location: Prague, Czech Republic
LODs
I ain´t no programmer and I´m not sure what you mean when speaking about LODs. I personally use only precomputed MIPMAPs. They are perfectly enough for what I was in need of. They should help you to remove the noise from distant textures and can also help hw to get rid of computing them. If you trying to help your FPS with some more low res textures to switch - I´m not sure if it is a good idea as the mip will do the same and you do not have any other textures in your mem. We use some LOD textures, but only to relieve shader charge form certain areas. They already have some shader effects rendered in them at higher distance - but they still have their own mipmaps. That is probably far to different to what you trying to ask.
"Threehandled Mosscovered Gredunza"
-
crodude
- Gnoblar
- Posts: 12
- Joined: Sun Nov 26, 2006 4:10 am
- Location: zagreb/croatia
-
biteme
- Halfling
- Posts: 70
- Joined: Fri Mar 11, 2005 12:49 am
I belive that non power of 2 textures are bumped up the next larger power of 2 size on the video card IIRC. Wich is the biggest reason to keep them powers of 2.
Also keep in mind that if you don't create mip maps with the dds plugh in and your material look like this
Then your viedo card will generate mipmaps down to 1 pixel automaicly if the card suports it.
If you did save the dds file with mipmaps then the viedo card uses thoese mimaps and doesn't generate them.
You can also specify how many mipmaps the viedo card generates by adding the number of mips you want after the texture.
This will have the viedo card generate 3 mipmaps.
Also keep in mind that if you don't create mip maps with the dds plugh in and your material look like this
Code: Select all
texture_unit
{
texute mytexture.dds
}
If you did save the dds file with mipmaps then the viedo card uses thoese mimaps and doesn't generate them.
You can also specify how many mipmaps the viedo card generates by adding the number of mips you want after the texture.
Code: Select all
texure_unit
{
texture mytexture.dds 3
}
-
Paulov
- Greenskin
- Posts: 126
- Joined: Tue Apr 04, 2006 5:18 pm
- Location: San Sebastian / Europe
Hi.
Well, I see hard the theme of the power of 2, jej,. Ill try anyway to move to this.
The big power of 2 cambas is a good Idea (for non tiling textures)
mmm interesting the theme of the mipmaps but I´ve a problem, When I generate mipmaps in with photoshop pluggin, the textures in oFusion shows totally black. So I cant work with it
What i´m actually doing are texture LODs for large texture files.... hope this improves a bit the performance, but is true that this might be an error as it will be generating mipmaps for both resolution levels... a quite ilogic.. ups.
I´ll try your .dds compression suggestions too.
The strange blackboxes are a problem of oFusion, since they to not appear in a visualization soft that uses Ogre, but they may be a consecuence fo the texture sice. Ill check this.
Thanks a lot for your answers.
bye Pablo
Well, I see hard the theme of the power of 2, jej,. Ill try anyway to move to this.
The big power of 2 cambas is a good Idea (for non tiling textures)
mmm interesting the theme of the mipmaps but I´ve a problem, When I generate mipmaps in with photoshop pluggin, the textures in oFusion shows totally black. So I cant work with it
What i´m actually doing are texture LODs for large texture files.... hope this improves a bit the performance, but is true that this might be an error as it will be generating mipmaps for both resolution levels... a quite ilogic.. ups.
I´ll try your .dds compression suggestions too.
The strange blackboxes are a problem of oFusion, since they to not appear in a visualization soft that uses Ogre, but they may be a consecuence fo the texture sice. Ill check this.
Thanks a lot for your answers.
bye Pablo
-
Edman
- Silver Sponsor

- Posts: 76
- Joined: Fri Jun 30, 2006 6:57 pm
- Location: Prague, Czech Republic
black matter
Hi there,
I still have no idea, what kind of problem is that. I´m using oFusion, 3DS Max8 and have absolutely no problem. You should try to resize all your textures to a proper sizes, then we will see. The power of 2 (to be exact the sizes I described in earlier article) is a must have solution and I believe you won´t regret it. You can still go for 1024x1024, but I would not recommend to go higher than 4096x4096. Even this one is a hell of a texture and it is far too big to be handled quickly in larger numbers. Another side effect is - Photoshop will be saving such large texture with mips for eons.
I also cannot recommend to let video card generate mips, while others might have different exp. I have the experience telling me that precomputed is always better and you can see the result before. More over you can choose the number of mips and even draw them by your bare hand if unhappy with the automatic result. Number of mips can be set in Photoshop save frame, just don´t forget that 1 means only original (no mips). 2 is going to render one mip for you etc.
About this LOD thing. If you are just downsampling the same texture using it as a lod on the same object, the only thing you will come up with is more textures on your disk a more work for video card because it must get rid of large one, once it is in mem and load smaller. Again when you come closer, it must load the larger. It is just wasting of time handling all those unnecessary data. There is another glitch. If you have more such objects in the scene, some of them near, some far from the camera and your LOD is distance based - you will have the texture 2 times in your mem (larger and smaller) which is a video card killer. Rely on mips - it is much easier.
I still have no idea, what kind of problem is that. I´m using oFusion, 3DS Max8 and have absolutely no problem. You should try to resize all your textures to a proper sizes, then we will see. The power of 2 (to be exact the sizes I described in earlier article) is a must have solution and I believe you won´t regret it. You can still go for 1024x1024, but I would not recommend to go higher than 4096x4096. Even this one is a hell of a texture and it is far too big to be handled quickly in larger numbers. Another side effect is - Photoshop will be saving such large texture with mips for eons.
I also cannot recommend to let video card generate mips, while others might have different exp. I have the experience telling me that precomputed is always better and you can see the result before. More over you can choose the number of mips and even draw them by your bare hand if unhappy with the automatic result. Number of mips can be set in Photoshop save frame, just don´t forget that 1 means only original (no mips). 2 is going to render one mip for you etc.
About this LOD thing. If you are just downsampling the same texture using it as a lod on the same object, the only thing you will come up with is more textures on your disk a more work for video card because it must get rid of large one, once it is in mem and load smaller. Again when you come closer, it must load the larger. It is just wasting of time handling all those unnecessary data. There is another glitch. If you have more such objects in the scene, some of them near, some far from the camera and your LOD is distance based - you will have the texture 2 times in your mem (larger and smaller) which is a video card killer. Rely on mips - it is much easier.
"Threehandled Mosscovered Gredunza"