Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Transparent sprites looking dirty... help

Author
Message
AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 29th Jun 2003 07:57
So im all excited to try using sprites over 3d for my huds (no more pasting images onto 3d plains), but I noticed all my sprites are looking really bad. The problem is, db pro doesnt seem to pick out all the 0,0,0 black, thus leaving "almost" black pixles all over my sprites. Looks very bad. I tryed the old method of texturing a 3d plain and had the same problem.

Im using photoshop 5, and saving the jpg at the highest quality possible. Im 100% sure im not just missing some "0,0,1" pixles. Is this a flaw in db pro or am I doing something wrong?

Thanks in advance
AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 29th Jun 2003 07:59
Oh and by the way, Im using straight lines too, these are simple box shapes. Yet it still cant get the transparency right

Miez
23
Years of Service
User Offline
Joined: 29th Oct 2002
Location: Vanuatu
Posted: 29th Jun 2003 15:49
If I were you, I wouldn't use JPG images - they screw with your bitmap. Why not use BMP's?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Jun 2003 16:19
If transparency is what you want, then don't use jpegs.

Get the original image (not from the jpg!) and save it as a png instead.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 29th Jun 2003 17:30
jpeg is a lossy form of compression with anti aliasing and pixelation.

bwhaha try a real format before you whinge about a lossy pixelated format designed to reduce colours and size.

png bmp tiff

Guruchild
23
Years of Service
User Offline
Joined: 13th May 2003
Location: United States
Posted: 30th Jun 2003 01:49
I had the same problem when designing a HUD for one of my projects when I tried using jpg images for textures. After I switched to bmp format they worked perfectly. Listen to what these guys are saying, and you'll be fine. GG

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 05:56
Well I always figured a format like bmp would work fine, but they are huge in comparison to jpgs. And I know this is just a db pro issue, because I used transparent sprites/objects in db classic all the time. They looked 100x sharper than this.

I guess the answer to my question is - DB pro doesnt do transparency as well as classic. Deal with it and use a larger image format.

BTW, Ive never used a tif or png, maybe they are smaller than bmps. Ill go see.

Thanks for the info

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 05:58
png would be a better bet over a tiff

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 06:41
Well db pro doesnt support tif anyway. Also, I couldnt get even a black and white 64x64 png to go transparent. Pngs just dont seem to work with transparency (for me at least). indi have you ever been able to get a png to go transparent? BMPS work fine, as I expected, they are just so damn big...

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 06:47
I use photoshop and start with a transparent layer followed by another layer with the 2d image to make a png for DBP.

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 07:09
Im using photoshop 5. 0,0,0 Black always shows up as black, and the transparent layer in the background always shows up white. Neither seem to work. Sigh... when you save your png do you select anything for the "interlace" or "filter" options? Thats the only thing I can think of.

But you say you can get transparent sprites with png? I guess thats good news, just have to figure out what im doing wrong now...

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 07:14
I think I see the problem... Whenever I save the png, then reload it into photoshop, all layers are merged to one (no more transparency layer). Just a white backgroung.

Are you sure db pro recognizes transparent layers? I always figured the only way it would know what to make transparent was by searching for 0,0,0 black. Or am I perhaps doing something wrong when creating the png/layers in photoshop?

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 07:38
here is a sample with psd code and the final png.

Dont set any options for the png at export

http://www.lunarpixel.com/temp/alpha_test.zip

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 08:16
Thanks for the files, but my head really hurts now. I ran your demo, and sure enough the alpha.png worked fine with transparency. I loaded the png into photoshop, drew some stuff on it, and resaved it. Sure enough still worked with transparency. Here is the mind bender...

I loaded the psd, (and got a "this file contains unrecognized data, discard and continue?" error). I said ok, saved it as a png, and loaded it into your program. Didnt work. Another white border that should have been transparent. Just to test, I loaded up the original png, and deleted the image, saved it, and loaded it into your program. It showed up as a black and white silhouette of your original image (a layer that didnt display in the png or psd version when viewed in photoshop. Its like it was a secret encoded layer of the file).

Unless youre doing something differently than me (I create a new file with the contentes set to "transparent", draw a square, and save the file as .png with no special "interlace" or "filter" options. Never works). Perhaps its my version of photshop (5.0 LE), but I doubt it.

Any other ideas?

PS - unrelated question - Is there anyway to print/text on top of sprites?

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 08:19
Hmm when you said "when I export". Im using the "save a copy" command when I save files (png or otherwise). I looked under the "export" command and I can only "export" gif files. This isnt my problem is it?

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 08:27
"Unless youre doing something differently than me (I create a new file with the contentes set to "transparent", draw a square, and save the file as .png with no special "interlace" or "filter" options. Never works). Perhaps its my version of photshop (5.0 LE), but I doubt it.
"

perhaps, but you described the way i did indeed do it.
Le is a light edition and Im running full ps 6.0

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 08:42
So you are using "save a copy" eh? Well nuts thats the only other thing I can think of. Sigh well I guess ill have to stick to bmps. I need to keep them square 64x64, 128x128, ect... or else the transparency still gets gunky. Thats a problem when youre dealing with lots of bmps.

Well, for now id be happy if i could figure out a way to "text" over sprites. I want to write some numbers on my hud, but sprites always seem to be drawn on top. Ive tryed draw to front command, didnt work.

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 09:58
I dont think I used a save a copy feature, I did presave it as a psd for later alteration.


In order to display text over sprites:

(a)

create a sprite thats last in the list of sprites so it sits over the top of every other sprite or use the dbp darw sprite order command.

create a bitmap the size of the intended text and using getimage hand it over to an image location from bitmap zero.

use this image as the sprite image.


(b)

Alternative, draw in a 2d art package the numbers 0- 9 evenly spaced in a row so u can grab the correct series of numbers into image locations.

pasting the correct series of images together to produce the image for the last sprite.

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 30th Jun 2003 10:36
So when you went to save the png you used the export command? Maybe thats why mine arent working. Perhaps there is a difference between "save copy" and "export".

Wayne
23
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 30th Jun 2003 10:46
Hey indi, can you check out my post in the 3d discussion "People please help me out."
thanx
Wayne

AIPX Rocks
Nilrem
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 30th Jun 2003 15:02 Edited at: 30th Jun 2003 15:05
AzureZeal, well damn, I can't get the optimization window to pop-up in Photoshop 7, I had the same problem as you AzureZeal with PNGs but fixed it altering/setting some of the optimization options.

If you can get that window up I can most likely help you.

EDIT - For now the following may help you:
Quote: "The advantage of using PNG-24 is that it can preserve up to 256 levels of transparency in an image. To save an image with multilevel transparency, select Transparency."


I hear and I forget. I see and I remember. I do and I understand.
Attreid
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 30th Jun 2003 17:30 Edited at: 30th Jun 2003 17:43
I didn't read everything, but there's a way to use transparent sprites with jpeg, but I don't know if it work ... I write a small code, but I don't try it :




here you are ... try with a filter of 10, and try to increase-decrease it
I hope that it work ^_^

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 1st Jul 2003 00:12
Nilrem, youre not talking about the "PNG Options" window you get when saving a file are you? The...

Interlace
-None
-Adam7

Filter
-None
-Sub
-Up
-Average
-Paeth
-Adaptive

? I dont think ive ever seen a "optimizations" area/screen

Login to post a reply

Server time is: 2026-07-17 13:57:39
Your offset time is: 2026-07-17 13:57:39