- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- DXT Compression: Tips for Minimising Bleeding?
- > Discussion on file formats, research and other modding information pertaining to the Sims 3.
Replies: 18 (Who?), Viewed: 6692 times.
#1
3rd Aug 2009 at 2:32 PM
Last edited by Valencay : 3rd Aug 2009 at 2:51 PM.

Posts: 62
Thanks: 408 in 1 Posts

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
#2
3rd Aug 2009 at 3:43 PM

Posts: 163
Thanks: 3588 in 26 Posts
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.
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.
#3
4th Aug 2009 at 12:11 AM
Last edited by Valencay : 4th Aug 2009 at 2:40 AM.
Reason: typo

Posts: 62
Thanks: 408 in 1 Posts
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.

Boredom is counterrevolutionary.
#4
4th Aug 2009 at 2:09 AM

Posts: 163
Thanks: 3588 in 26 Posts
I was apalled by the results of the gimp plugin as well. For all the options it had, none of them produced decent results.
#5
4th Aug 2009 at 2:38 AM
Last edited by Valencay : 4th Aug 2009 at 3:00 AM.

Posts: 62
Thanks: 408 in 1 Posts
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.
Boredom is counterrevolutionary.
#6
4th Aug 2009 at 2:43 AM

Posts: 163
Thanks: 3588 in 26 Posts
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.
#7
4th Aug 2009 at 2:59 AM

Posts: 62
Thanks: 408 in 1 Posts
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.
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.
#8
4th Aug 2009 at 12:13 PM

Posts: 1,115
Thanks: 36777 in 222 Posts
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.
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.
#9
4th Aug 2009 at 1:23 PM

Posts: 62
Thanks: 408 in 1 Posts
Thanks jonha. Downloading now. I didn't realise I could use the nvidia tools without having photoshop.
Boredom is counterrevolutionary.
Boredom is counterrevolutionary.
#10
5th Aug 2009 at 2:10 AM

Posts: 77
Thanks: 8631 in 11 Posts
@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.
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.
#11
5th Aug 2009 at 3:53 AM

Posts: 163
Thanks: 3588 in 26 Posts
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.
#12
5th Aug 2009 at 5:16 AM

Posts: 62
Thanks: 408 in 1 Posts
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.

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.
#13
5th Aug 2009 at 5:49 AM

Posts: 163
Thanks: 3588 in 26 Posts
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.
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.
#14
5th Aug 2009 at 7:03 AM

Posts: 62
Thanks: 408 in 1 Posts
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.

Boredom is counterrevolutionary.
#15
5th Aug 2009 at 7:08 AM

Posts: 163
Thanks: 3588 in 26 Posts
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.
#16
5th Aug 2009 at 7:32 AM

Posts: 62
Thanks: 408 in 1 Posts
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.
I'll test it all tonight and post some comparison pics between the various ways of compressing.
Boredom is counterrevolutionary.
#17
5th Aug 2009 at 8:13 AM

Posts: 163
Thanks: 3588 in 26 Posts
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.
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.

#18
26th Aug 2009 at 10:32 PM

Posts: 11,010
Thanks: 418453 in 1110 Posts
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):
Parent Process: bash (27291)
Process Group: mono (41818)
% CPU: 1.16
User: User (501)
Recent hangs: 0
Open Files and Ports:
/Users/User
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/bin/mono
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libgthread-2.0.0.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libglib-2.0.0.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libintl.8.0.2.dylib
/Users/User/Desktop/in/untitled folder 4/SimpleDXTCompress.exe
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/2.0/mscorlib.dll
/Users/User/.wapi/shared_data-SPUTNIK02.local-Darwin-i386-312-12-0
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
/usr/X11/lib/libXau.6.dylib
/Users/User/.wapi/shared_fileshare-SPUTNIK02.local-Darwin-i386-28-12-0
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/Mono.Posix/2.0.0.0__0738eb9f132ed756/Mono.Posix.dll
/usr/X11/lib/libX11.6.dylib
/usr/X11/lib/libXdmcp.6.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libgdiplus.0.0.0.dylib
/usr/X11/lib/libXrender.1.dylib
/usr/X11/lib/libSM.6.dylib
/usr/X11/lib/libICE.6.dylib
/usr/X11/lib/libfontconfig.1.3.0.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libexpat.1.5.2.dylib
/usr/X11/lib/libfreetype.6.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libtiff.3.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libjpeg.62.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libgif.4.1.6.dylib
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libpng12.0.dylib
/usr/lib/libexpat.1.5.0.dylib
/usr/X11/var/cache/fontconfig/b0a71e6bf6a8a1a908413a823d76e21f-ppc64.cache-2
/usr/X11/var/cache/fontconfig/84c0f976e30e948e99073af70f4ae876-ppc64.cache-2
/Users/User/.fontconfig/b226c953198e3d183dc553ca14a37113-ppc64.cache-2
/usr/X11/var/cache/fontconfig/480b001d1ab99a92ee52aee96868b317-ppc64.cache-2
/usr/X11/var/cache/fontconfig/c29b45c0b175bd96c37f111e1cf4898f-ppc64.cache-2
/usr/X11/var/cache/fontconfig/d67f60e970c6378deca460e2d4a106e9-ppc64.cache-2
/usr/X11/var/cache/fontconfig/ddbd7b13a6107d9809ee2e9bda1eeb71-ppc64.cache-2
/usr/X11/var/cache/fontconfig/dff97e17f0a16753982c22213791434a-ppc64.cache-2
/usr/X11/var/cache/fontconfig/fde37821cbdb1159b4eac7aa64d92051-ppc64.cache-2
/usr/X11/var/cache/fontconfig/0f0db7876307790c19e1f91eb9095080-ppc64.cache-2
/usr/X11/var/cache/fontconfig/1487dd4aecf3164c4a11193169052443-ppc64.cache-2
/usr/X11/var/cache/fontconfig/a1a78d9c18cd095d3829c724810e6ffb-ppc64.cache-2
/usr/X11/var/cache/fontconfig/bc06c1eea3e636f72101cafc3fb39508-ppc64.cache-2
/usr/X11/var/cache/fontconfig/ba022efc551c75e21c690774bbcf5304-ppc64.cache-2
/usr/X11/var/cache/fontconfig/79652363633577d7d713baab7f54ad8c-ppc64.cache-2
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
/Library/Fonts/Microsoft Sans Serif.ttf
/Library/Fonts/Tahoma.ttf
/Library/Frameworks/Mono.framework/Versions/2.4.2.3/lib/libMonoPosixHelper.dylib
/usr/lib/dyld
/private/var/db/dyld/dyld_shared_cache_i386
/dev/ttys005
/dev/ttys005
/dev/ttys005
->0x7dcf198
localhost:54453
localhost:54454->localhost:54453
localhost:54453->localhost:54454
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
/dev/urandom
Sample:
Sampling process 41818 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling mono (pid 41818) every 1 millisecond
Code:
Call graph: 2027 Thread_2507 2027 start 2027 _start 2027 mono_main 2027 mono_runtime_run_main 2027 mono_runtime_exec_main 2027 0xd731fa 2027 0xd732c7 2027 0x2d93474 2027 0x2d93783 2027 0x2d942b6 2027 0x2d9eb4a 2021 0x2dcf333 2012 0x2dd243a 2011 0x2db50d6 2007 poll$NOCANCEL$UNIX2003 2007 poll$NOCANCEL$UNIX2003 4 0x2db5c87 4 0x2db5c87 1 0x2db50e3 1 0x2db50e3 4 0x2dd24f7 4 0x2dd3d98 4 XPending 4 _XEventsQueued 3 _XEventsQueued 1 ioctl 1 ioctl 2 0x2dd22f9 2 0x2dd3d98 2 XPending 2 _XEventsQueued 2 ioctl 2 ioctl 1 0x2dd2320 1 0xd75329 1 mono_get_lmf_addr 1 mono_get_lmf_addr 1 0x2dd23a2 1 0x2db0db2 1 0xd76570 1 0xd76570 1 0x2dd2567 1 0x2dd3ddd 1 0xd76611 1 0xd76611 5 0x2dcf44f 5 0x2dcf44f 1 0x2dcf18c 1 0x2dcf18c 2027 Thread_2603 2027 thread_start 2027 _pthread_start 2027 GC_start_routine 2027 mach_exception_thread 2027 mach_msg 2027 mach_msg_trap 2027 mach_msg_trap 2027 Thread_2703 2027 thread_start 2027 _pthread_start 2027 collection_thread 2027 nanosleep 2027 mach_wait_until 2027 mach_wait_until 2027 Thread_2803 2027 thread_start 2027 _pthread_start 2027 GC_start_routine 2027 thread_start_routine 2027 start_wrapper 2027 finalizer_thread 2027 WaitForSingleObjectEx 2027 _wapi_handle_wait_signal_handle 2027 _wapi_handle_timedwait_signal_handle 2027 pthread_cond_wait 2027 _pthread_cond_wait 2027 semaphore_wait_signal_trap 2027 semaphore_wait_signal_trap
Total number in stack (recursive counted multiple, when >=5):
Sort by top of stack, same collapsed (when >= 5):
mach_msg_trap 2027
mach_wait_until 2027
semaphore_wait_signal_trap 2027
poll$NOCANCEL$UNIX2003 2007
0x2dcf44f 5
Sample analysis of process 41818 written to file /dev/stdout
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.
#19
29th Sep 2010 at 3:45 AM

Posts: 84
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.
Success is getting up one more time than you fall down.
Who Posted
|