Black colour and sprite transparency

Started by WHAM, Tue 05/08/2008 21:09:34

Previous topic - Next topic

WHAM

Kill me, 'cause I know someone has asked this before, but I cant find the goddamned thread! (I'm pretty sure I asked this myself way back when, but its not in my post history... Maybe I'm getting paranoid...)

When I import a sprite to the sprite manager (the sprite has a pink background for the transparency, and some black areas within.) using the "Top left pixel" as transparent colour, the black areas are turned pink. The transparency works fine, but AGS seems to alter the pure black colour into something entirely else. Why? How do I get around this?


Image I use as the background:


What it looks like when I use it:
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

I imported the GUI with top-left pixel transparency into a 16bit default game, and drew a yellow rectangle on the backgrouind, here's a screenshot (v3.02):



(It looks just fine in the editor, too, btw.)

WHAM

Okay, but I'm using an empty game template. Is there a difference that could cause what I'm describing?
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

monkey0506

#3
No, you just have to change the transparency selection when you import the sprite from "Palette Index 0" to "Top-left pixel".

Nevermind I'm just an idiot. That's what I get for not reading every word... :)

Khris

As he stated in the first post, WHAM did use "top left pixel".

I copied the sprite straight from Firefox to AGS, maybe your graphics program screws up the transparency if you use copy & paste. Try saving the sprite as GIF, then import it.

Makeout Patrol

You know, I've been having a similar problem, but I figured it was something to do with what I was doing. I've found that I can get around it by importing .BMP files instead of whatever else I might try.

WHAM

Quote from: KhrisMUC on Tue 05/08/2008 22:39:16
As he stated in the first post, WHAM did use "top left pixel".

I copied the sprite straight from Firefox to AGS, maybe your graphics program screws up the transparency if you use copy & paste. Try saving the sprite as GIF, then import it.

All images are saved as .GIF and then imported to AGS...

The problem only manifests whan I use the empty game template, and not in the default game. What graphics options do those have that are different? Anything?
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

cat

What version do you use?

I had some problems that black was changing into blue with my backgrounds.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=33582.msg435879#msg435879

Maybe this is related? According to CJ this issue was fixed with some new AGS version.

Khris

The empty game template uses 8-bit by default, which would explain the screwed up colors.

I had a similar problem: even after changing to 16-bit, DirectDraw5 mode would screw up the colors because I hadn't imported a background and the room was still in 8-bit mode. Importing an all black background saved as 16-bit png fixed it.

WHAM

#9
Quote from: KhrisMUC on Wed 06/08/2008 09:05:22
The empty game template uses 8-bit by default, which would explain the screwed up colors.

I had a similar problem: even after changing to 16-bit, DirectDraw5 mode would screw up the colors because I hadn't imported a background and the room was still in 8-bit mode. Importing an all black background saved as 16-bit png fixed it.

This would sound logical! I'll try this when I get home from work, thanks!

EDIT: When using the empty game template, I started the editor, started making a new game, set (from general settings) the resolution to 640x400 and color depth to 16bit. Why, when I create a new room, does the game still say the ROOM is in 8bit 320x200? And if I try to run the game in this way, it shows me only half of my 640x400 room, which I created. It's as if AGS is not allowing me to change my game resolution at all?

Has someone tested the empty game template lately? Should it really work?
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

SSH

Have you imported a new BG for it yet?
12

WHAM

Quote from: SSH on Wed 06/08/2008 16:02:43
Have you imported a new BG for it yet?

Yup, and it seems that importing a b ackground brings the room and game's colour depht into order, but the resolution problem still remains.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

WHAM



Here's what my game looks like after the following steps (please tell me if I'm missing something)

1. Start ags -> new game -> Empty template
2. General Settings -> Resolution 640x400 / Colour 32bit
3. Import a sprite to the sprite editor -> Whole image / top left pixel transparent colour / not tiled import
(In the sprite editor, the characters black areas are coloured as the same colour that was used in the top left pixel. The sprite's resolution information, colour depth and size are correct in the lower-right corner "Appearance" tab)
4. Set the sprite as the only sprite in View 1 used by character 1.
5. Create a new room -> Give the room a background (I'm using a 600x400 image as a test image, this is shown as the background of the image above).
6. Compile -> Test

The result can be seen above. The room seems too big, because the game uses it as an extra large 320x200 background and moves the "camera" along with the character.
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

Khris

Using 3.1 beta 3, I followed your steps and the room shows up fine in-game. The character even looks a bit too tall compared to the doors.

WHAM

#14
I'm using 3.0.2 on Vista.

EDIT: Okay, the transparency problem has been solved. For some reason .gif files only caused this problem, and changing to .bpm and .png seems to make the transparency look normal. (Apparently .gif handles the ultimate white and black colours somehow differently or something...)

But still, the room size problem remains strong, as all the rooms remain in 320x200, even though I have changed the game resolution to 640x400.

SECOND EDIT: And now the room size problem fixed itself... sort of...

It seems that if the image you use as a background for a room is smaller than the game resolution, the game creates the room on a smaller resolution altogether. The image I was using was a slightly outdated one, and a bit too narrow, causing the mix-up.

Ahhh... I feel so relieved now that I can finally get some real work done here. Thanks to everyone for trying to help!
Wrongthinker and anticitizen one. Utterly untrustworthy. Pending removal to memory hole.

tilapisha



I'm having the same issue. The pants of my character are black, and it's using this as the transparent color. I didn't have this problem initially, but now as I load sprites (which are .png w/ transparency layer, I also tried bitmap but not working) it is reading this as transparent. I'm using top-left which should be transparent!

This is the image I want!

Crimson Wizard

tilapisha, please tell:
* what is your game's color depth
* what are the sprite import settings that you use?

I think, if you have a 32-bit game and you load pngs with transparency layer, you should be having "use alpha channel" and "leave as is" as options.
Black color is a default transparent color in 8-bit palette games, I think, but idk if that is related.

tilapisha

#17
I'm using 16-bit hi color.

I'm importing Alpha channel, Transparent-colour is top-left (or wherever is transparent) and thats it. I tried unlocking the re=map, and it worked for this sprite but not all.

Cassiebsg

Like CW said, set the import options to"use alpha channel" and "leave as is" and try again.
There are those who believe that life here began out there...

Crimson Wizard

#19
Quote from: Cassiebsg on Wed 20/04/2022 16:52:14
Like CW said, set the import options to"use alpha channel" and "leave as is" and try again.

If the game is 16-bit, then importing with alpha channel does not make a lot of sense. For 16-bit it's best to use mask (transparent) color on source images.

I'm also not certain if "remap colors" option would work on non-8-bit images, i thought it should not make any difference.

SMF spam blocked by CleanTalk