Thursday 14 February 2019

Texture scaling

Texture scaling


Inspired by a post at Beq Janus' blog.

Second Life and the Hypergrid only support a few texture sizes and if you want good performance, you want to keep them as small as possible. That means they usually have to be resized to work and the rule is:
Scale your textures before you upload them!!!
Why?

Because there are different ways to scale an image and which is the best depends on a lot of factors. Often when people complain about poor resolution it's actually the scaling algorithm, not the pixel count that is the problem.

The texture uploader uses bilinear scaling. That is actually a good choice when you don't have a choice. But if you let your image editor do the job, you do have a choice and that is always better. It also means you get to see the result before you upload so you don't get nasty surprises afterwards.

The alogrithm I've found to be the best most of the time is neither bicubic or straight bilinear but Fant - a variant of bilinear you won't get from the uploader but as I said, there are exceptions.

For all the nerdy under-the-hood details, check out the wikipedia article about image scaling.

A special tip:
Sometimes a little bit of blurring (usually before scaling) can actually improve the perceived resolution. You can do this with Gaussian blur or by saving the image in the lossy jpeg format. Yes, I know this seems counter-intuitive but it does make sense. Quite often it's the graininess caused by high contrast neighbour pictures that is the problem, not the resolution. Blurring smooths out the texture and that can often help. Not always, but it's worth trying.

No comments:

Post a Comment