 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Ratty
Joined: 18 Sep 2005 Posts: 18
|
Posted: Fri Oct 07, 2005 10:00 am Post subject: Lighting with textured models |
|
|
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 |
|
 |
Conflict

Joined: 11 May 2005 Posts: 8 Location: UK, York
|
Posted: Fri Oct 07, 2005 10:14 am Post subject: |
|
|
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 |
|
 |
Ratty
Joined: 18 Sep 2005 Posts: 18
|
Posted: Fri Oct 07, 2005 10:18 am Post subject: |
|
|
| Using that seems to make everything disappear. |
|
| Back to top |
|
 |
Conflict

Joined: 11 May 2005 Posts: 8 Location: UK, York
|
Posted: Fri Oct 07, 2005 12:52 pm Post subject: |
|
|
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 |
|
 |
Ratty
Joined: 18 Sep 2005 Posts: 18
|
Posted: Fri Oct 07, 2005 12:56 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|