Latest News from 100TB

Get it from the source

Image Compression Strategies For Game Developers

Published Apr 04, 2018 by Sarah Chambers

 

dev-image1

Video games are becoming so hyper realistic, it’s often difficult to know the difference between film and artwork. But all that hyperrealism takes a ton of textures and graphics. And these pixel perfect games can be heavy on the resources.

That’s why game developers need to have an image compression strategy. So that they can keep the beautiful realistic images - but not make their players wait a week for the download.

Image compression is all about balancing quality with performance. If we had unlimited bandwidth, every game would be made up of enormous image files and tons of detailed textures. Unfortunately, how quickly a game loads - and how little lag occurs - is a big component of a playable game. No one will play a game that takes forever to load, even if the images are insanely lifelike.

Game developers, or video streaming services, need to determine the best compression strategy for their audience and media. In this post, we cover common measurements of image compression quality and performance - and the tools developers can use to optimize their own media.

 

Image compression quality

The first thing to understand about image compression is the resulting quality of the end file. Not all quality degradation is the same.

Full reference image quality tests compare the resulting image to a reference image (the original) which is assumed to be “perfect” quality. There are four ways to test image compression quality using full reference: PSNR, SSIM, VIF and human perception.

PSNR, or peak signal to noise ratio, calculates at how much error has been introduced through the compression. The higher the PSNR, the better the quality of the image. For example, in the images below, the top two have a PSNR of 34, and the bottom two have a PSNR of 31.

dev-image2

SSIM, or structural similarity index, looks at the perceived change in quality after compression. It takes into account more quality indicators than just errors (like PSNR) and more closely mimics a human’s perception of quality.

VIF, or visual information fidelity, is based on human perception of images. It takes the qualities that humans notice when they look at an image, and determines quality from that. Netflix uses VIF as a primary measurement in their own image quality metric, VMAF. They combine it with a few other measurements including a motion metric that measures temporal difference from one frame to the next. Most other image quality measurements look only at still images, which is why Netflix has developed their own.

Finally, no mathematical algorithm replaces actual human perception. If your human gamers think something looks “off” or of lower quality, that’s more important than a perfect PSNR score. Test new compression workflows with human audiences to make sure quality holds up in reality.

 dev-image5

Compressibility or Performance

Compression is measured very simply by comparing the original size of the file with the output after compression. This is called the Data Compression Ratio.

null

 

Compression ratios vary by tool and by type of file. Each type of data compresses differently.

If you use the wrong compression tool, you could actually be making your performance worse. For example, gzip compressed files contain a large header. If you’re compressing an already small file, the “compressed” version could be bigger than the original!

Maximum Compression is an interesting ranking of compression algorithms run on different sample data. Ranking compression ratios of common programs against different file types shows that there’s no “best” program - it’s all about finding the best fit for you.

dev-image3

The most important thing is to test the compression algorithm with your own data for the compression ratio and the resulting quality.

 dev-image6

Tools for Image Optimization Workflows

Basis

Created by Binomial, Basis is a multiplatform image compression tool that stays compressed on GPUs. This is super important because most compression pipelines are forced to use JPEG - which requires runtime resources to decompress and encode to a GPU format. Basis can be incorporated into existing multi-platform workflows which makes it very powerful.

They have some big customers, including Netflix, who use Basis for streaming delivery across a variety of platforms.

Even if you’re not looking for an image compression tool, I recommend following the founder of Binomial, Stephanie Hurlbert on Twitter. She shares a lot of information about how they’ve built their business, and helps junior developers find opportunities, share their work and get paired with mentors.

Granite

Created by Graphene, Granite SDK is a texture streaming and texture compression technology that enables video game and virtual reality developers to use large texture maps in their design. Granite contains a proprietary compression algorithm that “compresses textures by 60% or more compared to a block-based format like DXT1, BC5 or BC7.”

As larger, more open worlds occur in virtual reality, more textures and higher quality is needed. Granite wants to remove the technical limitations of texture rich environments to give designers more freedom to play.

PNGQuant

An open-source lossy image compressor for web images, PNGQuant provides immediate, drastic compression savings, with minimal quality impact. Gamebuilder Studio compared the following two images after compression with PNG.

dev-image4

The one on the right has been reduced 83% - and you can’t see any reduction in quality. PNGQuant can be used from your command line, which makes it a really nice tool for any developers tool belt.

 

Choosing the best tool for you

Compression strategy is unique to your program, your data and your users. There’s not a one-size fits all tool. Instead, you need to decide what’s most important to you, and prioritize that in your decision making.

Any improvements in quality will almost certainly affect performance. It’s all about understanding the trade-offs.

When determining which tool is right for you, consider the following criteria:

Adaptability: Image compression tools should allow the designer to choose what level of quality they want to see in the output. The more performance parameters you have access to, the more granular you can get with your strategy. For example, Granite allows developers to tinker with memory usage, disk storage and quality settings.

Workflow compatibility: Are your compression tools platform agnostic? Tools like Basis work like an adapter, snapping into your existing workflow, without needing a lot of changes. If you need to rebuild your entire image delivery system just for a small amount of bandwidth savings, you’re going to be unhappy.

Resource intensity: Some tools are resource intensive at the time of compression - others during decompression. If you only need to decompress, encode and store an image once, that’s not a problem. If you’re always grabbing new compressed files for processing, you’ll want to evaluate how many resources are required - otherwise your streaming will be slow.

 

Keep it real

Every texture you add to your game will increase the load time for players. But if you hone your image compression skills, you can keep those realistic textures without drastically impacting performance. It’s a worthwhile tool for your belt!

 

Find out how to scale your game to a global audience and eliminate latency issues

Five Ways To Keep Your Dev Team Motivated

Previous Article

Things To Know Before Your First Bitcoin Purchase

Next Article

Receive The Latest 100TB News

Share This Post

Latest News