Alpha texture on a 3D object with PSPGU library

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

Moderators: cheriff, TyRaNiD

Post Reply
Oby1Chick
Posts: 3
Joined: Sat Feb 13, 2010 4:08 am

Alpha texture on a 3D object with PSPGU library

Post by Oby1Chick »

Hello guys,

Well, I was wondering (and I think this forum is the best place to ask such a question) if it was possible to apply a texture with transparency on an OBJ 3D file loaded with the PSPGU library.

Let's say it it is just a cube.I know how to print texture on it.But if the texture (a PNG) is totally transparent, will I be able to see thru the cube ? Or it won't work properly and I need to do something before - Or it is impossible ?

Thanks a lot for clarify this problem for me,
Oby.
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Hi,

yes - if the texture is fully transparent you can view through. But there are some contraint. You really need to pass the far awy object - the once beyond the cube first, and than the cube...

If you wont to make the cube transparent like glass you should first render the backfaces with eg. sceGuFrontFace(GU_CW) and than the fron faces with sceGuFronface(GU_CW).

Regards
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

anmabagima wrote:Hi,

yes - if the texture is fully transparent you can view through. But there are some contraint. You really need to pass the far awy object - the once beyond the cube first, and than the cube...

If you wont to make the cube transparent like glass you should first render the backfaces with eg. sceGuFrontFace(GU_CW) and than the fron faces with sceGuFronface(GU_CW).

Regards
Nah, I would save the 2 pass technique for a single pass and just disable backface culling for objects with transparent textures.And, Yes for transparency you do need to do z ordering as in, render furthest items first. However this is slightly slower since data needs to be overwritten in the z buffer. So I would make some hybrid organization code that shoots rays through our current object so that it only renders objects behind it before it, and then the rest in the opposite order.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
Oby1Chick
Posts: 3
Joined: Sat Feb 13, 2010 4:08 am

Post by Oby1Chick »

Thanks a lot for your replies guys !
Well, in fact I am making a 3D racing game in C/C++ and I've finished to model all the 3D objects.But I have some low-polygon trees that I created on this principle : Its just a plane with a tree texture which has a transparent background.
In my game, I use the trees to make the landscape nicer.Behind the trees, the only object there can be is the skybox because they are on the top of a mountain.
So I will render the skybox and then, the trees.
Thanks again for your help.
Post Reply