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 

Polygons clipped by view? Need help!!

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



Joined: 05 May 2005
Posts: 122

PostPosted: Wed Dec 07, 2005 6:43 am    Post subject: Polygons clipped by view? Need help!! Reply with quote

http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1808 <- viewer
http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1809 <- test maps

If someone who is familiar with using the GU & GUM librarys. Take a look at the demo linked above. Load one of the maps (from the second link) and go near a large wall or floor. A polygon should be dropped and allow you to see though when you shouldn't.

Any idea's for what I could do to stop the clipping the psp is doing for large polygons that go though the screen?

I have scissor test & clipping planes enabled.
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Wed Dec 07, 2005 7:38 am    Post subject: Reply with quote

Although the GE does clip the near plane, for some reason the clever heads at Sony never added clipping of the other 5 planes, which means that if a triangle does go beyond the 4096x4096 grid, it will not be drawn. In the samples the GE is setup to render in the center of this grid, so you have (4096-480)/2=1808 pixels in width and 1912 pixels in height that the hardware will handle with scissoring, giving you some breathing space. There are a few solutions to this:

1) Do the clipping yourself before rendering. Not an optimal approach, but you'd get away with clipping only 4 planes since you really don't have to care about the far plane usually, and the hardware handles the near plane.

2) Don't push triangles that are too large. That should be rather easy to figure out, if the triangle occupy more than N area, it should be subdivided and the test should be re-done until all parts of the triangle have reached acceptable sizes. This could be done offline.
_________________
GE Dominator
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Wed Dec 07, 2005 7:53 am    Post subject: Reply with quote

I've had big problems with this in the past, and have had to compromise. chp advised me to increase the near clip pane, because it means that the Z Buffer is more accurate. Increase this as far as you can without it looking wrong. This helped the problems become less noticable in my game.
Back to top
View user's profile Send private message
subbie



Joined: 05 May 2005
Posts: 122

PostPosted: Wed Dec 07, 2005 10:51 am    Post subject: Reply with quote

I was afraid thats what the answer would be. Luckly (not in that build but my more recent one). I setup the bsp system so I can just get the cluster of polygons near the camera and just find which one is going to be dropped by the psp and sub divide it.

AnonymousTipster wrote:
I've had big problems with this in the past, and have had to compromise. chp advised me to increase the near clip pane, because it means that the Z Buffer is more accurate. Increase this as far as you can without it looking wrong. This helped the problems become less noticable in my game.


What values are you using? I'm using the default .5 used in the demos. I've noticed the z-buffer becomes more accurate the less polygons used in the distance. as noted above, with the bsp tree, i'm removing alot of far polygons.
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Thu Dec 08, 2005 2:55 am    Post subject: Reply with quote

My code looks like this:
sceGumPerspective(fovAmount,16.0f/9.0f,3.5f,500.0f);
So it's quite close, and in places you can see this clipping, but I try to keep the camera quite above the floor, so it doesn't clip as much.
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Thu Dec 08, 2005 9:55 am    Post subject: Reply with quote

True, forgot to mention that. Moving the far plane further back will clip with the near plane much sooner and the hardware coordinates have less chance of going out of bounds. Good catch.
_________________
GE Dominator
Back to top
View user's profile Send private message
subbie



Joined: 05 May 2005
Posts: 122

PostPosted: Thu Dec 08, 2005 1:57 pm    Post subject: Reply with quote

AnonymousTipster wrote:
My code looks like this:
sceGumPerspective(fovAmount,16.0f/9.0f,3.5f,500.0f);
So it's quite close, and in places you can see this clipping, but I try to keep the camera quite above the floor, so it doesn't clip as much.


Hmm I'll give that ago.

Actualy atm my numbers are 0.5f,2048.0f. Why so far away? Quake 2/3 have the clipping planes set that far (and if I use half, i will see the enviroment get clipped by the far plane).

Oh quick question. What kind of an angle are you using for the fov? Just wondering (i'm using 45deg).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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