Bugzilla – Bug 901
Slopes sometimes draw over parts of a sprite.
Last modified: 2013-02-04 20:13:10 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.
Created attachment 399 [details]
Screenshot of the problem
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.
Both of these wads are required for the set to run. map06
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.
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.
Hex's bug is fixed in the persdiv branch with more accurate wall vertex projection.