Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

Nysha's New Creators for November - posted on 1st Dec 2017 at 10:00 AM
Replies: 18 (Who?), Viewed: 5825 times.
Lab Assistant
Original Poster
#1 Old 3rd Aug 2009 at 3:32 PM Last edited by Valencay : 3rd Aug 2009 at 3:51 PM.
Default DXT Compression: Tips for Minimising Bleeding?
I've been working on some art for new paintings but after finishing a few all I've done for last 3 days is try everything I can possibly think of to reduce the colour bleeding that occurs when compressing the DDS.

Obviously, there is going to be some loss of quality but my biggest problem is with a couple of images which have a strong plain background colour with the main detail in greyscale. I've attached a couple of screenshots showing the zoomed image pre-compression beside the in-game result, where the colour has basically eaten part of the image.

Quite possibly, it is my poor image editing skill that is the problem. I'm also thinking that perhaps I can alleviate it somehow using the channels, but I haven't ever worked with channels before so I have no idea. If anyone has any helpful tips, I would be most grateful.

Note: Using GIMP.






Boredom is counterrevolutionary.
Advertisement
Lab Assistant
#2 Old 3rd Aug 2009 at 4:43 PM
Don't use the gimp plugin to save. It's awful. When I was coding Neighborhood Workshop I implemented some random code I found online and got better results.

Instead, you might want to look at something like AMD's compressonator to to apply compression after you save your work as a resular image format.
Lab Assistant
Original Poster
#3 Old 4th Aug 2009 at 1:11 AM Last edited by Valencay : 4th Aug 2009 at 3:40 AM. Reason: typo
I'll give that a try today. I'm glad to hear that it is the GIMP plugin that is awful and not me. Thanks Tiger.

Boredom is counterrevolutionary.
Lab Assistant
#4 Old 4th Aug 2009 at 3:09 AM
I was apalled by the results of the gimp plugin as well. For all the options it had, none of them produced decent results.
Lab Assistant
Original Poster
#5 Old 4th Aug 2009 at 3:38 AM Last edited by Valencay : 4th Aug 2009 at 4:00 AM.
I actually downloaded the Compressonator yesterday but hadn't tried it yet. Just spent some time with it but the results I'm getting with these two aren't much different. I think the colour change is just too steep for DXT so I'm back to my image editing skills being the problem and am at a loss.

Boredom is counterrevolutionary.
Lab Assistant
#6 Old 4th Aug 2009 at 3:43 AM
Well the big block in the first picture is pretty much unavoidable with DXT. The way DXT compression works is that it picks two colors for every 4x4 block, then expresses every pixel in that block as one of those colors, or one of two shades between those colors. That works decently well when you have shades of the same color, or at most two different colors. But when you add in a third color, it has to make a compromise. In the big block in the middle, it has black, white and red. Due to the extreme contrast of the black and white, it needs a wide range, and because of the red, it has to throw a hint of red into the mix. The red has to go to one end, so it chose the white end since its a closer brightness.
Lab Assistant
Original Poster
#7 Old 4th Aug 2009 at 3:59 AM
Yeah. I've tried playing with the contrast and brightness in the greysacle areas and also darkening the yellow/red so perhaps I'll luck upon just the right combination. Nearly all my edits have resulted in the problem just being shifted from one area to another though.

Maybe the only solution is to pixel edit all the edges manually. Gee, that would be fun. Lol. Either that, or scrap the posters that have these dramatic colour changes altogether but I really don't want to. Blowup (the red poster) is one of my favourite movies of all time. And after banging my head against a brick wall for three days that would be pretty depressing. Grr.

Boredom is counterrevolutionary.
Scholar
#8 Old 4th Aug 2009 at 1:13 PM
I strongly suggest using nvDXT for compressing DXT files. They produce high quality results and have a lot of possible settings for quality, mipmap processing and so on.

It is command line program, though, so if you don't like that, you can use DDS Converter 2 which is essentially a GUI for it. The problem is, it doesn't have all options and you shouldn't use it to convert DDS images to png/tga, as the resulting images are too dark.
Lab Assistant
Original Poster
#9 Old 4th Aug 2009 at 2:23 PM
Thanks jonha. Downloading now. I didn't realise I could use the nvidia tools without having photoshop.

Boredom is counterrevolutionary.
Lab Assistant
#10 Old 5th Aug 2009 at 3:10 AM
@valencay Just loved your simlish Taxi Driver!

Well, here even photoshop is starting to get texture bleeding. I made several masks before and everything went right, but now this is starting to happen. And even on pretty simple and geometric designs, with no fancy color-blending. I tried everything, even editing manually each color channel, but still the same thing. DXT1, DXT3, DXT5, DXT-Pi, whatever.
I'll see if this DDS converter does the job.
Lab Assistant
#11 Old 5th Aug 2009 at 4:53 AM
I know it's a little silly and roundabout, but if you download my Neighborhood Workshop, it has DXT-1 compression built in. To use it you have to have a save with some still-life portraits painted, but you don't need to actually modify it. Just save your texture as a PNG file of the appropriate size (IE 256x256, 512x512, etc) and use Neighborhood Workshop to import it for a painting. Once it's imported you can see right away how well the compression did, as it displays the resulting DDS file. If you like the results, just export it and select to save as a DDS, and you'll get your texture ready to load up. That only works if it has no transparency at all though. From my limited testing, the compression it does is better than some of the plugins I've tried.
Lab Assistant
Original Poster
#12 Old 5th Aug 2009 at 6:16 AM
Thanks, Cheapncheerful.

And this might be insultingly stupid suggestion (sorry), but are these files you are RE-editing that you are having the problem with? Each new attempt I make, I start with a fresh copy of the original image and a fresh copy of the DDS, because if they go through the compression process repeatedly the degradation accrues until all you are left with is mud.

Tiger, it sounds like the still life textures have more pixel room than the regular paintings. None of the ones I've cloned have had dimensions larger than around 260 px which obviously means a big reduction in quality even before compression. I'll give this a go tonight as well and see if I can get the resulting texture back into a game in the buy section as a new package . I have a feeling it might be slightly trickier than it sounds. Especially if you want a colourable frame. Will report back tomorrow.

Boredom is counterrevolutionary.
Lab Assistant
#13 Old 5th Aug 2009 at 6:49 AM
Valencay, stock still life paintings are 256x256, but they are just DDS textures and the size doesn't matter. However, Neighborhood Workshop does not enforce that. It does cap the size at 512x512 at the moment, if you need more room than that and you're happy with the results, I could whip up a quick stand-alone conversion tool in a few minutes. If your picture is bigger than that and you just want to see how it does, crop the image down to 512x512 on the part you are interested in, making sure that the top left corner is on a multiple of 4 (So the DXT blocks are the same for an apples to apples comparison.)

Also, I was not suggesting using the still life paintings as a source of new objects - merely that Neighborhood Workshop was designed to work with those and the import image function is only available when looking at an existing still life portrait. Once you have it imported, you can export it again immediately as a DDS, and the result is a DDS file created based off your original image. The DDS can then be used for whatever you want, and can contain whatever you want, it is not limited to just paintings. For buyable objects you're better off using the object cloner on an existing painting and just copying the DDS file from my steps into that package.
Lab Assistant
Original Poster
#14 Old 5th Aug 2009 at 8:03 AM
I might be missing something but the DDS files for the clonable paintings are quite different from the still life ones (that I just looked at from Fullbuild02) and have the painting back & wire on the main surface as well so it isn't a simple switch. Like I said, I might be missing something, but I don't think I could use the resultant DDS without pasting it into the cloned one, regenerating mipmaps and recompressing. Which would defeat the purpose.


Boredom is counterrevolutionary.
Lab Assistant
#15 Old 5th Aug 2009 at 8:08 AM
I'm not suggesting doing anything with still life paintings. All I am saying is that to follow my steps you need to have one made so you can pretend to replace it. But the image you load can be anything, including a texture for a cloned build&buy mode painting. You're just using it to convert a PNG into a DDS, then save the DDS.
Lab Assistant
Original Poster
#16 Old 5th Aug 2009 at 8:32 AM
Ah. Sorry, Tiger, for being such a bother and doofus. I think I've fried some braincells. :/

I'll test it all tonight and post some comparison pics between the various ways of compressing.

Boredom is counterrevolutionary.
Lab Assistant
#17 Old 5th Aug 2009 at 9:13 AM
It's quite alright. What I was trying to explain was a bit of an odd use anyway, since you're using a tool for something it wasn't designed for.

But I decided it would be simpler just to pull the code out and make a tool that WAS designed for it. I think I spent less time writing this than I did explaining how to use the DDS compressor in NWS.

Anyway, SimpleDXTCompress.zip. Fairly basic interface. You load up a graphic (PNG, BMP, JPG or DDS) and it compresses it as DXT1 (No alpha) or DXT5 (Alpha). You can then switch between the original image and the compressed image to compare the result. It also does 3 way comparison by loading up a reference image (Same formats supported) then you can switch between all three. The image must be a valid texture size to start with, and if you load a DDS file up as the reference, it must be DXT1, DXT3 or DXT5 compressed. Also alpha does not show up in the DDS preview, but it will be saved if you have the alpha option selected. Changes to the dithered option are reflected immediately.

Requires .NET 2.0, should work just peachy under mono.

If you like the quality, you're welcome to use it. I haven't really compared it with much beyond the Gimp plugin, which it completely blows away. If you find something else is better, it won't hurt my feelings. I got the actual compression code off the 'net here, and haven't really done anything to it beyond porting it to C# and adding code to actually write the DDS data.
Pettifogging Legalist!
staff: moderator
#18 Old 26th Aug 2009 at 11:32 PM
Quote:
Originally Posted by TigerM
Requires .NET 2.0, should work just peachy under mono.

Well yes, for certain values of "work" =P -- it runs fine, but it has the same menu issue that I already bothered you with in other threads, only that here it plays much more of a role since in order to do something useful, you need to access the menu at least twice.

What happens for me is that I click on File > Open, the menu opens (it also loads a png when I choose to do so), but then I cannot use the File menu a second time. When I click on "File" again, it acts more or less like a button I mean I get a visual response, so it's apparently aware of the mouseover/mousedown .. but the menu does not open again.

The window itself is still responsive, so I can exit by closing it. I can also toggle the checkboxes and radio buttons across the bottom at all times.

OS X 10.5.7, mono-2.4.2.3, X11 2.0.

I get no error messages in Terminal. It's not hanging either.


This may be completely useless (particularly seeing as you're not an OS X person) but here's some info I got out of Activity Manager, while it was being unresponsive like that (a png was imported and the File menu inaccessible):


Stuff for TS2 TS3 TS4 | Please do not PM me with technical questions we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Lab Assistant
#19 Old 29th Sep 2010 at 4:45 AM
I noticed that menu error happened while mono was using Carbon. Have you tried it on X11?

Success is getting up one more time than you fall down.
Back to top