Quantcast Transparency with tga images - LoTROInterface
VGInterface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #1  
Unread 10-13-2010, 07:50 AM
Chiran Chiran is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 27
Transparency with tga images

I have a problem with making transparency work with tga images. What I have is a control with tga background image displayed on top of a window. The window background is 10% transparent so I'd like that the rounded corners of the tga image blend with the window background. At the moment I'm using 100% black corners which isn't too bad, but it isn't optimal.

I've toyed with the tga alpha channel (making corners black and such) and all the different blending modes but so far I haven't found a combination that would work the way I want. What usually happens is that the corners 'burn' a hole through the window, the image disappears completely, or the whole image burns a hole through the window.

Has anyone else encountered this problem and managed to make it work?

-Chiran
Reply With Quote
  #2  
Unread 10-13-2010, 08:12 AM
daimon's Avatar
daimon daimon is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Aug 2007
Location: Finland
Posts: 466
Not sure what you exactly mean. alpha layer is pretty straightforward as you probably know. black is transparent, white not, grey values somewhere between (there's lots of guides to can google about it).

In some rare cases I have noticed if you have a couple of targa files overlapping each others the part where they cross might not show the transparency at all. This applies to skinning however, no idea if it's same with your own LUA windows.

Perhaps up a few screenshots of your problem for us to see and that might help with locating the problem.
__________________
~業 DaimonUI ~業
avatar by Humon
Reply With Quote
  #3  
Unread 10-13-2010, 08:18 AM
Chiran Chiran is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 27
Yes, I can post some pictures later.

Anyway, clearly I can make the corners transparent. But the problem is that it doesn't show the underlying window background under the corners. Instead, the game graphics shine through the corners.

-Chiran
Reply With Quote
  #4  
Unread 10-13-2010, 12:21 PM
Chiran Chiran is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 27
Here's a few example images.

Left: black button corners and 10% transparent window background (no alpha channel in the tga)
Middle: transparent corners, game graphics shining through
Right: Using Overlay blend mode, corners blend with window background but the underlying quickslot shines through (yeah it's a bit complicated heh)



The images are 300% zoomed so left and right images don't look that bad in-game.

-Chiran
Reply With Quote
  #5  
Unread 10-13-2010, 12:50 PM
daimon's Avatar
daimon daimon is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Aug 2007
Location: Finland
Posts: 466
And you tried to use same grey value on those corners in button files as you have on your background (not sure if you mean Overlay Blend term for this) ?

I'm gonna download your plugins to check the files and see if I could help that way. It looks a bit like a bug
__________________
~業 DaimonUI ~業
avatar by Humon
Reply With Quote
  #6  
Unread 10-13-2010, 01:04 PM
daimon's Avatar
daimon daimon is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Aug 2007
Location: Finland
Posts: 466
Does your button alpha layer look like this (I downloaded the current Songbook that didn't have an alpha layer at all like you said) ?

__________________
~業 DaimonUI ~業
avatar by Humon
Reply With Quote
  #7  
Unread 10-13-2010, 01:06 PM
Chiran Chiran is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 27
Quote:
Originally Posted by daimon
Does your button alpha layer look like this (I downloaded the current Songbook that didn't have an alpha layer at all like you said) ?

Yes I'm pretty sure I tried that too with the same results.

In those test images the window background is the default black window background with 0.9 window opacity value. And the corners on the middle and right test image alpha channel are 90% white (rgb 230,230,230) while the rest of the image is 100% white. I'm not exactly sure if it's even supposed to work like that.

-Chiran
Reply With Quote
  #8  
Unread 10-13-2010, 02:22 PM
D.H1cks's Avatar
D.H1cks D.H1cks is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Apr 2007
Posts: 162
I think I had a similar problem with alpha blending a custom control with a custom TGA. What I finally did was set the backcolor of the control to the same color as the parent. So in my case, I have a window with a button on it.
Code:
self:SetBackColor(self.bgColor);
self.toggleButton:SetBackColor(self.bgColor);
self.toggleButton:SetBackColorBlendMode(Turbine.UI.BlendMode.AlphaBlend);
self.toggleButton:SetBackground("....... point to tga file .... ");
I have to make sure I always set the back color of my control if I change the color of my window.

Have you tried the same?

Edit: Another possible way is: self.toggleButton:SetBackColorBlendMode(Turbine.UI .BlendMode.Undefined);
Edit2: You need to make sure you use self.toggleButton:SetBlendMode(Turbine.UI.BlendMod e.AlphaBlend); at the same time as the above line.

Last edited by D.H1cks : 10-13-2010 at 02:48 PM.
Reply With Quote
  #9  
Unread 10-13-2010, 03:10 PM
Chiran Chiran is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 27
Quote:
Originally Posted by D.H1cks
I have to make sure I always set the back color of my control if I change the color of my window.

Have you tried the same?

Edit: Another possible way is: self.toggleButton:SetBackColorBlendMode(Turbine.UI .BlendMode.Undefined);
Edit2: You need to make sure you use self.toggleButton:SetBlendMode(Turbine.UI.BlendMod e.AlphaBlend); at the same time as the above line.
Oh, have to try that. Putting SetBackColor and SetBackColorBlendmode before SetBackground didn't work for me, but didn't try the second suggestion yet. Maybe something is a bit different in the situation, but the result was an all-black control. I guess I'll have to toy with it a bit more. Thanks for all the suggestions so far .

-Chiran
Reply With Quote
  #10  
Unread 10-14-2010, 05:45 PM
Cearbhall's Avatar
Cearbhall Cearbhall is offline
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 5
try

Code:
element:SetBlendMode(Turbine.UI.BlendMode.AlphaBlend)
element:SetBackColorBlendMode(Turbine.UI.BlendMode.None)
element:SetBackground('path/to/texture.tga')
setting the BackColorBlendMode to None will allow alpha blended texture to be rendered on top of other textures/backgrounds correctly
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help recoloring images..... Thayilis Interface Help (L) 2 09-18-2010 03:42 PM
Transparency Marll Interface Help (L) 2 08-09-2010 02:17 PM
UI Transparency Shadimar Interface Help (L) 3 05-21-2009 07:51 PM
TGA Specifications anGel Graphics modification help (L) 7 05-17-2007 09:34 AM
A caution about small images Frosty Tutorials & Other Helpful Information (L) 0 02-15-2007 01:46 PM


All times are GMT -5. The time now is 04:56 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | VGInterface | LoTROInterface | MMOInterface | Swtorui