Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: ChronoReverse on March 26, 2004, 01:14:04 pm

Title: DXT5 Compression with nVidia Photoshop plugin. Can you tell the difference?
Post by: ChronoReverse on March 26, 2004, 01:14:04 pm
Check out these two images.  Can you tell which is the .tga and which is the .dds file?  Both were converted to PNG in photoshop.


(http://www.filespace.org/ChronoReverse/planeta1-A.png)

(http://www.filespace.org/ChronoReverse/planeta1-0.png)


The .tga is about 4.2MB while the .dds is about 1.4MB

I'm thinking about converting every .tga in my effects folder into a .dds

Fs2_open is able to load a .dds in every situation it can load a .tga right?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 01:50:01 pm
which settings do you use?

All images I convert with it come out horrible.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 02:21:03 pm
DXT5     ARGB     (Interpolated Alpha)
2D Texture
Generate MIP maps

The rest on default.

Using version 6.52 of the plugin.

I've went ahead and decompressed the media vp, converted every .tga to .dds

The game still seems to run fine and I can still see things.  Will be testing more.




BTW, is it possible to convert all those .pcx files into .dds as well?


P.S.  All you people making effects, use widths and heights at 2^n values!!!!  (so many .tga's at a resolution like 128x514.... 514!!!)





[edit]  
If I replace all the .pcx files with a .dds, would FS2_open be able to handle that?


P.S.  Incidentally, Lightspeed's hi-res planets actually look better in-game with DDS since the mip-maps reduces the "flicker" effect seen in areas of the planets with high detail (look at the planet in the first mission to see what I mean).
[/edit]
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 03:02:22 pm
they look worse. Tons worse. And the game will NOT use the DDS mipmaps at all.

Could you send me a zip with yours in DDS format to look at?

If it's better than what I could convert, i'll update the DDS zip of my planets.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 03:21:50 pm
Check your pm box
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: J3Vr6 on March 26, 2004, 04:01:54 pm
Sweet... you think you'll put this all up somewhere so people can do use them instead of the big files, Chrono?  Probably would shrink the amount of video memory used in-mission, right?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 04:04:26 pm
uhhh....i'll post something in a second about this...
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: RandomTiger on March 26, 2004, 04:08:12 pm
Lightspeed, did you ever try that app I gave you?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 04:11:29 pm
Either

a) you posted wrong images
or
b) DDS work different on our systems.

I opened the exact file you sent me.

Here's the comparison

TGA
(http://smalltimerivalry.com/sschost/scriptlightspeed/tga.jpg)
No artifacts or edges whatsoever, looks exactly like the images you posted.

DDS
(http://smalltimerivalry.com/sschost/scriptlightspeed/dds.jpg)
Look at the vertical "lines", the odd boxes in the glow, and the ugly colour cutting edge at the shadow (where it fades to 0,0,0, for exampe at the 'south pole'). It looks ugly (the other planets are even worse!)
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 04:12:42 pm
Quote
Originally posted by RandomTiger
Lightspeed, did you ever try that app I gave you?


Yes I did. It looks slightly better, but still bad.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 04:19:06 pm
I see what you mean there LS, it's almost like the image was being dropped in colour-count.

Were you using the exact same settings as Chrono?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 04:27:47 pm
I've definitely opened both files (the dds AND the tga) in Photoshop CS at the same time.

Then I used Save as for web to convert to PNGs.

In any case, they can't be the same file since the PNG file sizes are different.

Very strange, I wonder why this is happening.  I'll have to take a look again when I get home.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 04:30:02 pm
@ flipside: not only that, i was using THE SAME FILE he was using.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 04:30:36 pm
Which is why it's really weird :(

I saw the horrible artifacts when using DXT1 and DXT3, but when I noticed that DXT5 seems to be pretty good, I converted.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 04:32:39 pm
Then the only difference is that you posted JPG and Chrono posted PNG's. But you had obviously seen the error before you posted, so I don't think it's that :(

Edit : Besides, both your pictures are JPG's so if that were the case, they would both be showing those errors.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 04:42:44 pm
I used maximum JPG quality (thus the big JPG files) for the DDS one.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 04:48:22 pm
That isn't the problem.  I saved to PNG for lossless, but even with JPG at quality 60 it shouldn't be _that_ bad.


I'm rather confused now though as to why they look so weird.

@Lightspeed

Do this artifacts show in-game as well?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 04:53:06 pm
Of course.

As I have boosted the brightness slightly in-game (with the slider in the options screen) it's even worse (a lot) than it shows here.

When I saw planetD (as DDS) in-game I really felt I was going to vomit :rolleyes:
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 04:56:45 pm
Well, I use the NVidia plugin as well, if you want, you can Email the file to me and I'll run it through mine on those settings and see what happens on a third computer?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: SA22C on March 26, 2004, 05:11:36 pm
I think you're too picky Lightspeed.  The second image you posted doesn't look bad at all, at least here in the forum.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 05:13:26 pm
Flipside, I think you still are not aware of the actual problem.

Chrono has the SAME file that I have. HE put it through the convertor and sent me the file.

All i did was saving it to JPG for posting it up here.

Here's the DDS file, just open it and save it as a JPG (good quality) - Then post it up here:


DDS file (http://www.penguinbomb.com/lightspeed/SCPTest/planeta1.dds)
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 05:27:05 pm
Ok :-

(http://www.aqsx85.dsl.pipex.com/planeta1.jpg)

I get artifacts.... Though the DDS looked like it had them from the moment I opened it, even before the conversion.

Ok, this has got me hellishly confused.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 05:27:40 pm
Quote
Originally posted by SA22C
I think you're too picky Lightspeed.  The second image you posted doesn't look bad at all, at least here in the forum.


You, sir, have a broken monitor :p

Check the following Chart I put together:

(http://www.penguinbomb.com/lightspeed/SCPTest/monitortest.png)

The upper grey gradient shows qualityless fading, the second one was put through the DDS conversion. Now, am I picky or does it look horrible?

Check the lower part of the graphic.

You should see four rectangles on the black background (left one pretty faint, but still visible) and a box seperated in two parts with slightly different brightness.

If you cannot see four boxes, your monitor should be adjusted.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 05:27:46 pm
So it artifacts for you too, meh.  I wonder why it looked so nice.

Opening the file from school also shows the same artifacts.  Makes no sense, grrrrr.


[edit]  I'm going to try to use the SDK's compressor to see how well that works.  However, I need the alpha in a separate bitmap.  Is it possible to separate the alpha channel in the tgas and how is that done? [/edit]
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 05:28:44 pm
Phew, good to know Flipside's looks exactly the same as the one I posted.

Are you *sure* you used the right file for your comparison, Chrono?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 05:34:41 pm
I don't see how compressing the same file twice using lossless compression would yield two files of different sizes.  That was how I kept track of the files in fact.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 05:36:03 pm
(http://www.aqsx85.dsl.pipex.com/200percent.jpg)

For those final unbelievers ;)

That's zoomed up at 200%, it's not even gradient problems, because the lines don't seem to follow the curve of the planet, it's like a compression error.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 05:49:32 pm
show the 'south pole' where you have ugly ugly colour edges.

Alternatively, look at my monitor test chart.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 06:10:49 pm
(http://www.aqsx85.dsl.pipex.com/200percentb.jpg)

This is the original DDS file zoomed at 200 percent, the problems are there when I open it.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 06:14:26 pm
Bah, I was hoping to have this work too.


/me still thinks that preloading all the textures in the beginning on a temporary object will help the stutters.

/me also thinks that the people making maps and effects should remember to use 2^n lengths and widths.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 06:17:42 pm
/me Agrees with you on both counts there :) Though I think the first one is being/has been implemented.

The simple fact that your settings work shows it MUST be possible somehow, theres a missing link here somewhere.....
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 26, 2004, 06:30:06 pm
I'm actually beginning to think that Photoshop CS just played a weird trick on me.

I'm 100% sure I had both files opened and saved separately.  They were opened at the same time, I tiled the windows.  Logically that should be true as well since the pngs aren't the same size.  Yet somehow, as I open the dds file here at school, it show the artifacts.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 06:31:22 pm
You use CS?

I use Photoshop 7.0, I wonder what Lightspeed uses?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 07:30:17 pm
Photoshop 6.0 :)
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 07:51:45 pm
Hmmmmmmmmmmmm.......I wonder if we are looking at some not-quite downwards compatability here?
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 26, 2004, 07:55:45 pm
Definately not.

Freespace 2 open displays the artifacts too, and i'm sure as hell it doesnt care which version of Adobe PS I have installed on my computer.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 26, 2004, 08:09:04 pm
(http://www.aqsx85.dsl.pipex.com/Yuck.jpg)
(http://www.aqsx85.dsl.pipex.com/Yuck2.jpg)

The first one is a straight JPG of planet Yuck
The second one was saved as DDS and then reloaded and saved as a JPG.

Here is the DDS, do you get artifacts on it?

http://www.aqsx85.dsl.pipex.com/Yuck.dds
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: RandomTiger on March 27, 2004, 07:38:20 am
Quote
Originally posted by ChronoReverse

Generate MIP maps
[/edit]


Theres no point in generating mipmaps for background images like planets.

Technically any mipmap you save isnt actually used for even 3D object textures. Though that may change.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 27, 2004, 08:57:31 am
Quote
Originally posted by Flipside

Here is the DDS, do you get artifacts on it?
 


it looks exactly the same as the one you posted, i.e. ugly colour edges on the shadow side of the planet, along with some other artifacts (just look at the point where the atmosphere glow ends - YUCK)
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flaser on March 27, 2004, 10:52:55 am
I'm no expert in the field of image manipulation, but I have some experience with video encoding.

The thing you see is very similar to some post-processing errors I saw on DivX videos.

I now the two things are of an entierly different realm, but what if he has some post-processing filter that "smoothes" the picture.

If it's applied all the time he won't notice the blocky artifacts.

That's my 2 cents - though I could be entierly wrong.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 27, 2004, 10:58:54 am
It could be possible to deblock the text before using it in-game, however, this would defeat the purpose of using DDS (you can leave it in compressed form) since you'd have to decompress it and leave it decompressed in memory for it to be deblocked.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 27, 2004, 11:28:27 am
Well, to be honest, I think DDS is not designed for smooth gradients, but the fact of the matter is that TGA is far far too big to download an entire campaign using them. JPG's are workable, but will still eat texture memory. I think anything that doesn't rely too heavily on texture gradients can be done as DDS, however Space effects etc might need to be in a different format.

Theres actually that same 'layering' effect on the original image as well, it might even be part of Lunarcells filling algorythm for all I know, but I think it's easily possible to get so obsessed with getting 'perfect' image quality that we forget that this is a game which needs to be optimised :)
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 27, 2004, 12:16:59 pm
Yeah, I've noticed that the .ddx compression was amplifying the pre-existing gradients too.


DXT5 is the best compression for stuff with gradients, but it still doesn't handle it very well =(
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 27, 2004, 01:56:26 pm
face it, DDS sucks for anything that has any gradients in it.

And  campaigns are normally zipped (or archived in some other form) anyway, so TGA ain't that bad size-wise.

DDS *might* be useful for some model textures, but anything else will just look crappy.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 27, 2004, 02:00:47 pm
It's not the download size that's the only consideration, it's also about space taken up in texture memory, my card has 256Mb, so I'm not personally all that bothered, but people with lower spec cards will probably start to notice stuttering.
I agree with you completely on the gradient thing though, it appears that DDS was designed for such things as Textures, not Effects, in mind. Also, I have a sneaky feeling that DDS is optimised for textures of 512 x 512.

One day, I'll have to take a close look at some of the UT2K3 special effects and see if they suffer from the same problem :)
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 27, 2004, 02:17:57 pm
From reading a lot, it does seem that .dds isn't that great for really large textures (although still not bad).  As long as there aren't any alpha gradients it's not too bad.


It'll work best if there aren't any really large and smooth gradients; something that most FS2 retail textures qualify for, I believe.


So if I take the pcx textures and replace them with dds versions, would it work?  Additionally, where are UV maps referenced from?  The top-left corner (I may have to change the canvas size for some textures that annoying aren't a 2^n edge size).

Do textures have transparencies?  It's green right?  If I make that into a 1 bit alpha channel would it work in dds for DXT1a (does alpha for dds textures work?).
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 27, 2004, 02:28:01 pm
As far as I know, DDS transparency IS supported, you'd have to convert the green to Alpha, as you said.

It's simply a matter of replacing the PCX files with DDS, UV's are stored in the model file, though you won't get any direct image improvement obviously, but at least they would take up less space in memory.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 27, 2004, 02:32:07 pm
What I mean is that I may have to change the sizes of some textures since they're like 514x128.

If I don't keep the image relative to the reference point the same, it could mess up the mapping.  So I was wondering if they're referenced from a point (like the top-left corner).
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 27, 2004, 02:38:38 pm
It should be fine, the UV will fit into whatever image you use, regardless of it's size. So changing the image you mentioned to 512 x 128 will not have an effect on the mapping in any way.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 27, 2004, 03:15:34 pm
Hmm, so I could simply resize the textures instead of changing the canvas size, okey dokey, I'll try that as soon as I get home.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Lightspeed on March 27, 2004, 07:02:02 pm
Quote
Originally posted by Flipside
It's not the download size that's the only consideration, it's also about space taken up in texture memory, my card has 256Mb, so I'm not personally all that bothered, but people with lower spec cards will probably start to notice stuttering.


The ironic thing is, the lower end cards do NOT support storing compressed textures, so it's a moot point.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 27, 2004, 08:28:24 pm
Well, it depends how low end.  Anything that supports HTL supports some form of DXTC as far as I've seen (any Geforce class or Radeon class card).
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Liberator on March 28, 2004, 01:19:50 am
I got a GF4MX and AFAIK it support all form of DXT compression, anything manufactured after 2002 should too, regardless of class.  Except maybe a Radeon 7000 or Mobility.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: ChronoReverse on March 28, 2004, 01:21:30 am
Even the Radeon 7000 supports DXTC.  I checked.  Anything that's a geforce or radeon supports DXTC.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: RandomTiger on March 28, 2004, 04:54:52 am
The only card I know that doesnt is TNT2
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Liberator on March 28, 2004, 02:09:33 pm
Why support a 5 year old card?  Before you say it, I know it's still widely used, but if we're going to do this we need to set some boundaries.

Here's the boundaries:
Pentium 3/4 800mhz+ or Athlon whatever
256 MB of RAM minimum
Geforce 1/Radeon 7000 or above.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: kasperl on March 28, 2004, 02:11:20 pm
Quote
Originally posted by Liberator
Why support a 5 year old card?  Before you say it, I know it's still widely used, but if we're going to do this we need to set some boundaries.

Here's the boundaries:
Pentium 3/4 800mhz+ or Athlon whatever
256 MB of RAM minimum
Geforce 1/Radeon 7000 or above.



256? do you have any idea how few people have that? 800mhz ain't no minimum. i can run FSO fine with p3 800, R7k and 192MB of ram. with spec and glow on.
Title: DXT5 Compression using the nVidia Photoshop plugin
Post by: Flipside on March 28, 2004, 02:12:50 pm
Actually the boundaries were set at :-

Minimum P600 processor, recommend 1Ghz+
Minimum : 128 MBytes of Ram, Recommend at least 512MBytes
Minimum : HT&L Graphics card with 32 Meg, Recommend 64+Meg
Directsound compatible soundcard, recommend EAX.
56k Internet connection, recommend Broadband or better.

Though these may change with time. Besides, DDS will work on old cards, even if it is uncompressed when it is stored IIRC :)

After all, we're not trying to set boundaries, were trying to break 'em ;)