[Fixed] [r3010] Translucency in HUD graphics not working?

Bugs that have been investigated and resolved somehow.

Moderator: Developers

[r3010] Translucency in HUD graphics not working?

Postby Jimmy » Fri Nov 26, 2010 3:59 pm

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 allExpand view
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
Jimmy
º~u~º
 
Joined: 10 Apr 2006
Location: Perth, WA

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

Postby Graf Zahl » Fri Nov 26, 2010 4:18 pm

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
Graf Zahl
 
Joined: 19 Jul 2003
Location: Germany

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

Postby Jimmy » Fri Nov 26, 2010 4:36 pm

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 allExpand view
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 allExpand view
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
Jimmy
º~u~º
 
Joined: 10 Apr 2006
Location: Perth, WA

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

Postby Kate » Sun Nov 28, 2010 4:30 pm

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
Kate
Will love and tolerate THE SHIT out of you
 
Joined: 15 Jul 2003
Location: New Jersey, US

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

Postby Jimmy » Sun Nov 28, 2010 5:12 pm

*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 allExpand view
// 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 allExpand view
  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 allExpand view
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 allExpand view
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
Jimmy
º~u~º
 
Joined: 10 Apr 2006
Location: Perth, WA

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

Postby NeuralStunner » Sun Nov 28, 2010 7:04 pm

Okay, I tested this.

I used a copy of the default DooM SBarInfo, but in place of this:
Code: Select allExpand view
drawmugshot "STF", 5, 143, 168;
I used this:
Code: Select allExpand view
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
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

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

Postby randi » Wed May 09, 2012 10:09 pm

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
randi
Site Admin
 
Joined: 09 Jul 2003

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

Postby Jimmy » Wed May 09, 2012 10:37 pm

I think the two problems are the same thing, just demonstrated differently, but I'll check and see if it fixes mine. :)
User avatar
Jimmy
º~u~º
 
Joined: 10 Apr 2006
Location: Perth, WA


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest