#167851 - Kath - Tue Mar 31, 2009 5:26 pm
I'm having a problem with quads disappearing when my camera gets close to them. This image shows what I mean. On the left the wall quads are displayed, on the right after moving the camera forwards they disappear.
The quads are drawn directly in their positions (ie. not translated into position). I've tried various near clip plane values (0.1, 0.001) which hasn't helped. At the moment the walls are just one large quad from -4.0 to +4.0. Would it be better to split the wall into smaller polys? I thought the hardware would clip it for you?
Thanks in advance.
#167853 - nanou - Tue Mar 31, 2009 7:09 pm
What are you calling glPolyFmt() with? I think you might need to add POLY_CULL_NONE, or remove POLY_CULL_NEAR... but it's been a while since I've messed around with 3D so I could be way off.
_________________
- nanou
#167854 - Kath - Tue Mar 31, 2009 7:23 pm
The walls are drawn with:
glPolyFmt( POLY_ID( 1 ) | POLY_ALPHA(31) | POLY_CULL_BACK );
I've tried POLY_CULL_NONE but it doesn't change anything (apart from drawing back polys).
#167861 - nanou - Wed Apr 01, 2009 1:38 am
Right I remember those fields now. I *was* way off.
GBAtek doesn't mention anything I could find about setting near plane behaviour, but lumps it in with the rest, saying it does clipping. I haven't bumped into this problem but I'll be interested to know the answer.
_________________
- nanou
#167865 - TwentySeven - Wed Apr 01, 2009 10:42 am
If I was going to call it off the top of my head, I wouldn't blame the raster hardware immediately for a block of geometry disapearing like that.
Are you absolutely sure thats not a code error? Perhaps, something to do with your own culling code.
Also, if not, paste your camera matrix setup.
#167883 - Kath - Wed Apr 01, 2009 11:44 pm
Hi, thanks for the replies so far.
I'm sure it's my code, somewhere, but I have no idea where or what. I'm not performing any culling at the moment. The camera simply uses gluLookAt() with it's position and lookat vectors with 0,1,0 as up.
I semi-finished my particle system today and I noticed that I can move right up to the particles and they don't disappear. I'm going to try and subdivide the wall into a few smaller quads to see if that helps. Is there a limit to the size of a polygon?
I've uploaded a binary here: mirror.nds (Works in no$gba, doesn't need patching.)
Edit: Camera movement is the dpad, it's a bit sensitive at the moment thinking about it so press lightly :p
#167885 - DiscoStew - Thu Apr 02, 2009 12:13 am
Just by observance, whenever a polygon is to be clipped on the upper boundary of the screen (rather than the sides, or the bottom?), it instead disappears. It seems to happen with all of them except for the ground polygon. I'm not sure why that one disappears.
_________________
DS - It's all about DiscoStew
#167886 - TwentySeven - Thu Apr 02, 2009 12:39 am
oh dear. Checking the nds.. things are pretty buggered.
We'll need source to be able to help any further.
#167888 - nanou - Thu Apr 02, 2009 1:25 am
You might want to start with checking whatever 3D settings or geometry you're recalculating every frame. Judging from the behavior of the .nds I'm almost certain it's a problem in there.
Some things seem to be shifting on the spot (the columns near the mirror, for example) so maybe your geometry is just dancing around?
_________________
- nanou
#167894 - Kath - Thu Apr 02, 2009 1:02 pm
Aha!
I was using glViewport(0,0,255,192); which should have been glViewport(0,0,255,191); Now I've changed it everything appears correctly. Thank you for the observations, they led me back to the gl setup code :)