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 

Texture padding is showing and alpha images get blurry

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



Joined: 05 May 2006
Posts: 71

PostPosted: Sun May 06, 2007 1:16 pm    Post subject: Texture padding is showing and alpha images get blurry Reply with quote

When I load an image who's width or height is not to the power of 2, then I have to pad it. Problem is, the image padding is now showing when I draw the image with a u/v greater then the initial image size (regardless of whether it's sent through the 2d or 3d pipe, or if I strip blit or not.) I was wondering if anyone's had the same problem before, and if so, how did you fix it?

Secondly, alpha images seem to get blurry around the edges (between the alpha and the color), and it changes depending on their place on the screen. This only happens when I call sceGuTexFilter ( 1, 1 );

Here's how I have pspGU setup
Code:

// vrelptr and valloc are from raphael's vram library
   fbp0 = ( u32* ) vrelptr ( valloc ( FRAMEBUFFER_SIZE ) );
   fbp1 = ( u32* ) vrelptr ( valloc ( FRAMEBUFFER_SIZE ) );
   zbp = ( u16* ) vrelptr ( valloc ( DEPTHBUFFER_SIZE ) );

   sceKernelDcacheWritebackAll();

   // Setup GU

   sceGuInit();
   sceGuStart ( GU_DIRECT, DList );

   sceGuDrawBuffer ( GU_PSM_8888, fbp0, BUF_WIDTH );
   sceGuDispBuffer ( SCR_WIDTH, SCR_HEIGHT, fbp1, BUF_WIDTH );
   sceGuDepthBuffer ( zbp, BUF_WIDTH );

   sceGuOffset ( 2048 - ( SCR_WIDTH / 2 ), 2048 - ( SCR_HEIGHT / 2 ) );
   sceGuViewport ( 2048, 2048, SCR_WIDTH, SCR_HEIGHT );
   sceGuDepthRange ( 65535, 0 );

   sceGuScissor ( 0, 0, SCR_WIDTH, SCR_HEIGHT );
   sceGuEnable ( GU_SCISSOR_TEST );

   sceGuDepthFunc ( GU_GEQUAL );
   //sceGuEnable ( GU_DEPTH_TEST );

   sceGuEnable ( GU_CLIP_PLANES );

   sceGuFrontFace ( GU_CW );
   sceGuEnable ( GU_CULL_FACE );

   sceGuShadeModel ( GU_SMOOTH );

   sceGuTexMode ( GU_PSM_8888, 0, 0, 1 );
   sceGuTexFunc ( GU_TFX_REPLACE, GU_TCC_RGBA );
   sceGuEnable ( GU_TEXTURE_2D );

   sceGuBlendFunc ( GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0 );
   sceGuEnable ( GU_BLEND );

   sceGuClearColor ( RGB ( 0, 0, 0 ) );
   sceGuClearDepth ( 0 );

   sceGuFinish();
   sceGuSync ( 0, 0 );

   sceDisplayWaitVblankStart();
   sceGuDisplay ( GU_TRUE );

// Custom matrix stuff, could be what's causing the bugs. If you want it posted, just ask
   vfpu_perspective_m ( &m_projection, 75.0f, 16.0f / 9.0f, 1.0f, 1000.0f );
   vfpu_ortho_m ( &m_ortho, 0.0f, 480.0f, 272.0f, 0.0f, -1.0f, 0.0f );
   vfpu_identity_m ( &m_projection_model );
   vfpu_identity_m ( &m_ortho_model );
   vfpu_identity_m ( &m_projection_view );
   vfpu_identity_m ( &m_ortho_view );

   sceKernelDcacheWritebackAll();

if you would like to see all the code, you can get it off of my svn
Code:
svn co http://zettablade.0x89.org/SVN/vLib
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Sun May 06, 2007 8:04 pm    Post subject: Reply with quote

1) Since non-pow2 textures is done by abusing the system a little bit (by setting them up as a bigger texture than they really are), you cannot use wrapping with these textures, you would have to split them at UV borders to safely wrap them around.

2) Are you sure you're not offsetting incorrectly into the texture? If you're using 2D mode the UV should be fixed, but for 3D you have to make sure that you center the texel properly so that it won't sample other pixels when using bilinear filtering.
_________________
GE Dominator
Back to top
View user's profile Send private message
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