light effects on psp

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

Moderators: cheriff, TyRaNiD

Post Reply
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

light effects on psp

Post by LuMo »

image links do not work to qj.net... sorry

how can i create such effects? (semitransparency won't work here)

greets
lumo, who is just back from hospital... :o(
Last edited by LuMo on Tue Feb 28, 2006 11:01 pm, edited 1 time in total.
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Lighting effects are mostly done by additively blending the light textures over the screen. This is achieved on the GU by calling sceGuTexFunc( GU_TFX_ADD, GU_RGBA ) before you render the light textures.
Note that since the color values are added together, you wouldn't need a alpha channel in the texture to get transparent parts (and thus could also simply use GU_RGB instead of GU_RGBA), since all black areas in the texture will be completely transparent, no matter what the alpha value would be - the basic rule is: the darker the texture, the more "transparent" it will be
However you should also try playing around with setting GU_TFX_DECAL or GU_TFX_BLEND together with different alpha modes like GU_ONE_MINUS_SRC_COLOR/GU_SRC_COLOR etc. as it might produce interesting effects also, but that's more complicated to get the wanted result

Greets,
Raphael

PS: Hope you're well again or at last will get well soon :)
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

which means it >should< be possible with semitransparency, but, by now... only full or no transparency was possible here (guess something wrong in my setup....)

greets
lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

ok, tried playing...
somehow when i enable blending the whole mesh is no more shown...
i tried

Code: Select all

sceGuEnable&#40;GU_BLEND&#41;;
sceGuBlendFunc&#40;GU_ADD, GU_SRC_COLOR, GU_DST_COLOR, 0, 0&#41;; 
and

Code: Select all

sceGuEnable&#40;GU_BLEND&#41;;
sceGuBlendFunc&#40;GU_ADD, GU_ONE_MINUS_SRC_ALPHA, GU_SRC_ALPHA, 0, 0&#41;; 
both without anything drawn to screen...
same result when i call

Code: Select all

sceGuTexFunc&#40;GU_TFX_ADD,GU_TCC_RGBA&#41;;
instead of my current

Code: Select all

sceGuTexFunc&#40;GU_TFX_REPLACE,GU_TCC_RGBA&#41;;
any ideas?

greets
lumo
PS: simple samples available?
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Either your alpha values from the texture are all zero, due to wrong loading or you supply zero alpha values in the vertice colors for drawing the mesh and didn't turn off the use of the vertice alpha (as it is when using GU_TX_REPLACE, and since the mesh shows with that, I'd say that's the real problem). Take a closer look at the gu header and the sceGuTexFunc's description on how the destination color and alpha values are generated with the different modes, and you'll find the one that doesn't use the vertice alpha.
If you'd show me your drawing code I could probably tell you more exactly what is wrong, but most likely it is one of the above reasons.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

i did not save alpha with the png, as i tried it first with RGB...
ok ill check and show you the code too;
its too late here now to do it today, but ill do it when i am back from university tomorrow

thanks in advance
lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Post Reply