Page 1 of 1

Crosshair transparency problem in GL2 renderer

Posted: Fri Aug 18, 2017 9:57 pm
by armyman12345
While playing, there's a pure white square in the middle of the screen, it's obvious it's a graphical glitch. I am using Gzdoom 3.1, what's the cause?

Re: Weird problem in Project MSX

Posted: Sat Aug 19, 2017 1:16 am
by _mental_
Works fine for me:
Screenshot_Doom_20170819_100757.jpg
Post a screenshot and your hardware spec, just in case it's something specific to particular configuration.
Mine was taken with GZDoom 3.1.0 and Project MSX Beta 2 (v0.2a) July 22, 2013 from this topic.

Re: Weird problem in Project MSX

Posted: Sat Aug 19, 2017 6:47 am
by phantombeta
@_mental_
I imagine it might be the GL2 renderer bug where some crosshairs are drawn completely broken.
Will test something, then upload two screenshots showing the problem. (One being specifically what's probably the same thing the OP is seeing)
EDIT:
The problem seems to be with crosshairs that use black and white instead of transparency/alpha 0 and white.
I'm not sure, but it seems to be drawing them inverted, I think instead of interpreting black as alpha 0 and white as alpha 255, it's interpreting them the other way around.

You can see this problem in Guncaster

Insanity's Requiem

And Project MSX

Re: Weird problem in Project MSX

Posted: Sat Aug 19, 2017 8:22 am
by _mental_
It's indeed an issue in legacy render path, i.e. with OpenGL 2.x renderer.
This topic needs to be moved to Bugs subforum and renamed accordingly.

Re: Weird problem in Project MSX

Posted: Sat Aug 19, 2017 8:24 am
by wildweasel
_mental_ wrote:It's indeed an issue in legacy render path, i.e. with OpenGL 2.x renderer.
This topic needs to be moved to Bugs subforum and renamed accordingly.
Done

Re: Crosshair transparency problem in GL2 renderer

Posted: Sat Aug 19, 2017 8:45 am
by _mental_
Thanks.

Interestingly enough it's already broken in 2.2.0 and I guess crosshairs were never displayed correctly in legacy renderer since both path merged.
And this was never reported before IIRC. /me thinking about obsolete hardware/software support requests :roll:

Re: Crosshair transparency problem in GL2 renderer

Posted: Sat Aug 19, 2017 10:59 am
by phantombeta
Actually, this isn't just crosshairs. It seems pretty much anything that uses/can use black/white as alpha (For example, decals) is broken.
(Using actual alpha works fine, though, which is why the built-in crosshairs and decals don't look like the crosshairs in the screenshots I posted)

Re: Crosshair transparency problem in GL2 renderer

Posted: Fri Aug 25, 2017 6:45 am
by _mental_
Actually such textures are also broken in software renderer for a long time. At least in ZDoom 2.8.1 they are displayed in the same way as in the legacy render path currently.
Is this hardware renderer only feature? Before switching off shaders completely for OpenGL 2.x cards it worked in both paths.

Re: Crosshair transparency problem in GL2 renderer

Posted: Fri Aug 25, 2017 6:52 am
by Rachael
The truecolor renderer will respect the alpha channel of textures, at least if hardware acceleration is turned off. I am not 100% positive about on, but it should work just fine there, too.

Re: Crosshair transparency problem in GL2 renderer

Posted: Fri Aug 25, 2017 6:53 am
by Graf Zahl
Can it be that they are missing the 'aLph' chunk? That would explain the problem in the software renderer, but for hardware it should not matter. I guess the problem is caused by not applying the alphatexture translation.

Re: Crosshair transparency problem in GL2 renderer

Posted: Sun Aug 27, 2017 12:46 am
by Graf Zahl
The output is correct in both modern GL3 and hardware accelerated software 2D rendering.

It is not correct in GL2 and software 2D rendering.
The reason is that these textures are 24 bit grayscale textures.

Here's the problem: For both these modes the texture needs to be translated into an alpha texture - and that simply fails because the texture manager does not know how to do it.
Alpha textures that work correctly in all modes need proper setup:

1. They need to be 8 bit grayscale (not 24 and not 32 bit!)
2. They need an alPh chunk so that the texture manager knows that they are to be used as an alpha texture. (This is only needed for the software renderer.)

Since the problem only occurs in the two legacy render paths I am not going to throw more code at it as it'd be a very non-trivial fix. As time goes by all this stuff will sooner or later become unnecessary anyway while this hardware slowly disappears completely.
I think the only good this shows is that the market share of GL2 hardware isn't that high anymore, or more people would reported this long ago. :)

Re: Crosshair transparency problem in GL2 renderer

Posted: Sun Oct 15, 2017 7:38 pm
by raikosen
hi everyone i'm new here but i have this problem as well and i'm wondering if this is somehow related to these problems as well

1) when using night vision googles torches flames turn into white squares

2) in project brutality and bd v20 bloodsteps are black squares with bloodprints in them

3) again in pb and bd v20 explosion marks are black squares

4) when using an addon called fog effect made by saegiru located in moddb some map sectors get totally dark on random movements and/or when there are items and ammo pick ups on rooms

i have a very old machine but works good for me, and no, i can't get another one right now, so if these problems are all related, does that mean they all can be fixed with the same code? they are not gamebreaking though but it would be nice to have a solution for them

Re: Crosshair transparency problem in GL2 renderer

Posted: Mon Oct 16, 2017 2:52 am
by Graf Zahl
1) This is caused by badly defined graphics. Normally transparent parts are done by setting the alpha of that area to 0. But when using additive translucency just using black will look the same - unless the image gets inverted like the night vision effect does. This cannot be fixed in the engine, it will require a fix of the graphics themselves.

2 and 3) Essentially the same as 1) The graphics were not properly tested for their alpha channel settings.

To make it short. BD has always been a very sloppy product that contains lots of bugs both in its assets and script code.

4) I don't know. I have never seen that mod.

Re: Crosshair transparency problem in GL2 renderer

Posted: Mon Oct 16, 2017 9:35 am
by raikosen
so 1, 2 and 3 are game's problem, well i'll talk to developers for that

4) well here is a link to the addon in case you want to try it out, it worked ok for me until 2.4.x on 3.x i started to have these issues