gsKit, ZBuffer etc ...

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
User avatar
tesla
Posts: 4
Joined: Mon May 26, 2008 6:16 pm
Location: /dev/urandom
Contact:

gsKit, ZBuffer etc ...

Post by tesla »

Hi,

Need little help with gsKit. What I want is to make function
gsKit_prim_triangle_gouraud_3d()
to work similar to:
draw_triangles() from libdraw.

Point is to store all the vertices like draw_triangles() does.
I'm fresh here (ps2 code) so if i misunderstood smtg plese correct me.

Calculating color values and pasing them to gsKit function is not a problem (i get them using Z depth so it's simple gouraud - no light angle etc.)

draw_triangles() makes smtg like this:
[...]
GIF_SET_TAG(count, 1, 0, 0, GIF_TAG_REGLIST, 2).
then loops with sending XYZ and it's colour.
Count is number of points of triangles.

gsKit_prim_triangle_gouraud_3d() does:
[...]
*p_data++ = GS_SETREG_PRIM( GS_PRIM_PRIM_TRIANGLE,...[...]
then stores XYZ with colours of three points of one triangle.

I didn't find out how to make it with gsKit to use hw zbuffering. Sorting vertices by hand to get triangles that should be drawn first works but is not a solution i need.

Jah bless
ps2devman
Posts: 259
Joined: Mon Oct 09, 2006 3:56 pm

Post by ps2devman »

http://home.tele2.fr/~fr-51785/ps2_initial_fantasy.zip
(250000 vertices/frame 3D rendering loop)

Old stuff, but 'optimal' I think.

Note that gsKit is not used as main rendering loop, but used as comfortable graphic library for all non speed-sensitive 3D stuff.
User avatar
tesla
Posts: 4
Joined: Mon May 26, 2008 6:16 pm
Location: /dev/urandom
Contact:

Post by tesla »

:) k, i was afraid of answer like this but k. got the point i think.

gsKit mostly used for init stuff k.
Not exactly what i asked for but comments in code are ok. Just one more question:
object data created using get_mesh_batches() and send by vu1UploadHugeDataContFlush(), right ?

Thx.
ps2devman
Posts: 259
Joined: Mon Oct 09, 2006 3:56 pm

Post by ps2devman »

Yes. It's the insane -probably professional- method. You prepare everything to go to gs through massive non-stop dma transferts.

I think you can still use gskit normal stuff to draw and it will act properly in regard of Z buffer. I mean, in order to have my little yellow line drawn I had to carefully choose the Z value.
User avatar
tesla
Posts: 4
Joined: Mon May 26, 2008 6:16 pm
Location: /dev/urandom
Contact:

Post by tesla »

ps2devman wrote: I think you can still use gskit normal stuff to draw and it will act properly in regard of Z buffer. I mean, in order to have my little yellow line drawn I had to carefully choose the Z value.
Man, that Z value tip was what i need :) To draw it properly (object) i had to
GS_ZTEST_ON, then call gsKit_prim_triangle_gouraud_3d() in loop with z1,z2,z3 set as positive integer value and GS_ZTEST_OFF. When Z is < 0 it doesn't sort vertices. Thx a lot and Jah bless.
Post Reply