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 

Lighting with textured models

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



Joined: 18 Sep 2005
Posts: 18

PostPosted: Fri Oct 07, 2005 10:00 am    Post subject: Lighting with textured models Reply with quote

Hi, i've added lights to my scene which render perfectly when my meshes don't have a texture, but added textures causes the entire scene to have full brightness, no shading at all. The code below is what i use to apply my textures, is there something wrong with it?

Code:

   sceGuTexMode(GU_PSM_8888, 0, 0, GU_TRUE);
   sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
   sceGuTexFilter(GU_LINEAR, GU_LINEAR);
   sceGuTexWrap(GU_REPEAT, GU_REPEAT);
   sceGuTexScale(1.0f, 1.0f);
   sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
 
 
/////////
 
 
   sceGumDrawArray(
         GU_TRIANGLES,
         GU_NORMAL_32BITF|GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,
         3* itObject->faceCount,
         0,
         itObject->mesh
      );
Back to top
View user's profile Send private message
Conflict



Joined: 11 May 2005
Posts: 8
Location: UK, York

PostPosted: Fri Oct 07, 2005 10:14 am    Post subject: Reply with quote

This soundssimiliar to a Opengl T&L issue, you have to setup the pipeline states appropriately.

looking at the sdk document you need to set the state up during init...
using

Code:

sceGuTexFunc(GU_TFX_MODULATE,GU_TCC_RGB);


I see you'er using GU_TFX_REPLACE which simply replaces any shading with the texture, causing it to be fullbright per se... irc..

i think that should sort your issue.

/lee
_________________
<,<;
Back to top
View user's profile Send private message MSN Messenger
Ratty



Joined: 18 Sep 2005
Posts: 18

PostPosted: Fri Oct 07, 2005 10:18 am    Post subject: Reply with quote

Using that seems to make everything disappear.
Back to top
View user's profile Send private message
Conflict



Joined: 11 May 2005
Posts: 8
Location: UK, York

PostPosted: Fri Oct 07, 2005 12:52 pm    Post subject: Reply with quote

hmm
try, changing GU_ADD in your blendfunc def... to something else, testing here with GU_MIN give best results

Code:

sceGuBlendFunc(GU_MIN, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);


/lee
_________________
<,<;
Back to top
View user's profile Send private message MSN Messenger
Ratty



Joined: 18 Sep 2005
Posts: 18

PostPosted: Fri Oct 07, 2005 12:56 pm    Post subject: Reply with quote

Disabling blending draws everything nicely, i tried with GU_MIN and the colours are weird in places. But i'll mess with it until i get something i like.

Thanks for your help
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