forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gsKit, ZBuffer etc ...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
tesla



Joined: 26 May 2008
Posts: 4
Location: /dev/urandom

PostPosted: Mon May 26, 2008 6:37 pm    Post subject: gsKit, ZBuffer etc ... Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
ps2devman



Joined: 09 Oct 2006
Posts: 265

PostPosted: Mon May 26, 2008 7:43 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
tesla



Joined: 26 May 2008
Posts: 4
Location: /dev/urandom

PostPosted: Mon May 26, 2008 8:20 pm    Post subject: Reply with quote

:) 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.
Back to top
View user's profile Send private message Visit poster's website
ps2devman



Joined: 09 Oct 2006
Posts: 265

PostPosted: Tue May 27, 2008 6:30 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
tesla



Joined: 26 May 2008
Posts: 4
Location: /dev/urandom

PostPosted: Wed May 28, 2008 5:22 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group