PDA

View Full Version : The Mystery of the Disappearing Mesh



147-2
11-06-2002, 09:50 AM
I have a little program that I intend to work into a game, at current it has a handful of meshes that appear in random locations, and one that I can move around. I can move the camera around this one mesh in a manner alot like the camera in Homeworld. I can pan this camera around the mesh, and look at all sides of it, but something odd happens when the mesh is farther than about 380 units from the origin. When I pan the camera more than about 90 degrees from the Z axis, the mesh disappears. I tried turning off all of my culling code, so that all meshes were sent to the renderer, regardless of their position. Still happened. This seemed like an easy thing to fix, all I had to do was to recenter my coordinate system around the mesh in focus, now it cannot go outside the 380 units, right? Well, no. It still happens.

So, to recap, I have a mesh that disappears when it is over 380ish units from the "Universal origin". When I render, I am using a coordinate system centered around my point of camera focus. All matricies are WRT the Universal Coordinates, but when I load these matricies, I translate the coordinate system to the position of the object in focus. My cullers aren't the cause, I commented those out. What could it be?

jebus
11-06-2002, 10:21 AM
far clipping plane?

jebus

147-2
11-06-2002, 01:38 PM
no, thats not it, it doesnt matter how far away the mesh is from the camera. If you imagine the mesh "looking" down the Z axis. When the mesh and the camera are looking at each other, the mesh is visible. When I pan around the mesh, it remains visible until the camera is looking orthoganal to the Z axis, at that point in time, the mesh disappears. I have done some playing around, and come to find that this only happens when I have about a thousand or so meshes in my "world". I just had a crazy idea, mebbe I'll try setting the "look at" vector somewhere outside the face in question... That may work.


[This message has been edited by 147-2 (edited 11-06-2002).]

yakuza
11-06-2002, 01:42 PM
You mention that you took out YOUR cullers, how about glDisable(GL_CULL_FACE)?

147-2
11-06-2002, 02:04 PM
[QUOTE]Originally posted by 147-2:
[B]no, thats not it, it doesnt matter how far away the mesh is from the camera. If you imagine the mesh "looking" down the Z axis. When the mesh and the camera are looking at each other, the mesh is visible. When I pan around the mesh, it remains visible until the camera is looking orthoganal to the Z axis, at that point in time, the mesh disappears. I have done some playing around, and come to find that this only happens when I have about a thousand or so meshes in my "world". I just had a crazy idea, mebbe I'll try setting the "look at" vector somewhere outside the face in question... That may work.

Oh, yeah, and I also disabled the gl cullers. Didnt work http://www.opengl.org/discussion_boards/ubb/frown.gif

mm_freak
11-06-2002, 04:59 PM
Do you have any clipping planes?
Maybe your GL implementation buggy?
Maybe a depth testing issue (the more |z_far - z_near| is, the more unprecise the depth buffer is). Try setting more bits for the depth buffer, if you're not using GLUT.
Maybe your implementation misuses the arctan and generates a division by zero (by the OpenGL specification, implementations must not crash or terminate, even if a fatal error occurs). If the implementation tries to get an angle by it's sine and cosine using arctan and the cosine is zero, it will divide by it and so the result is undefined. Maybe that's the reason. Try updating your drivers/implementation, that could fix the problem.

[This message has been edited by mm_freak (edited 11-06-2002).]

147-2
11-07-2002, 10:30 AM
Well, I found that it has to do with how many objects (or faces) are within a certain area. The meshes that I have been using are 3180ish faces apiece, and with 1700 of them floating around, that's a lot of faces. But when I expanded things to the level that my game actually will be, the problem disappeared... Probably because Im not rendering nearly as many models.

mm_freak
11-09-2002, 01:07 AM
You should be able to render as many primitives as you want with OpenGL, since it's not object oriented. It's just drawn to the framebuffer and that's it, like you would draw lines and circles in a good old DOS graphics library.