woof icon indicating copy to clipboard operation
woof copied to clipboard

R_DrawSprite: Enhancement to stop Things from disappearing due to "anchor" sector not being in line of sight

Open SirBofu opened this issue 4 months ago • 16 comments

There is an issue across source ports where sprites will abruptly disappear if the "center" point of a Thing is located on a sector that isn't currently visible to the player, even if the vast majority of the Thing would be visible to the player. This behavior is not unique to Woof, but improving the function here will likely enable it to be improved across all related sourceports.

I have attached a demonstration WAD here. There are three mancubi facing away from the player, each with a small column between them and the player. From left to right, I will call these Mancubus 1, Mancubus 2, and Mancubus 3. Mancubus 1 is in the same sector as the player; Mancubus 2 is in a small child sector; and Mancubus 3 is in an even smaller child sector. By strafing left and right and approaching the columns, we can observe different behaviors:

  1. Mancubus 1 will always be shown without issue, regardless of the player's position behind the pillars.
  2. Mancubus 2 will generally always be visible when the player views them from a distance, but if the player moves close enough to the pillar behind it, the Mancubus will abruptly disappear.
  3. Mancubus 3 will very easily pop in and pop out as the player strafes left and right, even when the player is not close to the pillar behind it.

While I'm not sure what form an improvement would take from a technical standpoint, in general, it seems like we could try to add some additional checks before determining that a sprite doesn't need to be drawn: in addition to checking the center position of the Thing, perhaps we should also check for visibility based on one or more of the Thing's four corners if the center is not visible. While this would not catch all cases, it would certainly result in much less pop-in and pop-out, and thus be a net improvement.

DrawTest.zip

SirBofu avatar Feb 27 '24 00:02 SirBofu