Adjust Sprite Clipping

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
Scuba Steve
Posts: 1059
Joined: Sat Mar 27, 2004 8:56 pm

Adjust Sprite Clipping

Post by Scuba Steve »

Can anyone explain how the three different types of sprite clipping adjustment work (Always, Smart, Smarter)? It seems there's no good solution, the sprites are either in the floor or the z offset bounces up and down during animation (think the Cacodemon death). In all these years has anyone come up with a better way to handle proper sprite clipping? I read on the Strife: Veteran edition blog about how they solved the problem in the new engine... is this possible in GZDoom? Are we forever condemned to half-measures for fixing hardware sprite clipping?
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Adjust Sprite Clipping

Post by Gez »

The solution adopted by SVE causes a lot of overdraw and while that's okay for the SVE maps, GZDoom has to think about the performance impact on something like Ar Luminae, so no, it's not really possible to copy SVE's approach in GZDoom.


IIRC, "always" just always adjust the offset so that the entire sprite is visible, "smart" only does it for pickups and living monsters (I think, it's been a while), "smarter" adjust offsets by a factor inversely proportional to the sprite's height (so something very tall will still sink in the floor while something very thin will be raised to be entirely visible); "smarter" is also the only one that adjusts offsets for ceiling-spawned actors that clip in the ceiling, lowering them.

Back in the days I coded "smarter" so that things like the pool of blood would not disappear entirely, and for the ceiling thing it was about something in Strife. It's a bit less relevant now, at least for stock actors, since GZDoom actually contains its own list of offset override -- look at game_support.pk3/filter/<game>/sprofs.txt. (doom.id, heretic, hexen, and strife have one.)
Scuba Steve
Posts: 1059
Joined: Sat Mar 27, 2004 8:56 pm

Re: Adjust Sprite Clipping

Post by Scuba Steve »

Kaiser mentioned that the new Doom64 uses an entirely new method to render sprites properly in hardware.
User avatar
Rachael
Posts: 13557
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Adjust Sprite Clipping

Post by Rachael »

The easiest way that I know of to handle this would be to render the opaque view first like in the software renderer (which is everything sans sprites and 2-sided walls), clear the z-buffer, then render invisible walls with infinite height to the z-buffer, then do the masked pass after. Except, of course, ceilings lower than eye level and floors above eye level, they would render to the z-buffer at their normal height. Things also get more complicated with slopes involved, but instead of even bothering with those we could just use the clip system we have now that fudges the sprites out of the sector.

Not sure how well this will work - it still might be glitchy, but it seems to be a better way to do it than what we have now, and unfortunately (but obviously) it will also have a performance impact on older systems since the scene has to be redrawn in passes. I remember reading Kaiser's model and this method might be related to that in some way but I can't remember it exactly.
User avatar
Hellser
Global Moderator
Posts: 2706
Joined: Sun Jun 25, 2006 4:43 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Citadel Station

Re: Adjust Sprite Clipping

Post by Hellser »

If that were to be done, I believe having it as an option would help avoid performance impact on older systems. I myself would love to see some sort of OpenGL/Vulkan solution to proper sprite clipping. It's one of the few reasons why I still use the Software/Carmack renderer still.
Post Reply

Return to “General”