forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using Mipmap with DXT textures...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Sun Sep 24, 2006 9:37 pm    Post subject: Using Mipmap with DXT textures... Reply with quote

Hello folks...

I wonder how the GU should be set to handle a DXT texture with mipmap.
Using a 1 level (no mipmap) DXT texture works, using normal 8888 textures at different size and setttign the mipmap levels works but I did not find how to set the different mipmaps textuers for 1 DXT..

What I mean is :
To handle normal 8888 texture and mipmap you can do :

Code:

sceGuTexMode(GU_PSM_8888,2,0,0); // 2 levels mipmap
sceGuTexImage(0,128,128,128,texture128);
sceGuTexImage(1,64,64,64,texture64);
sceGuTexImage(2,32,32,32,texture32);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);

sceGuTexFilter(GU_LINEAR_MIPMAP_LINEAR,GU_LINEAR_MIPMAP_LINEAR);


but for one DXT texture as you don't know the textureS offsetS, how can you define the mipmaps ???

I tried this but it doesn't work well (looks like bad offset + texture size), only the biggest (0) texture is ok

Code:

// dxt5 mipmapped, DXT5 texture is 512*512 and 3 level mipmap

sceGuTexFilter(GU_LINEAR_MIPMAP_LINEAR,GU_LINEAR_MIPMAP_LINEAR);
sceGuTexMode(10, 3, 0, 0);
sceGuTexImage(3, TEXTURE_WIDTH/8, TEXTURE_HEIGHT/8, TEXTURE_WIDTH/8, textureDXT5);       
sceGuTexImage(2, TEXTURE_WIDTH/4, TEXTURE_HEIGHT/4, TEXTURE_WIDTH/4,textureDXT5);
sceGuTexImage(1, TEXTURE_WIDTH/2, TEXTURE_HEIGHT/2, TEXTURE_WIDTH/2, textureDXT5;
sceGuTexImage(0, TEXTURE_WIDTH, TEXTURE_HEIGHT, TEXTURE_WIDTH, textureDXT5);


should you have 4 different DXT textures for each mipmap LOD ?

(Note : I use PSPTex to generate the psptex DXT5 file)
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
hitchhikr



Joined: 04 Feb 2006
Posts: 83

PostPosted: Mon Sep 25, 2006 8:46 am    Post subject: Reply with quote

I updated the plugin, now it generates constants in the .h files containing the locations of the different mipmaps within the file (x_MIPMAPS_OFFSETx)

http://perso.orange.fr/franck.charlet/PSPTex.zip

Tell me if it helps.
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Mon Sep 25, 2006 7:01 pm    Post subject: Reply with quote

Yep it helps a lot :D
It works now :D

by the way... is there a loss of quality implied with DXT1 textures ?
DXT5 textures are perfect but DXT1 is totally ugly (visible pixel blocks) whatever the LOD level
_________________
- TiTAN Art Division -
http://www.titandemo.org


Last edited by Shazz on Mon Sep 25, 2006 9:39 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
hitchhikr



Joined: 04 Feb 2006
Posts: 83

PostPosted: Mon Sep 25, 2006 8:02 pm    Post subject: Reply with quote

I noticed the dxt1 problem, it may be a bug in the compressor (or in the gpu (?)), i'll see what i can do.
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Mon Sep 25, 2006 10:05 pm    Post subject: Reply with quote

I just tested NVDIA DXT tools (http://udn.epicgames.com/pub/Content/TextureSpecifications/DXT_TOOLS.zip) and I generated the same texture in DXT1c and DXT5 and there is no "easy-seeing' quality difference...

So I guess there is a bug somewhere... I hope that's in your compressor :D

By the way, again, I did some perf tests to compare DXT5 and Palette (T8) textures as for 5 levels mipmap, a DXT5 texture or a T8 texture takes the same memory space :
T8: 8bits indexed color
vs.
DXT5 : 4bits (color) + 4bits (alpha)

and as a result it seems that performance are equal for small textures (mipmap 16x16, 32x32) but when bigger textures are used (higher LOD) (128x128, 256x256) the performance decrease quickly when using DXT 5

So I bet using T8 textures is better to save (V)RAM if you don't need an alpha layer....
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Mon Sep 25, 2006 11:44 pm    Post subject: Reply with quote

If you don't need alpha you might as well use DXT1, since DXT5 ~= DXT1 + alpha.

Although it's likely that T8 will still be faster since the DXT format occupy a lot of texture cache (it's decompressed into the cache) and thus cause more cache thrashing.
_________________
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
Back to top
View user's profile Send private message
Shazz



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Mon Sep 25, 2006 11:56 pm    Post subject: Reply with quote

ector,

Using DXT1 was the goal (at least so save VRAM) but seems there si a bug somewhere in PSPTex or GU as the result is totally ugly.... which shouldn't be the case.

I succeeded in tuning the stuff by manually setting the lod slope to have better performance using DXT5 textures but definitively using T8 is better....

thanks for the DXT technical cache explanation ;)
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group