Hard Light Productions Forums
General FreeSpace => FreeSpace & FreeSpace Open Support => Topic started by: TopAce on July 26, 2008, 03:53:53 pm
-
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.
(http://www.penguinbomb.com/ithov/bgroundprob.jpg)
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?
-
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.
-
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.
-
I'm fighting an internal struggle about whether this would actually belong to the modding board or not. But for now... would this help (http://www.hard-light.net/forums/index.php/topic,46147.msg1103643.html#msg1103643)?
-
This belongs to this forum because there is no such an issue in Retail.
-
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.
-
Ah, the image is 24-bit so far. I'll save in 32-bit and TGA, then.
-
Make sure you're running in OpenGL mode not Direct3D though.
-
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...
-
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.
-
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.
-
Whoah... it's... complicated. More complicated than I though.
It does the trick. Danke schön.