Hello There, Guest! Register



Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can make tiny 4k DDS files? This is too good to be true!
#1
Maybe I'm missing something here but I seem to have stumbled upon a way of making 4k resolution DDS files that are about 1/10 the size they would normally be, and higher quality too...?

I have a skin folder with two 4k DDS files, one for the body and one for my helmet, plus a few other small files, and the whole folder is 3.7 MB. Previously, a single 4k DDS file would be >10 MB, which is more than the total allowed for any skin folder on SRS. So basically those files were unusable here.

Here's how I did it;

1- Create my skin in 4k resolution.
2- Save as PNG file.
3- Rename .PNG to .DDS
4- Profit

The only difference in the file creation is that the PNG format doesn't pick up any Alpha information for transparencies. If you want transparency you need to add it to the image itself (which can be simpler in many cases).

Here are the file sizes I end up with:
   
*I couldn't make a 4k file by saving as DDS, because my Photoshop crashes when I try. But the way the file sizes scale it would be 4x a 2k file, or 10.6 MB

I also compared the quality of the image and in this test on the side of a Transit van, the PNG version (bottom half) actually looks better than the version I saved directly as a DDS (top half) which seems to have some kind of artifacts in the form of vertical striations.
   

So it kinda makes no sense. Am I missing something here?
Reply
#2
I've noticed this little cheat as well, and used it (apparently with some success?) on the MFTC3. I'm not sure what sort of consequences it might have for efficiency in AC — Does AC have to recover from an error every time it tries to load or render a picture that's lying about its format? — but hey, if it works, it works, I guess.
⌈ zerøbandwidth autosports ⌋
https://twitch.tv/zer0bandwidth
https://youtube.com/c/zerobandwidth
Reply
#3
Need to try this!
Shaun Clarke Racing (Previously TPCSimRacing) driver and painter.
https://www.facebook.com/PlankLiveries
Reply
#4
PNG does a fantastic job of compressing it would seem... so if you have very little detail and/or colors in the PNG, it's going to be tiny. I just tried to save my latest skin as a PNG at 4k and it was 20mb. I then took most of the detail out of it (logos, AO shading, etc.) and saved it and the PNG was 803kb. So it looks like your results may vary!
Tutorial on how to use Autodesk Mudbox and Adobe Photoshop to make custom liveries! https://tinyurl.com/yaetz4qz
Grab my PDash Skins (an Assetto Corsa HUD app) here: https://tinyurl.com/y95ewubz
Reply
#5
That explains what happened perfectly Russell, thanks.

Using my method, the DDS file size can be massive or tiny, depending on the level of detail in the skin. Whereas the normal way of creating a DDS means it will always be 10.6 MB for a 4k resolution, regardless of how detailed the skin is (or isn’t).

To me that means there’s an opportunity to exploit that attribute of PNG files to create 4k skins that are within the size limit of SRS. I used my most recent livery to test the limit of what could be done and came up with this skin, a fairly detailed one I think, with a somewhat random pattern and five different photo-quality images on it.

[Image: Preview.jpg]

The resulting DDS file ended up being 6.4 MB. In the process of making it I learned a few tricks to help shrink the size of these types of DDS files while retaining the 4k resolution, for those of you who might be interested in trying to make a 4k skin from a PNG format for yourselves.

The gist is to make the image as simple as possible, but where detail and complexity is required there are a few tricks that can be used to keep that complexity to a minimum.

- First off, it’s best to try and use images that are as crisp as possible. That means something directly off vector graphics like EPS or SVG images. I don’t think most photo editing software will read those file types though, so they’d need to be converted to a lossless format like PNG so they can be loaded into the software to make the skin.

- Avoid any JPG source files as they are typically very noisy, requiring the algorithm that processes them into your final PNG skin file to work overtime and balloon in size.

- If you have to use a source image that's only available in JPG or other lossy format, try to clean up the noise as much as possible then upload it to <link> https://vectorizer.com </link> where the site will process the image into a vector format which can then be converted into a PNG for a much cleaner image. For photographic quality images this could make them look kinda bad though, so it’s not a cure-all. But it does work great for clipart style images. Oh, and it’s free! I used it to make my ‘blood stain’ overlay, which originally was a very noisy JPG.

- Another tip is to leave as much as possible of the empty space on a skin template all one solid colour. So clip your graphics as tightly as possible around the wireframe so only the detail needed on the skin is actually contained in the file.

- Maybe the biggest single contributor to file size is the AO layer, which essentially adds complexity to every visible part of the skin by adding shading everywhere. I chose to leave the AO layer off for my skin, but if I left it on it would have been around a 9MB file size. Up to you whether you want it or not. But it can make skins look kind of artificial when it’s missing, especially on light coloured bodywork like my car. Darker colours aren’t affected by AO as much.

- Another option to reduce file size is to add transparency to the image, which is basically space that PNGs ignore. It’s almost like making the image size smaller. Big caveat though: transparencies in PNG don’t always convert into DDS as they should when the filename extension is changed. I’m not sure of all the reasons for that but I struggled with transparency on this skin, even though it seemed to work great on the Indycar skin I tried it on first. Maybe I just got lucky that time.

- Remember also, text and shapes created from scratch in photo editing software are essentially as good as a vector image, so if you have the option to make a text or shape instead of using an image, do that. Of course finding the exact matching font can be impossible, but still...

I think that’s all the tips I have for those of you who want to explore making 4k skins for SRS. Have fun and let us know here if you learn anything more about the technique.
Reply
#6
Beware: using PNGs instead of DDSs may cause performance issues. DDS is a format that is optimized for graphic cards. I'm not sure if this would only impact the loading times or the rendering performance, though.
Reply
#7
Apparently, the GIMP .dds export quality is pretty poor. I tried removing some of the compression artifacts with your excellent .png to .dds trick and I am quite pleased with the result. Here is the before/after:

[Image: 1OL0bGzl.jpg] [Image: Xmh3iIZl.jpg]
Reply
#8
(10-28-2021, 07:34 AM)Simone Saviolo Wrote:  Beware: using PNGs instead of DDSs may cause performance issues. DDS is a format that is optimized for graphic cards. I'm not sure if this would only impact the loading times or the rendering performance, though.
So I tried a little test recently to see what performance impact this trick would have on races.

I used the largest, most detailed livery I've ever made, and ran an AI race with 28 cars using their own different copy of the same livery, on a track (Grobnik) where I had experienced performance problems before.

[Image: BzlTVlX.jpg]

Each skin folder consisted of 13 DDS files, every one of which was simply a renamed PNG file, and three of which had dimensions of 4K (body, map, and helmet). The total folder size for each car was 7 MB, which would have been 40 MB ~ish if I had rendered them as DDS like normal.

I did notice a slowdown, but only on loading. The cars took 4-5 times longer to load than normal, so about 2 minutes on my system to load all the cars and track.

Once in the session I had no issues of any kind, FPS, CPU load, temps, or any kind of hiccup.

So I figure there shouldn't be any issue for anyone else either since in AC we all have to load the skin files when we join, as opposed to when the player using that skin joins, so it wouldn't make any difference if someone joined in the middle of the session since we should all have every skin already loaded.
Reply
#9
Yeah after thinking about this some more, the issue with "faking" the DDS files is that you won't have mipmaps (smaller versions of the file for use at long distances) in PNGs. Because of that, AC has to dynamically generate mipmaps for each texture at load time. That's why loading takes a bit longer, but overall efficiency once the session begins remains OK.
⌈ zerøbandwidth autosports ⌋
https://twitch.tv/zer0bandwidth
https://youtube.com/c/zerobandwidth
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)