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 / DDS transparency problem

Author
Message
toggy
20
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 22nd Sep 2006 02:19 Edited at: 22nd Sep 2006 12:31
I can`t remove black color from images.Is there a way to make the black
color transparent?I tried all stuff from the forum,but no progres.
I have tried:
set object transparency,and
set objectWire, Transparent, Cull
but that seems have no efect...
Image got mipmaps and have tried to disable them with set object
texture,but nothing changed.
I have attached one image in .dds format.
Any suggestions?
Thanks.

simple code to test:

Attachments

Login to view attachments
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Sep 2006 11:39 Edited at: 22nd Sep 2006 11:44
I see what you mean. I'm not sure how to get transparency working with dds files either - perhaps someone can let us know? In the meantime the following, rather messy, solution seems to work:



I guess the black edges around the image occur because they are not quite black.

Edit: You might like to look at this thread:

http://forum.thegamecreators.com/?m=forum_view&t=89500&b=1
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Sep 2006 12:13
TGA, DDS and PNG have to have the transparency levels embedded within the image itself. You can't override these within DBPro easily. So basically you should have made the black areas transparent within the program you used to make the image.

Boo!
toggy
20
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 22nd Sep 2006 12:29
Yeah,as I tought,thanks Green Gandalf.
I did that already.I converted all .dds in to the .bmp file format.
I`m using PaintShopPro and some Nvidia plugin to load dds.
After conversion I use tool color picker to find any color neer black
and then using color replacer i turn those pixels to 0,0,0 rgb value.
That way there is no black edges around image.
With conversion to BMP I loose the alpha chanel and the mipmaps.
It`s not big deal,it`s ok as a .bmp but .ddd is nicer.
Here is the .bmp image cleaned.
Thanks again.

We are all open for suggestions regarding DDS file format.
If someone knows how to do it please let US know too...
thanks

Attachments

Login to view attachments
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Sep 2006 13:07
Don't ever use black colour transparency on a compressed image format - consider what would happen if you used a JPG, the interference and uglies that you end up with in JPG's would really tarnish that transparency. So if your using compressed textures, basically anything except for BMP, you need to use alpha transparency.

You could make the image into a memblock, and do a colour replace, but unfortunately you have to kinda exagerate the brightness, so that the darker transparent shades can be destinguished. It's really a lot less trouble to do this in your art package, like wand select black, the select the 'select similar' command and delete it all.

When using BMP's with single colour transparency, I always use RGB(255,0,255) - horrific purple as it's known to it's friends, it makes it a lot easier because you get black back.

''Stick that in your text and scroll it!.''
toggy
20
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 22nd Sep 2006 13:22
Thanks Spooky.
I am using PaintShopPro.
When I set transparency in program it`s reduces color depth to 256.
Even then there is no transparency in DBPro.There is a bunch of setings in DDS plugin export dialog so I`ll keep diging.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Sep 2006 13:44
That would be a 256 colour BMP, similar to how it handles icon files - in fact it's virtually identical. The transparency in that format is not supported by DBPro, it's actually a fairly old and tired method, even icons are gonna want alpha transparency support before very long.

''Stick that in your text and scroll it!.''
toggy
20
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 22nd Sep 2006 14:08 Edited at: 22nd Sep 2006 14:24
Thanks ,Van B.
Do you have any quick code for testing alpha transparency?
There is a dds image at the top of the post.
I kind a lost my self in your reply.
So if we use DDS(compressed textures) we must use alpha transparency,
wright?How exactly?
All my tweaks of dds texture inside PaintShopPro doesn`t have no afect.When I set background transparency in PaintShop it require
color reducing.
I have already converted all dds files to .bmp,set all background pixels to rgb(0,0,0) and that works nice in DBPro.I got a nice image
of explosion with no dark edges around it.
But I was wondering if there is a way to use original dds without changing the format and
color corections.
Thanks
EDIT:I have attached the shoot from DBpro.That is transparent bmp
image with 0,0,0 background.

Attachments

Login to view attachments
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Sep 2006 14:57
Alpha transparency is actually a seperate component of the colour of each pixel, so really you need the image to be in the right mode.

If I had to convert a bmp to an alpha DDS in PSP, I'd load the BMP, duplicate the layer, then hide the original layer and delete the black pixels from the new layer. You should then have your transparency showing through, like a checkerboard design. Once you have your checkerboard visible where transparency should be - you'd save that as a .DDS with the alpha enabled (not sure of the exact format). This is the same process for PNG's. If you can't get the transparency mode in PSP, like you can't see any transparent checkerboard, then try copying the image and pasting it as a new one, that tends to set it to alpha transparency for you.

''Stick that in your text and scroll it!.''
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Sep 2006 16:45
Sounds about right. Your original explosion DDS has no alpha data in it at all and so you need to create an alpha level within PSP like how Van B says. The hardest bit is selecting the right options when you export the DDS file from within PSP. i have just installed the Nvidia plugin and the DDS export routine has a million and one options and the few I tried don't quite get it right.

Boo!
Zerk
19
Years of Service
User Offline
Joined: 13th May 2006
Location: Orbiting Jupiter
Posted: 22nd Sep 2006 17:06 Edited at: 22nd Sep 2006 17:13
In a DDS, you have to add an alpha channel. Then save it as a format that supports the alpha channel like DXT3, DXT5... ect.

Using Photoshop (CE or w/ DDS plugin), here is a mini tut for making alpha channels.

1. Create your graphic
2. Select the "Channels" tab
3. Right click a channel and select "Duplicate Channel"
4. In the "Duplicate Channel" dialog, enter "Alpha" in the As: textbox and click OK

The channel will be black to white (0-255) indicating how much transparency to blend into the original image. 0 meaning none of the RGB color will be shown, 255 meaning all of the RGB color will be shown. 128 (gray) will be basically see-through. The darker the color, the more transparency basically.

5. Edit your alpha channel how you want it.
6. Save as an image format that supports alpha channels such as a DDS or a TGA.

Ta da!

I am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do. ~Hal-9000
toggy
20
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 22nd Sep 2006 19:10 Edited at: 22nd Sep 2006 19:24
Thanks guys.
You set me on the right path Van B,thanks.
I`v done it!!!!
Spooky you are right.
My original DDS had no alpha.
I discover that working with PaintShopPro 9.
When I load dds to PSP I choose to load them with mipmaps.
Once I load dds image to PSP,I delete alpha existing "false-all white" chanel from the image.
Then I use magic wand tool and select black area around explosion.
After that using select simular option I select few more pixels wich aren`t totaly black around explosion image.
That way there is no dark pixels around main explosion image later.
Then I invert the selection and save that selection to alpha chanel.
One thing remains is to save dds.
I have used DXT1,DXT3 and DXT5 format in dds export dialog and that works fine in DBPro.Plugin i use is Nvidia DDS format 6.74.
I choose "use existing mipmaps" because they are present in the image.
Other setings has default values.
Here is that plugin.It works with PhotoShop and PaintShop.
@Spooky:
Maybe this one got a nicer interface and it works perfectly.

Once more thanks guys.
I`ll write some sorth of tutorial of the whole proces if someone is intersted.

Attachments

Login to view attachments
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Sep 2006 19:23
Thanks for that. That is plugin 6.74 which is a hell of a lot neater than the old 5.19 version I installed which I found on another website.

For some reason the latest version on Nvidia website does not work for me and causes access violation errors. Seems to happen with a lot of other users aswell.

At least I have a version that works.

Boo!
toggy
20
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 22nd Sep 2006 19:28
@Spooky
Any time.You welcome

Login to post a reply

Server time is: 2025-06-25 13:52:56
Your offset time is: 2025-06-25 13:52:56