wesleyjohnson
Member
Posts: 486
Registered: 04-09 |
I have determined the cause of the FreeDoom Imp sprite clipping problem for the software renderer.
(The FreeDoom Imp sprite has a tail that can be seen through floors and at other times.)
It is a software renderer problem only.
The problem affects prboom too and I expect many other ports, especially those close to vanilla.
It actually affects most of the sprites, it is just most visible with the FreeDoom Imp. Sprites with large guard bands of transparent on each side seem to be immune because the clipping error involves pixels that do not show.
In R_DrawSprite, there is a test of seg scale against sprite scale.
This test causes the bug by rejecting a line segment that is further away than the sprite, from the clipping.
Consider a floor with two holes, one of which contains an Imp. The imp is clipped by the sides of the hole. We the viewer are looking at the hole a little to one side, so the hole sides are clipping the sprite too.
The bug is triggered if there is a vertex on one side of the hole, such that the sprite is just closer. The further line segment will have both of its vertexes further away than the sprite. This causes R_DrawSprite to reject it based on scale tests upon those endpoints. However, this line segment still needs to clip parts of the sprite that extend out in that direction. It is actually the floor that extends from that line segment that should clip the Imp tail. This floor can extend from the line segment all the way to the viewer.
Consider the second hole, behind the first. It also has seg that that are subject to the same tests. However, the floor that extends from it terminates at the edge of the first hole, and because of that it must NOT clip the sprite.
I have not found a way to correct this bug.
It looks like it will be complicated.
Last edited by wesleyjohnson on 08-23-11 at 20:52
|