Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Vic

Doom renderer question

Recommended Posts

Hi,

 

I've got a question regarding how exactly the renderer in Doom works. As most of us here know, in general it works like this: traverse the BSP tree, drawing + clip the segments in front-to-back order and then fill in the rest by drawing visplanes. Supposedly that achieves zero overdraw, except... when it doesn't. Let's slightly re-order the operations:

1) traverse the BSP tree

2) clip the segments into visplanes

3) render visplanes

4) render segments

 

Now, this works totally fine most of the time except for there's a door that goes below the player's floor level. As an example, look at the bottom of the secret door, that's partially hidden by imps corpses. You can it see shining through the floor.

image.png.c6bd6d15a165619ff6f167c8399980a7.png

 

This is how it's supposed to look:

image.png.485987177efc8bf67c2cf686df8f24d5.png

 

Now I'm wondering whether has anyone come across this problem and if there's an easy fix for the renderer that would properly clip the door's bottom level to the floor. Any help would be much appreciated.

Share this post


Link to post

Good question. I wish I understood the renderer better. I do recall a PrBoom commit from 2007 fixing an overdraw issue, perhaps it is relevant:

------------------------------------------------------------------------
r2419 | proff_fs | 2007-01-30 09:13:48 +0000 (Tue, 30 Jan 2007) | 3 lines

Added missing clipping. Very noticeable in Doom2 Demo3 in Map 26 in the elevators when you remove the call to R_DrawPlanes.
Thanks to SoM for this!


diff --git a/src/r_segs.c b/src/r_segs.c
index 67e5e8b7..cb30b75b 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -298,6 +298,8 @@ static void R_RenderSegLoop (void)
               ceilingplane->top[rw_x] = top;
               ceilingplane->bottom[rw_x] = bottom;
             }
+          // SoM: this should be set here
+          ceilingclip[rw_x] = bottom;
         }
 
 //      yh = bottomfrac>>HEIGHTBITS;
@@ -316,6 +318,8 @@ static void R_RenderSegLoop (void)
               floorplane->top[rw_x] = top;
               floorplane->bottom[rw_x] = bottom;
             }
+          // SoM: This should be set here to prevent overdraw
+          floorclip[rw_x] = top;
         }
 
       // texturecolumn and lighting are independent of wall tiers
------------------------------------------------------------------------

On the other hand, the error in your screenshot looks like a broken sector reference, a side of a line facing the wrong sector. If you are willing to post the map, or otherwise verify that it is correct, that would be a useful sanity check. It is hard to debug from screenshots alone :).
 

Share this post


Link to post

An interesting find, thanks! I wonder whether the fix is applicable to calico/3do/32x ports..

 

As far as the map goes, I forwarded your question to our mapping expert - Wavy, although last time I asked him, he said there was nothing of unusual or suspect there.

 

Share this post


Link to post

The only thing I took away from this is that the OP is complaining about a secret door texture not matching the rest of the wall. Last time I checked it was pretty common and acceptable practice to use off patterned texturing to mark secrets.

 

That said, both screen shots are absolutely horrible for conveying the asserted problem. I can't even notice a blemish in that pixelated mess, and I would definitely check that spot for a Secret.

Share this post


Link to post
17 minutes ago, kalensar said:

The only thing I took away from this is that the OP is complaining about a secret door texture not matching the rest of the wall.

 

That's not the problem; what's happening is that the hidden door's texture is clipping through the floor. It's something I've seen a lot with mid-textures working in vanilla; for example, let's say I wanted a railing using the MIDGRATE texture, but I only want to use like the top half of it so it doesn't go all the way up to the ceiling. I could try doing something like this in doombuilder:

 

image.png.49f81cba1c52d3101931fff851719c21.png

 

Looks fine, right? But when I open the map in-game:

 

image.png.0733aff6da3fdea0f3d4ddc3dd79b77a.png

 

You can see the lower half of the texture clipping through the floor in a completely unintended manner. This is pretty much what's happening up there, only with the lower part of the hidden door being drawn through the floor.

Share this post


Link to post
2 hours ago, kalensar said:

That said, both screen shots are absolutely horrible for conveying the asserted problem. I can't even notice a blemish in that pixelated mess, and I would definitely check that spot for a Secret.

 

This is how Doom looks on the 32X, not much can be done about that!

Share this post


Link to post
1 minute ago, Vic said:

 

This is how Doom looks on the 32X, not much can be done about that!

You could have moved closer to the wall =P

 

But yeah I get where you are coming from. I have GZDoom, LZDoom, ZDoom, Zandronum, PrBoom+, and Odamex mainly for mod compatibility.  Basically just depends on my mood for how for how I want to play. If I want super vanilla software mode Usually run ZDoom. 

Share this post


Link to post
4 minutes ago, kalensar said:

You could have moved closer to the wall =P 

 

I wish I could - that was the closest point I managed to get it glitching at.. Moving closer magically fixed the clipping issue :D

Share this post


Link to post
14 minutes ago, Vic said:

 

I wish I could - that was the closest point I managed to get it glitching at.. Moving closer magically fixed the clipping issue :D

 

You should be able to work around this by "forcing" a split by putting the midtexture inside its own sector.

 

It can be self-referencing (if it's in the middle of an existing sector) or a new sector with a different height.

 

Tried locally and it does work.

Share this post


Link to post
17 minutes ago, Vic said:

 

I wish I could - that was the closest point I managed to get it glitching at.. Moving closer magically fixed the clipping issue :D

 Part of the diagnosing definitely has to do with which source port you are using because stuff like GZDoom will autocorrect texture alignment in many cases; whereas Chocolate doom will not. If that's on DosDoom then there's literally no helping it honestly other than in the Builder of choice. I've even seen Zdoom 2.8 render better than GZDoom software rendering in a few cases.

Share this post


Link to post

Well, I'm not trying to fix the map, which is absolutely fine by all standards, but the renderer in my source port, which in turn is based on the Jaguar port.

 

There's definitely some missing clipping there, most likely inherited from the vanilla.

Share this post


Link to post

@kalensar

I don't think you have understood that the OP has ported Doom (again) to the 32x and is trying to fix the rendering of his source port.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×