[r3010] Translucency in HUD graphics not working?

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

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 Reply
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

[r3010] Translucency in HUD graphics not working?

Post by Jimmy »

This TEXTURES code creates a graphic that looks similar to the default Doom status bar, but the grey lines creating the borders do not appear transparent. Perhaps it's something to do with the translations?

Code: Select all

graphic OMG_BRD1, 320, 2
{
  Patch STONE, 0, 0 { Translation "0:255=90:90" }
  Patch STONE, 256, 0 { Translation "0:255=90:90" }
}

graphic OMG_BRD2, 320, 2
{
  Patch STONE, 0, 0 { Translation "0:255=110:110" }
  Patch STONE, 256, 0 { Translation "0:255=110:110" }
}

graphic OMG_BRD3, 2, 30
{
  Patch STONE, 0, 0 { Translation "0:255=110:110" }
  Patch STONE, 1, 0 { Translation "0:255=90:90" }
}

graphic OMG_KEY, 11, 9
{
  Patch OMG_BRD1, 0, -1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, -1, 0 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD2, 0, 8 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 10, 0 { Style Translucent Alpha 0.5 }
}

graphic STBAR, 320, 32
{
  Patch STONE, 0, 0
  Patch STONE, 64, 0
  
  Patch OMG_BRD1, 0, -1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD2, 0, 31 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, -1, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 84, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 136, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 182, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 241, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 258, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 319, 1 { Style Translucent Alpha 0.5 }
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [r3010] Translucency in HUD graphics not working?

Post by Graf Zahl »

I think you are misunderstanding something here.
You do not define the translucency of the resulting texture here but with what an alpha the patch is drawn onto the texture. The resulting texture never has any translucency.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Re: [r3010] Translucency in HUD graphics not working?

Post by Jimmy »

I don't want the whole texture to be translucent, only the grey border lines (the OMG_BRD# patches), which are overlaid on top of a STONE patch, to simulate the look of the original Doom status bar. Right now, they appear as a solid color.

EDIT: I think I've located what the problem is. When a custom graphic is defined in TEXTURES, it has to have its Translation and Style parameters in the same definition, otherwise Style is ignored.

That's why this graphic's translucency works:

Code: Select all

graphic M_NSKUL1, 56, 56
{
  Offset 0, -1
  Patch M_SKULL1, 0, 0 { Translation "48:61=[255,255,255]:[255,255,255]","62:79=[255,255,255]:[32,32,32]","128:143=92:107","144:151=94:109","1:2=5:6" }
  Patch M_SKULL1, 0, 0 { Translation "0:255=0:0" Style Translucent Alpha 0.5 }
}
And this one's doesn't:

Code: Select all

graphic OMG_BRD1, 320, 2
{
  Patch STONE, 0, 0 { Translation "0:255=90:90" }
  Patch STONE, 256, 0 { Translation "0:255=90:90" }
}

graphic OMG_BRD2, 320, 2
{
  Patch STONE, 0, 0 { Translation "0:255=110:110" }
  Patch STONE, 256, 0 { Translation "0:255=110:110" }
}

graphic OMG_BRD3, 2, 30
{
  Patch STONE, 0, 0 { Translation "0:255=110:110" }
  Patch STONE, 1, 0 { Translation "0:255=90:90" }
}

graphic OMG_KEY, 11, 9
{
  Patch OMG_BRD1, 0, -1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, -1, 0 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD2, 0, 8  { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 10, 0 { Style Translucent Alpha 0.5 }
}
I think this is a bug. Can it be fixed?
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: [r3010] Translucency in HUD graphics not working?

Post by Kate »

No, it's not.

Basically, when you define a texture, it creates a solid blank canvas, then applies the patches onto the canvas using the defined rendering style, finalizing it that way. Think of it as burning the patches onto the texture's solid canvas. It's permanent and only works if there's a destination patch to burn the above patches onto. If there are none below the patch, it will become solid because there's just nothing below it to blend it with. This only happens from the start to the end of the texture being defined.

Once it moves onto a later texture definition, that previous one has already been finalized and burned together and the canvas solidified, so the patch has now been painted solid already, and thus will appear 100% solid when it is applied to another texture.

In order to get it to work as you want, you would have to specifically tell the engine that the translucency should be applied when you're defining the fully composed texture, not the individual patches, because they will be ignored since, when putting them together, there's nothing beneath them at that time, thus nothing to blend them with.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Re: [r3010] Translucency in HUD graphics not working?

Post by Jimmy »

*sigh* I am not trying to make the whole status bar translucent, just those border textures.

Here's my definition of the STBAR replacement.

Code: Select all

// STBAR stuff.

graphic OMG_BRD1, 320, 2
{
  Patch STONE, 0, 0 { Translation "0:255=90:90" }
  Patch STONE, 256, 0 { Translation "0:255=90:90" }
}

graphic OMG_BRD2, 320, 2
{
  Patch STONE, 0, 0 { Translation "0:255=110:110" }
  Patch STONE, 256, 0 { Translation "0:255=110:110" }
}

graphic OMG_BRD3, 2, 30
{
  Patch STONE, 0, 0 { Translation "0:255=110:110" }
  Patch STONE, 1, 0 { Translation "0:255=90:90" }
}

graphic OMG_KEY, 11, 9
{
  Patch OMG_BRD1, 0, -1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, -1, 0 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD2, 0, 8  { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 10, 0 { Style Translucent Alpha 0.5 }
}

texture OMG_SBAR, 320, 32
{
  Patch STONE, 0, 0
  Patch STONE, 64, 0
  
  Patch OMG_BRD1, 0, -1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD2, 0, 31 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, -1, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 84, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 136, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 182, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 241, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 258, 1 { Style Translucent Alpha 0.5 }
  Patch OMG_BRD3, 319, 1 { Style Translucent Alpha 0.5 }
}
Now, to pose an example of what's wrong here, when I add the following two lines to this definition...

Code: Select all

  Patch M_SKULL1, 8, 2 { Style Translucent Alpha 0.5 }
  Patch M_NSKUL1, 64, 2 { Style Translucent Alpha 0.5 }
This is what I see in game:

Image

A transparent menu skull appeared on the far left. No problem there.

However, that glitchy mess to the right of it is the result of the custom M_NSKUL1 graphic I made separately, which is defined as follows:

Code: Select all

graphic M_NSKUL1, 56, 56
{
  Offset 0, -1
  Patch M_SKULL1, 0, 0 { Translation "48:61=[255,255,255]:[255,255,255]","62:79=[255,255,255]:[32,32,32]","128:143=92:107","144:151=94:109","1:2=5:6" }
}
It has a custom translation, and a slightly bigger transparent box (56x56) surrounding it to account for WADs which replace the M_SKULL graphics. As you can see, there is no translucency at all (it should have an alpha of 0.5, as the other skull does), and the empty space around it creates some kind of HOM-like effect (you can see the Doom II title pic there).

Now, just to clarify, what happens when I apply that translation directly to the translucent menu skull on the far left?

Code: Select all

Translation "48:61=[255,255,255]:[255,255,255]","62:79=[255,255,255]:[32,32,32]","128:143=92:107","144:151=94:109","1:2=5:6"
Image

It looks fine.

Thus, the issue is defining Style and Translation separately, which is unfortunate, because in this scenario, it's much easier for me to be able to define the translations to apply to those border textures, before adding them one by one to the STBAR replacement.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [r3010] Translucency in HUD graphics not working?

Post by NeuralStunner »

Okay, I tested this.

I used a copy of the default DooM SBarInfo, but in place of this:

Code: Select all

drawmugshot "STF", 5, 143, 168;
I used this:

Code: Select all

drawimage "StPanel", 143, 169;
And then for Textures:
Spoiler:
Spoiler:
This isn't just SBarInfo, either, as I get the same lack of correct tranlucency when using the composite graphic as a sprite.

Essentially, In ZDoom the added blank space from the translated graphic is transferred to the composite graphic, if Alpha is used to composite it. In GZDoom it just negates Alpha altogether.
User avatar
randi
Site Admin
Posts: 7750
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: [r3010] Translucency in HUD graphics not working?

Post by randi »

Fixed NeuralStunner's example. I have no idea if that fixes the OP's problem or not, since NeuralStunner's example is the one I can actually use.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Re: [r3010] Translucency in HUD graphics not working?

Post by Jimmy »

I think the two problems are the same thing, just demonstrated differently, but I'll check and see if it fixes mine. :)
Post Reply

Return to “Closed Bugs [GZDoom]”