I’ve refactored an old script that I made for a uni project, making it more user friendly and generic. Take a look at the video!
As I mentioned in my last post, I’m interested in how BCn compression would have affected Presence, the game I made for my honours project at uni. (If you’re interested in experimental games you might want to check it out – download it here:http://amesyflo.itch.io/presence)
One of the things I’m kicking myself about over this game is the use of 16-Bit alpha for grass billboards. I had a framerate issue with transparency drawcalls, so ended up making the grass shader unlit to counterbalance this. I think that using 1-bit alpha would have given me the same results, but with better visuals.
Converting to BC1 from 16-bit png produced a very similar image, and halved the memory size of the file. My only complaint is that there is a little grey outline around the opaque section.
I also had a go at compressing hand painted textures, compressing this tree texture using BC1. I thought that I may have issues and have to move up to BC7, but I was happy with this result. Admittedly, if I was to do a real optimization pass on this game, the first thing I’d do with this texture is sort out the use of space on the UV map, but this is just an experiment.
I was going to import these textures into UE4, to check how I could reduce shader compilation times and memory. However, UE4 only accepts .dds files in a very particular format, designed for cubemaps, as compression is done in editor.
Default UE4 compression is very clever, in that it switches between DXT5 and BC5 depending on whether DX11 is being used. So basically, I was already using these types of files without knowing it!
I was going to give my 1-bit grass a go, but I haven’t found a way to compress to 1-bit BC1 in UE4. From the googling I’ve been doing on this subject, it looks like 1-bit alpha is unsupported in the engine.*
This is disappointing, as I thought I could further optimize GPU performance and GPU/disk memory for this wee game. Back to the drawing board I guess…
*I’ve posted on the forums and facebook/twitter about this, so if any new info comes up I’ll do another blog post about it!
Something I’ve been having a look at recently is the intel texture works plugin for photoshop. Texture compression is something new for me, but incredibly important for bringing games into memory budget and reducing shader compilation times.
Grab it here: http://gametechdev.github.io/ITW-Beta-Test/.
This plugin uses BCn compression, which has been used for a while but is new to me. It adds two new types of compression: BC6, used primarily for HDR textures, and BC7, a high quality RGBA compression format.
There’s a great explanation on BCn compression by Nathan Reed here: http://www.reedbeta.com/blog/2012/02/12/understanding-bcn-texture-compression-formats/. If you can’t be bothered to read that, the tldr; is that the types up to 5 sample a texture in 4×4 blocks, each in the same way, and 6 and 7 sample each block in the way that is most effective for that set of pixels.
BC1 is RGB + 1bit Alpha, BC4 is single channel greyscale, BC3 is RGBA (essentially BC1 + BC4) and BC5 is a two channel compression format that is often used for tangent space normals (its basically 4 BC4s). BC6 is designed for HDR and BC7 is a higher quality version of BC3, using the method described above.
I had a quick go earlier with some images grabbed from http://www.textures.com/ and they were very promising! I think these look great, and can barley tell the difference. The sharpness of the images isn’t spot on, but you’d really need to be looking for differences to notice it, in my opinion. These are both compressed from jpeg to dds using the BC1 format, and memory cost has been reduced by at least 60% in both cases. (The images have then been made into jpegs for the blog, and further compressed by web, but we can still see the comparison.)
I’d like to see what this does to hand painted textures, so I’m going to run some of the textures from Presence (my honours project for university) though the tool and see what savings I could have made had a been a little more technical at the time!