[4.2.4] Sprites far away get drawn over closer sprites

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [4.2.4] Sprites far away get drawn over closer sprites

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Matt » Sat Feb 15, 2020 1:42 pm

Confirmed gone, thanks!

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Accensus » Sat Feb 15, 2020 6:04 am

Looks like the bug's gone. Thank you, everyone!

Re: [4.2.4] Sprites far away get drawn over closer sprites

by SanyaWaffles » Sat Feb 15, 2020 5:23 am

I'll test this out the minute a new build becomes available

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Graf Zahl » Sat Feb 15, 2020 3:49 am

Please retest with the latest build. I believe this was caused by the depth sorting value being a 16.16 fixed point number - and Matt's unclipped bounds-check-free projectiles pretty much whack the sorter, it now uses floating point instead of integers.

Of couse it must be clearly stated that the projectile is broken by design, if you got stuff like that in your mod, please reconsider what your intent is!

Re: [4.2.4] Sprites far away get drawn over closer sprites

by SanyaWaffles » Sat Feb 15, 2020 2:07 am

I've been noticing this bug similarly with +FLATSPRITE but assumed that was because FLATSPRITE is a bit weird.

However this made me think otherwise.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Matt » Fri Feb 14, 2020 8:14 pm

Here's a zscript lump that can be used to test this.

This is the entire lump, just copypaste.

Code: Select all

class wbbb:weapon{
    default{weapon.slotnumber 1;}
    states{
    ready:
        TNT1 A 1 A_WeaponReady();
        wait;
    select:
        TNT1 A 0 A_Raise();
        wait;
    deselect:
        TNT1 A 0 A_Lower();
        wait;
    fire:
        TNT1 A 0{
            for(int i=0;i<100;i++){
                let aaa=spawn("hdbbbb",pos);aaa.vel=(frandom(-1000,1000),frandom(-1000,1000),frandom(0,40));
            }
        }
        TNT1 A 1 A_Refire();
        goto ready;
    hold:
        TNT1 A 1;
        TNT1 A 1 A_Refire();
        goto ready;
    }
}
class hdbbbb:actor{
    override void tick(){
        setorigin(pos+vel,true);
    }
    states{
    spawn:
        BAL1 A -1;
    }
} 
To test:

1. Summon a gazillion decorations scattered about in one area so you get lots of overlapping sprites. (EDIT: it may be necessary to do this under sky EDIT2: it is not, but it might be more effective or at least noticeable to have a variety of actors overlapping each other)
2. Give "wbbb" and fire it, then look around.
3. Repeat 2 as necessary.

Expected: the balls just fly off in random directions and nothing else happens.
Actual: after a few seconds or so your decorations start getting drawn in the wrong order.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Accensus » Fri Feb 14, 2020 6:15 pm

Went back as far as GZDoom 3.4.0 and the bug is still present in that version.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Matt » Fri Feb 14, 2020 4:26 pm

More specifically, HD's bullets are calling SetOrigin with interpolation to move the bullet actor "above" the ceiling, often well above 35000.

This has been changed as of this commit, relying instead on a vector3 that tracks the "real" position of the bullet.
I have been advised that this change does not mitigate the bug in any way whatsoever.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by phantombeta » Fri Feb 14, 2020 4:17 pm

After some testing, it turns out the rocket grenade from Hideous Destructor practically always triggers this. If one explodes in a sector with a sky ceiling, sprites will be sorted wrong as fuck for a while.


It seems to be related to HD's "bullets can fly into the sky" thing. It happens with bullets too, although it's slightly harder to have it happen long enough for you to shoot the bullets into the sky, then be able to look down and see the glitch.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Accensus » Thu Feb 13, 2020 4:14 pm

OP here. gl_sprite_blend doesn't help. In fact, it doesn't even do anything noticeable. Tested only on Vulkan, though.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Graf Zahl » Sat Jan 25, 2020 11:06 am

I think gl_sprite_blend is the culprit here. If you see it again, can you try to toggle that CVAR?

Re: [4.2.4] Sprites far away get drawn over closer sprites

by phantombeta » Sat Jan 25, 2020 10:53 am

Here you go. Maybe it has to do with the specific transparency settings of the surrounding actors, too.
Attachments
gzdoom-Chronos.ini
(114.71 KiB) Downloaded 30 times

Re: [4.2.4] Sprites far away get drawn over closer sprites

by Graf Zahl » Sat Jan 25, 2020 10:46 am

Please post your INI. Something must be different from mine, as I've never seen this effect.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by phantombeta » Sat Jan 25, 2020 10:29 am

I just had the bug again just now, also with HD. Some tree sprites (which are fully opaque) briefly got screwed up sorting, with some trees appearing in front of others when they shouldn't. The scene where it happened is depicted in the screenshot below:

However, in this case, they suddenly got correct depth sorting back. I'm guessing something somewhere is not setting state correctly, and transparent sprites are messing up depth culling for opaque ones.

Re: [4.2.4] Sprites far away get drawn over closer sprites

by sinisterseed » Mon Jan 20, 2020 6:15 am

Looking at the image in the first link above phantom's post, is that related to the second issue I reported here, but which was seemingly omitted (admittedly I should've probably made another topic for it to not get lost)?

viewtopic.php?f=7&t=66901

Some sprites/decals can be seen through walls: https://i.imgur.com/4EEY3To.png

Top