Lighting with textured models

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Ratty
Posts: 18
Joined: Sun Sep 18, 2005 12:04 pm

Lighting with textured models

Post by Ratty »

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: Select all

	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
		);
User avatar
Conflict
Posts: 8
Joined: Wed May 11, 2005 9:00 am
Location: UK, York

Post by Conflict »

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: Select all

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
<,<;
Ratty
Posts: 18
Joined: Sun Sep 18, 2005 12:04 pm

Post by Ratty »

Using that seems to make everything disappear.
User avatar
Conflict
Posts: 8
Joined: Wed May 11, 2005 9:00 am
Location: UK, York

Post by Conflict »

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

Code: Select all

sceGuBlendFunc&#40;GU_MIN, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0&#41;; 
/lee
<,<;
Ratty
Posts: 18
Joined: Sun Sep 18, 2005 12:04 pm

Post by Ratty »

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
Post Reply