Bug 901 - Slopes sometimes draw over parts of a sprite.
: Slopes sometimes draw over parts of a sprite.
Status: NEW
Product: Odamex
Classification: Unclassified
Component: Client
: 0.6.x
: All All
: P1 minor
Assigned To: Odamex Bug Reporter
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-06 07:12 UTC by Amateur Spammer
Modified: 2013-02-04 20:13 UTC (History)
1 user (show)

See Also:


Attachments
Screenshot of the problem (50.06 KB, image/png)
2012-09-06 07:13 UTC, Amateur Spammer
Details
Slope bug in Mario map (435.76 KB, image/jpeg)
2012-09-13 21:20 UTC, HeX_Vulture
Details
Remove lower/upper textures from walls with slope line specials (4.10 KB, patch)
2012-12-11 15:53 UTC, Dr. Sean
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amateur Spammer 2012-09-06 07:12:31 UTC
Slopes sometimes draw over parts of a sprite. See attached screenshot. 
This is anthctf.wad level 10.
This doesn't occur in ZDoom 2.5.
Comment 1 Amateur Spammer 2012-09-06 07:13:15 UTC
Created attachment 399 [details]
Screenshot of the problem
Comment 2 HeX_Vulture 2012-09-13 21:20:06 UTC
Created attachment 403 [details]
Slope bug in Mario map

A similar issue happens in which some slopes overlap in ways they are not supposed to.

https://dl.dropbox.com/u/72213361/tlsfp1_.zip

Both of these wads are required for the set to run. map06
Comment 3 Dr. Sean 2012-12-10 22:29:07 UTC
This is a fairly difficult problem to solve. I'll use the sloped pedestals with the rocket boxes on ANTHCTF MAP10 for an example.

Sprite clipping in Doom is a pretty simple algorithm. All of the drawsegs created when rendering walls are stepped through and the distance from the viewer to the drawseg is compared with the distance from the viewer to the sprite. If the drawseg is closer to the viewer than the sprite, the sprite is clipped where the drawseg overlaps the sprite. If the sprite is closer to the viewer, the sprite draws over the drawseg.

The clipping problem with the rocket boxes in the screenshot seems to stem with the fact that the line forming the peak of the two slopes coming together is broken up into several linesegs, which are each clipped separately. In the attached screenshot, the lineseg closest to the viewer is deemed closer to the viewer than the rocket box sprite and so it is used to clip the sprite, where as the rocket box is in front of the second closest lineseg and therefore is not clipped by that lineseg.

It is possible that this problem could be addressed by merging drawsegs that are part of the same linedef and treating the group of drawsegs as one for clipping.
Comment 4 Dr. Sean 2012-12-11 15:53:01 UTC
Created attachment 407 [details]
Remove lower/upper textures from walls with slope line specials

Hex's bug is unrelated to the sprite clipping one, however, I have attached a patch that addresses the issue.

In xctf1_1.wad map06, a sliver of the lower wall texture can be seen at the base of the slope. Ordinarily, it would be expected that none of that texture would be visible, however, due to imprecision with the fixed-point plane calculations, there sometimes is a thin sliver visible, particularly on more steep slopes. The attached patch fixes this by removing the lower-texture on lines that have a sloping floor line special and removing the upper-texture on lines that have a sloping ceiling line special.
Comment 5 Dr. Sean 2013-02-04 20:13:10 UTC
Hex's bug is fixed in the persdiv branch with more accurate wall vertex projection.