GU_TRANSFORM_2D z buffer ordering problem

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

Moderators: cheriff, TyRaNiD

Post Reply
gr8dane
Posts: 16
Joined: Thu Aug 18, 2005 11:10 am

GU_TRANSFORM_2D z buffer ordering problem

Post by gr8dane »

I seem to be having a problem when using GU_TRANSFORM_2D to do my 2D polygons.

The polygons draw just fine but they always appear behind any 3D objects that I draw. I have tried feeding the 2D polygons various Z values in the vertices. I would assume that giving it a Z value slightly higher than my near clipping plane would do the trick... but no...

Any help here would be appreciated.. Thanks in advance.
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

Turn off depth test and draw your 2D stuff last?
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
gr8dane
Posts: 16
Joined: Thu Aug 18, 2005 11:10 am

Post by gr8dane »

yeah, that would be an option but that should not be needed at all. I should be able to do this without mucking with the Z-buffer state.
gr8dane
Posts: 16
Joined: Thu Aug 18, 2005 11:10 am

Post by gr8dane »

I found the answer to my own question so I guess I'll post it here in case anybody else wanted to know.

It seems that when using GU_TRANSFORM_2D nothing is done to any of the vertice values, including the Z value. This makes you unable to just specify a Z value like you would for a 3D object.

Instead you have to pass in values compatible with whatever you have set your depth range to.

For example, if you have something like this in your code:

sceGuDepthRange(0xc350,0x2710);

You would need to set your 2D vertices Z values to a range between 0xc350 - 0x2710. So if you want your 2D polygons to appear in front of everything else make your Z values 0xc350.
Post Reply