Author Topic: Problem related to displaying backgrounds  (Read 2874 times)

0 Members and 1 Guest are viewing this topic.

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Problem related to displaying backgrounds
I have a problem that is familiar to all who ever tried to make custom backgrounds. This time I cannot figure out the solution by myself, so I'm asking for your help. If a similar question has been answered already, my apologies. I couldn't find the answer using the search function.



As you can see, the black box (that could optionally be RGB:0,255,0) does not become transparent. I know that making the background green instead of black could solve this, but it doesn't. I also tried changing the planet image's file format between JPG, TGA, and PCX, but none remedied the problem. The PCX file wasn't even displayed.

What is wrong?
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Jeff Vader

  • The Back of the Hero!
  • Moderator
  • 212
  • Bwahaha
Re: Problem related to displaying backgrounds
Image format aren't quite my cup of tea, but I did come up with a few suggestions that you could try.

1. Try a black (0,0,0) background.
2. Try an actually transparent background.

Edit: Pardon. Reading while intoxicated is also not my cup of tea. Also, I've heard someone mention the words "alpha channel" in scenarios like this.
23:40 < achillion > EveningTea: ass
23:40 < achillion > wait no
23:40 < achillion > evilbagel: ass
23:40 < EveningTea > ?
23:40 < achillion > 2-letter tab complete failure

14:08 < achillion > there's too much talk of butts and dongs in here
14:08 < achillion > the level of discourse has really plummeted
14:08 < achillion > Let's talk about politics instead
14:08 <@The_E > butts and dongs are part of #hard-light's brand now
14:08 <@The_E > well
14:08 <@The_E > EvilBagel's brand, at least

01:06 < T-Rog > welp
01:07 < T-Rog > I've got to take some very strong antibiotics
01:07 < achillion > penis infection?
01:08 < T-Rog > Chlamydia
01:08 < achillion > O.o
01:09 < achillion > well
01:09 < achillion > I guess that happens
01:09 < T-Rog > at least it's curable
01:09 < achillion > yeah
01:10 < T-Rog > I take it you weren't actually expecting it to be a penis infection
01:10 < achillion > I was not

14:04 < achillion > Sometimes the way to simplify is to just have a habit and not think about it too much
14:05 < achillion > until stuff explodes
14:05 < achillion > then you start thinking about it

22:16 < T-Rog > I don't know how my gf would feel about Jewish conspiracy porn

15:41 <-INFO > EveningTea [[email protected]] has joined #hard-light
15:47 < EvilBagel> butt
15:51 < Achillion> yes
15:53 <-INFO > EveningTea [[email protected]] has quit [Quit: http://www.mibbit.com ajax IRC Client]

18:53 < Achillion> Dicks are fun

21:41 < MatthTheGeek> you can't spell assassin without two asses

20:05 < sigtau> i'm mining titcoins from now on

00:31 < oldlaptop> Drunken antisocial educated freezing hicks with good Internet == Finland stereotype

11:46 <-INFO > Kobrar [[email protected]] has joined #hard-light
11:50 < achtung> Surely you've heard of DVDA
11:50 < achtung> Double Vaginal Double ANal
11:51 < Kobrar> ...
11:51 <-INFO > Kobrar [[email protected]] has left #hard-light []

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Problem related to displaying backgrounds
I tried a black background (0, 0, 0). That's what you can see in the screenshot.

As for the transparent background: I don't know if that will work. Can JPG even save the "transparent color?" I thought it was only for special formats like GIMP's XCF or Photoshop's... err, can't remember the extension. [EDIT] Tried it and it didn't work. Every pixel should have an RGB value, so nothing related to transparency is possible.
« Last Edit: July 26, 2008, 04:32:08 pm by TopAce »
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Jeff Vader

  • The Back of the Hero!
  • Moderator
  • 212
  • Bwahaha
Re: Problem related to displaying backgrounds
I'm fighting an internal struggle about whether this would actually belong to the modding board or not. But for now... would this help?
23:40 < achillion > EveningTea: ass
23:40 < achillion > wait no
23:40 < achillion > evilbagel: ass
23:40 < EveningTea > ?
23:40 < achillion > 2-letter tab complete failure

14:08 < achillion > there's too much talk of butts and dongs in here
14:08 < achillion > the level of discourse has really plummeted
14:08 < achillion > Let's talk about politics instead
14:08 <@The_E > butts and dongs are part of #hard-light's brand now
14:08 <@The_E > well
14:08 <@The_E > EvilBagel's brand, at least

01:06 < T-Rog > welp
01:07 < T-Rog > I've got to take some very strong antibiotics
01:07 < achillion > penis infection?
01:08 < T-Rog > Chlamydia
01:08 < achillion > O.o
01:09 < achillion > well
01:09 < achillion > I guess that happens
01:09 < T-Rog > at least it's curable
01:09 < achillion > yeah
01:10 < T-Rog > I take it you weren't actually expecting it to be a penis infection
01:10 < achillion > I was not

14:04 < achillion > Sometimes the way to simplify is to just have a habit and not think about it too much
14:05 < achillion > until stuff explodes
14:05 < achillion > then you start thinking about it

22:16 < T-Rog > I don't know how my gf would feel about Jewish conspiracy porn

15:41 <-INFO > EveningTea [[email protected]] has joined #hard-light
15:47 < EvilBagel> butt
15:51 < Achillion> yes
15:53 <-INFO > EveningTea [[email protected]] has quit [Quit: http://www.mibbit.com ajax IRC Client]

18:53 < Achillion> Dicks are fun

21:41 < MatthTheGeek> you can't spell assassin without two asses

20:05 < sigtau> i'm mining titcoins from now on

00:31 < oldlaptop> Drunken antisocial educated freezing hicks with good Internet == Finland stereotype

11:46 <-INFO > Kobrar [[email protected]] has joined #hard-light
11:50 < achtung> Surely you've heard of DVDA
11:50 < achtung> Double Vaginal Double ANal
11:51 < Kobrar> ...
11:51 <-INFO > Kobrar [[email protected]] has left #hard-light []

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Problem related to displaying backgrounds
This belongs to this forum because there is no such an issue in Retail.
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Problem related to displaying backgrounds
Make the background transparent and save the image as 32-bit TGA (this can be done in GIMP). Or via the 0,255,0 in 8-bit (important!!) PCX images.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Problem related to displaying backgrounds
Ah, the image is 24-bit so far. I'll save in 32-bit and TGA, then.
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Problem related to displaying backgrounds
Make sure you're running in OpenGL mode not Direct3D though.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Problem related to displaying backgrounds
Also just to be sure, it should be $BitmapX in stars.tbl to use alpha blending for transparency (which kinda replaces the retail's infamous green=transparency system). $Bitmap uses additive blending, ie. the image should have black background and no alpha channel at all (Flattened with black as background colour in GIMP works fine).

Or I might be wrong and the game is smart enough to automatically decide which blending mode it should use, in which case the existence of alpha channel decides what the game does, but making a planet use additive blending is just... wrong, because you would see the background stars through the dark side of the planet (and other black parts on the planet's surface).

Also, Retail does exactly the same if you surround a planet with black space. It too needs to be told that "this area of the image should be transparent and the background behind it should be visible mmkay". Retail just used pure green colour to tell transparent bits from opaque (not green), which works to an extent but doesn't really give any kind of blending, anti-aliasing or transparency gradients - it's purely on/off system and the retail planets certainly look the part...
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Problem related to displaying backgrounds
Make sure you're running in OpenGL mode not Direct3D though.

Interestingly, if I run in OpenGL mode, the nebula disappear.

I'm trying to find the way to convert 24-bit to 32-bit in GIMP. When I set the image's resolution, nothing tells me explicitly that the image will be x-bit. I changed something from 12 to 16, supposing that if GIMP automatically saves in 24-bit (12x2), then this will change in 32-bit (16x2). IrfanView's load tab tells me that the image that I saved this way is 32-bit, but when I open it, it says that it's 1024x1024x24 BPP in the lower-left corner.

@Herra: It's been $BitmapX all along. I'm trying to replace some old 256-color planets of mine with new ones, so I did not even touch the tables. Also, as you can see in the screenie, FS isn't smart enough to figure out which parts of the image should be transparent. I triple checked it, and that black hue is 0, 0, 0.
« Last Edit: July 27, 2008, 11:09:13 am by TopAce »
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: Problem related to displaying backgrounds
Layer -> Transparency -> Add Alpha Channel

...makes each pixel have RGBA value instead of just RGB. Then when you save the file, it'll be 4x8bit=32bit (RGBA) instead of 3x8bit=24bit RGB image.

Then you need to just put the alpha channel to use. Easiest is to do this when you're making the planet in the first place, but you can do it by alpha masking the planet later, too. It's just that GIMP's layer management is a bit... original. :nervous:

Basically, your alpha channel needs to have a white (=opaque) circle overlayed to the planet, and black (=transparent) on the surrounding space... possibly with some blending to take care of atmospheric glow if the planet has one.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

  

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Problem related to displaying backgrounds
Whoah... it's... complicated. More complicated than I though.

It does the trick. Danke schön.
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.