Problems with transparent custom textures

Everything around the Descent level editor

Moderators: Frustikus, Aus-RED-5

User avatar
Enzo03
Posts: 135
Joined: Wed Apr 01, 2009 1:19 pm
Location: Private Luxury Worldship.
Contact:

Problems with transparent custom textures

Postby Enzo03 » Tue Apr 17, 2012 2:49 am

I was trying to make a custom texture for someone which was simply a texture with their name on it. It was to be like any other transparent/secondary texture, such as grates or ladders, and able to be placed on any primary texture as a secondary.

It is a 64x64 texture, just like the textures which come with the game.

It looks perfectly fine in the editor, but when I go ingame, the area which is supposed to be transparent is a whitish color. :clue:

When I try to use the paint tool to make a texture have a transparent area, instead of the color for transparency I get a bright red color, and the bright red appears both in game and in editor.

:think: Dang, this was nowhere near as hard to get right in the past. Surely it shouldn't be so hard to get it right.
Some people are like Slinkies. They aren't really good or even useful for anything but they always manage to put a little smile on your face when you give them enough of a push down the stairs.
User avatar
Weyrman
D2X-XL Expert
D2X-XL Expert
Posts: 579
Joined: Tue Sep 25, 2007 7:47 pm
Location: Brisbane Australia
Contact:

Re: Problems with transparent custom textures

Postby Weyrman » Tue Apr 17, 2012 6:58 am

the transparent sections involves an alpha channel in the graphic, so make sure you use an editor that handles alpha. It has been a few years since I did the little that I contributed but I did ask questions so do a forum search on alpha and see what comes up, other than that, hopefully someone a lot more knowledgeable will chime in for you.
-SYSTEM SPECS-
MBoard:"GigaByte Z68X-UD3H-B3" Motherboard
CPU: Intel i7 E2600 3.40GHz
RAM: 8GB DDR3 2133MHZ
HD: WDC 10EARX 1TB SATA
Video: GigaByte 1G ATI 4890
Monitor: Asus VS428 LCD 24"
Sound: Onboard - now with connected 5.1 sound system
OS: Windows 7 x64 Home Premium
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Re: Problems with transparent custom textures

Postby karx11erx » Tue Apr 17, 2012 9:18 am

I can give you a few pointers how to do that with GIMP.

First, create a texture of the required size (e.g. 256x256) with GIMP. When creating it, expand the "advanced options" (or so section) and chose "transparent" as background color. Paint your text on it and save it as TGA. When prompted to adjust the TGA properties, uncheck "compressed" and save the file. When importing the texture with DLE-XP, it will be used as is with D2X-XL levels. For standard levels, DLE-XP will automatically convert it to a 64x64 palettized bitmap using the level's current palette (e.g. groupa), preserving any transparency in the texture. This may cause some quality loss but will save you the work of messing around with a palettized bitmap.
User avatar
Aus-RED-5
Forum Moderator
Posts: 1490
Joined: Tue Sep 25, 2007 9:02 am
Location: Adelaide, South Australia
Contact:

Re: Problems with transparent custom textures

Postby Aus-RED-5 » Tue Apr 17, 2012 9:24 am

Back in the days ('97ish). I used to export a transparent texture and use that transparent part of the texture for what I wanted to do.
In MS paint. I used the "color picker" to pick the correct color for transparency. ;)

Then there is the Diedel way! That will work too. :mrgreen: :thumb:
----System Specs----
Case: Corsair Obsidian 650D Black
Motherboard: ASUS Sabertooth X58
CPU: Intel Core i7 960 3.20ghz
Heat Sink: Corsair H100 CPU Water Cooler
Memory: Corsair 6GB (3 x 2048mb) DDR3 1600 Dominator (PC12800 - TR3X6G1600C8D)
Video Card: ATi SAPPHIRE Radeon HD 7970 3GB GDDR5 OC Edition
Hard Drives: SSD Corsair Force Series 3 F120 120GB & WD5003ABYX Enterprise RE4 500GB
Media Player: LG BH10LS30 BluRay Burner
Power Supply: Corsair HX-850
OS: Windows 7 Pro 64Bit
Monitor: Benq XL2420T LED
User avatar
Hawkins
Posts: 256
Joined: Wed Jan 11, 2012 1:18 pm
Location: /Universe/Milky-way/Sol/Earth/Europe/Greece/Athens/~

Re: Problems with transparent custom textures

Postby Hawkins » Tue Apr 17, 2012 10:03 am

THe XL way is better. The alpha channel in TGA and XL texture support is 8bit, not just 1bit.
:muscle:
Gigabyte® GA-X48-DQ6
Intel® Core 2™ Quad Q6600 @2.4GHz
ATi(AMD®) Radeon™ HD4870
________________________________________________________________________
Descent Rangers
Captain of Black Lions squadron
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Re: Problems with transparent custom textures

Postby karx11erx » Tue Apr 17, 2012 11:04 am

True. Standard Descent only supports fully transparent (invisible) or fully opaque.
User avatar
Enzo03
Posts: 135
Joined: Wed Apr 01, 2009 1:19 pm
Location: Private Luxury Worldship.
Contact:

Re: Problems with transparent custom textures

Postby Enzo03 » Tue Apr 17, 2012 6:03 pm

I'm trying to do it the "standard/old" way, and that is the only way I will have it, because that is what I am asking for help with.

I am not asking for the "XL" way. I just want to import a 64x64 texture properly, without hair pulling, like I could with DMB2. I don't want to make a 128x128 or 256x256 texture just so it can be resized in a manner which may lose details which I want. For example, when using the Descent Menu Font on a texture, when it is resized to 64x64, the letter R has a tendency to look like the letter A even though there is a vast difference between R and A in that font. It is still difficult to tell the difference at a glance.

It is also apparent that the built in texture editor is broken for applying transparency, as I am completely unable to do so, resulting in what is instead bright red.

I also have a bit of an aversion toward DLE-XP's texture importer because like DMB2's importer, the color loss which follows is sometimes.. yuck. I prefer the old DTX2 converter, which at least seems to convert textures much better. I almost do not recognize color loss when I use DTX2 whereas with DLE or DMB2, I have had textures completely change color and detail.

I appreciate the GIMP lesson even though I already know how to do pretty much everything in it and much more with GIMP - though the thing to turn off compression is a good thing to note.

I don't care about the apparent "mess" of working with palettized bitmap. There is absolutely nothing you could do that would make me do so much as give the smallest possible care about it. It is how I want to do it. Isn't that reason enough?

Aus-RED-5 wrote:Back in the days ('97ish). I used to export a transparent texture and use that transparent part of the texture for what I wanted to do.
In MS paint. I used the "color picker" to pick the correct color for transparency. ;)
That is precisely what I did, except I used GIMP. When GIMP loads a 256 color texture it uses the texture's palette. In 06 when I used DMB2 all the time, I would do this with GIMP and I would have absolutely no problems whatsoever.
When I use DLE though, it looks fine in the editor but the transparency does not work ingame.. and I am a broken record.

Sorry, I'm a bit on edge today. :|
Some people are like Slinkies. They aren't really good or even useful for anything but they always manage to put a little smile on your face when you give them enough of a push down the stairs.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Re: Problems with transparent custom textures

Postby karx11erx » Tue Apr 17, 2012 6:43 pm

The general problem with Descent bitmaps is that you have only 256 colors available (that's this ominous 'palette': It's simply a table with 256 colors). The available colors vary depending on the level's palette (groupa (standard), ice, fire, ...). DLE-XP uses DMB2's algorithm for finding the best match for a RGB color in the palette. If DTX2 has a better method, I'd be happy to use it instead. Palettized bitmaps only contain color table indices. To render such a bitmap, you need to walk through it, look up the color for each pixel using the pixel's palette index, and render that color. That's how standard Descent does it.

Creating 64x64 TGAs will at least help to avoid quality loss due to DLE-XP down-scaling bigger textures.

If you want to create a custom texture based on a palettized Descent bitmap, export some texture from a Descent level (using "empty - light" is a good idea, as it entirely consists of Descent's color key for transparency - this color key is the same for all Descent palettes). The only thing you need to consider is that if you apply changes to a custom texture based on a (any) Descent texture, you need to export the texture from a level you have set the required color palette for. Otherwise, you will create your texture, and it will look fine for you in your image editor, but since all colors you see are mapped to palette indices, once you load that texture into a level using a different palette, the custom bitmap's color indices will point into a different palette than you saw when creating it, and the bitmap will look miscolored.

As far as bugs are concerned: You know where to report them. ;)

A word about your tone: I would appreciate it if I there was less aggravation and emotion I had to subtract from your posts in the future in order to distill the actual facts from them. You should have understood by now that I am a constructive person, and that people (particularly if they are as active and quality geared as your are) are well supported by me.
User avatar
Enzo03
Posts: 135
Joined: Wed Apr 01, 2009 1:19 pm
Location: Private Luxury Worldship.
Contact:

Re: Problems with transparent custom textures

Postby Enzo03 » Tue Apr 17, 2012 7:21 pm

Whenever come to this particular forum, I always get a "my way or the highway" air, as if daring to suggest that I or someone else try to do something a way different from what is apparently the norm here makes me suddenly ineligible and too inferior to be qualified to so much as have an opinion on the subject, so much as express it.

For example, using this situation, I want to insert a texture the old way, like I would with regular D2 levels, while I'm being told to do it this new way which apparently does not seem to work with the texture size I want, which is the only way I can make sure that the texture comes out exactly the way I want. At the same time, it is implied that there is absolutely no reason I should even do so much as bother with the old way, because it is apparently so inferior that it would be foolish to try to use it anymore.

Regardless, I must apologize for the hostility and so I do. Things have been rough as of late and I've been doing my best to keep on the up and up. But I am a tense (intense?) person by nature, and the atmosphere here doesn't really help me out.

But it is no excuse, and as it stands there is no excuse.
Some people are like Slinkies. They aren't really good or even useful for anything but they always manage to put a little smile on your face when you give them enough of a push down the stairs.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Re: Problems with transparent custom textures

Postby karx11erx » Tue Apr 17, 2012 7:36 pm

I could have made it short, just saying that I have no clue what I said that could make you feel like that, but I will try to raise a bit understanding of my side instead.

Technical stuff first: If you want to create a palettized custom bitmap that will look in Descent exactly like you saw in your image editor, you will need to use exactly the palette Descent is using to render it. The easiest way to get a base for such a bitmap is to export one from a Descent level using the intended palette, modify it and load it in your level when it's finished. That is what you had asked for in the beginning, and that is what I had explained to you already. Where's the problem? :clue:

Enzo03 wrote:Whenever come to this particular forum, I always get a "my way or the highway" air, as if daring to suggest that I or someone else try to do something a way different from what is apparently the norm here makes me suddenly ineligible and too inferior to be qualified to so much as have an opinion on the subject, so much as express it.

All I did was offer some insight in the technicalities of the issue and some advice how to work around the current limitations you encounter, all in good faith you would understand that and be grateful for the support. I have no idea how you would come to such a conclusion.

Enzo03 wrote:For example, using this situation, I want to insert a texture the old way, like I would with regular D2 levels, while I'm being told to do it this new way which apparently does not seem to work with the texture size I want, which is the only way I can make sure that the texture comes out exactly the way I want. At the same time, it is implied that there is absolutely no reason I should even do so much as bother with the old way, because it is apparently so inferior that it would be foolish to try to use it anymore.

I have no idea what in my above posts could induce such conclusions. If you re-read you will determine that I described a way to insert custom textures in Descent levels "the old way". Btw, I had to guess what you consider inserting textures in levels "the old way" - your post doesn't explain that in enough detail to make that clear for me.

Enzo03 wrote:Regardless, I must apologize for the hostility and so I do. Things have been rough as of late and I've been doing my best to keep on the up and up. But I am a tense (intense?) person by nature, and the atmosphere here doesn't really help me out.

Now here's my conclusion. You are coming here with a massive prejudice, a prejudice I have never even given reason for to you - be it in the distant nor in the near past. I suppose it has been fed by what peers of you have reported to you about me in other places. Your entire perception of this thread and your treatment in this forum and by me in general is poisoned and distorted by that negative preconception of yours. I have always been treating you on eye height - giving detailled explanations to you is an expression of that.

Usually I wouldn't have bothered explaining that much to anybody here at all, and I hope you are able to settle your negative feelings about this place and me for now and for good, because I find impulses that are rather rooted in your personality and individual perception than in what is actually going on to be more and more stressful for me.

You should remember that I don't make any money with D2X-XL nor DLE-XP, and everything I am doing here is good will and friendliness. Given that, people using these programs have got quite a lot they should actually be thankful for.

Enzo03 wrote:But it is no excuse, and as it stands there is no excuse.

Apology accepted. Just remember that nobody here has anything against you. Maybe my level of technical and personal demand is higher than you are used to from other places. Why don't you try to see that as appreciation rather than as humiliation? Look at it from the perspective of being trusted to be able to cope with instead of being put down.
User avatar
Alter-Fox
Posts: 1132
Joined: Mon Mar 31, 2008 7:29 pm
Location: some other reality

Re: Problems with transparent custom textures

Postby Alter-Fox » Tue Apr 17, 2012 7:39 pm

Why don't you use DTX2?
If you can't run it you could send what you want converted to me (with instructions on what to do in DTX2 because I've never done it before :P), and I can try to get the pog back to you.
We live in a universe... It's distracting
=========================================================
beware of ounce
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Re: Problems with transparent custom textures

Postby karx11erx » Tue Apr 17, 2012 7:47 pm

Does someone have the DTX2 code? It'd be interesting to see how it maps textures to Descent level palettes.
User avatar
Enzo03
Posts: 135
Joined: Wed Apr 01, 2009 1:19 pm
Location: Private Luxury Worldship.
Contact:

Re: Problems with transparent custom textures

Postby Enzo03 » Tue Apr 17, 2012 8:23 pm

I in fact did extract a texture from Descent 2. I used this texture as a base and put the transparent texture all over it, then put the person's name on top of it (I could have just used empty - light but... I didn't). Point is, I did use a D2 texture as a base, so the only colors which appeared on the image *should* have been ones within the palette.

I edited it and saved it, making sure the palette is the same and loaded it into the level.

I did this in two ways: one by using DTX2 to make a POG file with the texture in it, and inserting the POG file into the HOG. The other way was simply replacing a texture from within DLE.

Using DTX2 to make a POG file with the texture in it appears to work perfectly... from within the editor. DTX2 also says that this is a texture which has transparency. But I get a white background when I go in game i.e. all places which are transparent are instead white.

I have just found out that this by itself is probably not a DLE problem, because the same seems to happen in SDLDevil, according the Blarget, when he made his own texture - it looks fine in SDLDevil as well but also has the white background ingame. But it is still strange.

Using DLE, I get a white background when I load the same exact texture. And then I also get the problems when I try to do transparency - you know what I'll put it in the tracker - where I get bright red--actually, no, for me the entire texture edit tool is broken, and the only colors that can be painted upon the texture are various shades of red!

:|

So to the tracker I'll go.
Some people are like Slinkies. They aren't really good or even useful for anything but they always manage to put a little smile on your face when you give them enough of a push down the stairs.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Re: Problems with transparent custom textures

Postby karx11erx » Tue Apr 17, 2012 8:35 pm

I think it's a texture problem. The palette index 254 is interpreted as "transparent" for all Descent palettes. If you make sure that your texture has that value in every pixel that should be transparent you should be fine. Btw, depending on palette, the corresponding color value isn't always white - afaik for the water palette it's some light blue. Doesn't matter though: When Descent sees that palette index in a bitmap pixel, it will not render that pixel.

Descent has a second kind of transparency: "Punch through". That's the pink inside door openings and some gratings. When Descent finds that color in an overlay texture's pixel, the pixel of the underlieing base texture is also discarded.

Since this palette stuff is so hard to handle, I added RGBA (A = alpha channel = transparency) custom texture handling to DLE-XP to make things easier. That's why I proposed creating a TGA texture (must be uncompressed for DLE-XP!) and importing it in DLE-XP. Of course you may encounter some quality loss. You could diminish that by first creating a 256 color TGA and then upgrading it to full 32 bit RGBA before saving and importing it in DLE-XP.

I have also had a problem with such textures not always being properly displayed, but since I am busy with finishing the OpenGL renderer in DLE-XP, I didn't yet have time to look into it.

Oh yeah, you can really forget the texture edit tool. It was pathetic from the beginning. I only left this in the program because it was there in DMB2 (and probably even broke it and never bothered to fix it). If you want to do yourself a favor, use Paint.NET or GIMP. When DMB2 was conceived, useful image editing programs probably all cost money, but these days there are very good free ones which just are the better choice here.
User avatar
Pumo
D2X-XL Expert
D2X-XL Expert
Posts: 1434
Joined: Tue Sep 25, 2007 9:28 pm
Location: Here :)
Contact:

Re: Problems with transparent custom textures

Postby Pumo » Tue Apr 17, 2012 8:41 pm

Just a small clarification here:
I've imported in DLE-XP old-school lo-res textures with the white color (the one that gets translated to transparent. I think it's 252,252,252) and it works, but only if I import them as .BMP, as at least on my own experience, importing TGA into DLE-XP works best when working with hi-res textures (XL).

Are you (Enzo) importing BMP or TGA in the first place?
[Pumo software main website] - Pumo Mines current progress: 60%
-SYSTEM SPECS-
CPU: Intel Core i7 4790 3.6 GHz (4 GHz Turbo)
RAM: 16GB DDR3 1333MHZ
SSD: Kingston SSDNow V300, 240GB
HDD: Seagate 1TB 7200RPM SATA
External HDD: Seagate Backup Plus Slim 1TB 5400RPM
Video: nVidia GeForce GTX 1050 Ti OC 4GB
Sound: RealTek High Definition Audio
Display 1: LG 24M38H 24" 1080p HD LED Monitor
Display 2: Dell 19" 1440x900 TFT Monitor
OS: Windows 10 64-bits

Return to “DLE-XP Help”

Who is online

Users browsing this forum: No registered users and 1 guest