overlapping polygons

Started by
3 comments, last by zico 17 years, 10 months ago
Hi folks I'm still a bit busy with that old Descent Game sourcecode. Lately I had the problem that I was able to "see" through walls, objects in a certain angle, so I used GL_DEPTH_TEST to avoid it. This works very good, makes the whole scene very solid... but now "too" solid after all. I now have a scene that is not fully physical correct. Two "rooms" overlap themselves and I now can see the "ceiling" of one room in the other: http://dxx-rebirth.de/files/div/scrn0000.png This is the direct result of: glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); Without this the texture mostly stays in it's own room but very close to the wall I'm able to see through it: http://dxx-rebirth.de/files/div/scrn0001.png In other places of the game it gets even worse and I can see whole parts of other rooms where a wall should be. So I tried to play around with GL_DEPTH_RANGE and changed GL_LEQUAL to it's altervative functions but it didn't help. I'm feeling GL_DEPTH_TEST is the right step combined with GL_LEQUAL, but this overlapping showing in the first picture is something I can't beat now. I guess this has something to do with the weird room physics in this scene, but back in DOS time there where many levels using this "physics-bug", so I want to find a way to solve it visually. Thanks :) [Edited by - zico on June 26, 2006 4:36:36 PM]
Advertisement
Ah, good old Descent :-)

I wasn't actually able to see the artifacts in the images you posted, but maybe I'm just looking at it wrong. In any case, other things you might look into are depth write (make sure it's on where appropriate) and any alpha blending or testing you might be doing (like with the fan texture). I'm not really clear enough on the nature of the problem to offer advice beyond that though.
Ok i need to say the image is not saying that much :)
I try to find a better one.

But I try to explain:
Behind the fan you can see this green room. Right from the reticle you can see this green triangle shaped green texture. This is actually a part of that room behind the fan. This engine ALLOWS to let rooms overlap each other. There are no collision problems with this, every room has it's own limits even if a tunnel goes straight trough a room (from outside you could fly trough it).

This triangle shaped texture part "looks into" the other room because the room itself goes trough that wall. So basically OpenGL does it right by showing this texture. But it "should not".
Ok my OpenGL skills are very limited. I search for a function that "cuts" of this polygon if it hits another one. I don't know if it may be possible.

I also played around with the third value in gluPerspective. lowering this value to 0.00000000001 or so let disappear this overlapping polygon but the wall itself starts to flicker heavily.

I would love to provide more code, but I simplay don't know which parts could be needed :)
But still I hope someone can help me.
I know it's hard for you to help because I can't provide that much information... I'm very sorry for that.
Hm, I wish I could help but I'm afraid all I can do is guess. I seem to remember that Descent levels are built from arbitrary connected cuboids, or something of that sort. And the original game used a software renderer, yes? If so, maybe the actual renderer processed the rooms in such a way that overlaps were (correctly) ignored, whereas OpenGL just plows through it, as you noted. If so, there might not be a trivial solution; it may be necessary to pre-process the levels to eliminate overlapping geometry (not necessarily a trivial task).

Again though, I'm just guessing here; I don't know enough about the Descent engine to say for sure what the problem is.
Yeah it worked with a software renderer back in the good old days.
But it was not perfect, either.
There is also another project, D2X-XL, which made big steps in this area, but I just don't get it now, so I search for a simple solution or one I do understand by doing it by myself.
If you WANT (but I'm sure you don't want to :) ) you can take a look at my source at www.dxx-rebirth.de.
I won't give up with this. I'm sure there is something I can do about this. Probably I find a compromise by selecting a DepthRange so the efect only shows up in very few moments.
Or probably someone else has different ideas :)
Additionally there are many new OPenGL functions for me to explore and probably one of them is the right for me :D

This topic is closed to new replies.

Advertisement