Photoshop Texture Exporter: Gamma correction for data images and normal maps

This exporter plugin is great, but I’m a little confused about the gamma correction toggle in the mip map section. It is on by default, and I am not noticing any difference in the appearance of mip maps with it on or off. What end result does this toggle have on the images?

My biggest concern is with non-RGB images, such as normal maps, and images that contain roughness + metallic + ao + etc. Should the toggle be disabled for non-color-data images?

I appreciate any advice!

Hi xmoatz! This checkbox makes it so that sRGB colors are correctly blended together (i.e. in linear space), when generating smaller mips. So, if you scroll “Mip” in the top-right box to 1 or higher, and then toggle the “Gamma Correct” box, you should see some changes.

Gamma Correct and Premultiplied Alpha Blending should generally be on for color images, and off for roughness+metallic+ao images and normal maps. (If the Exporter is generating a normal map using Image Type > Normal Map, then it knows the output is a normal map, and it ignores these checkboxes and uses slope-space mipmapping, a kind of mipmapping that’s mathematically designed for normal maps. Since Gamma Correct applies to each channel individually, leaving it on for roughness+metallic+ao images isn’t so bad; Premultiplied Alpha Blending is more important to turn off here in case there’s data in the alpha channel.)

Here’s one of my favorite images for testing this feature:


If you look at this image from far away (or squint so that the 1-pixel lines blur together), you should see a yellow, green, and red puzzle cube in the top-left, and a relatively uniform gray in the bottom-left. That’s how the image should look in reality (and therefore, how higher mips should look) when viewed from a distance.

(The chain-link fence on the right is there to test how sRGB interacts with premultiplied alpha, so I won’t talk about it too much).

However, if you generate mips without Gamma Correct, a surprising thing happens at Mip 1 and higher: the puzzle cube disappears almost completely, and the 1-pixel black-and-white lines become a significantly darker grey instead of blending into the surrounding grey!


With Gamma Correct on, we get a result that looks closer to reality:


Here’s the longer description about why this is good for color images, from the Gamma Correct tooltip:

Enables photometrically correct mipmapping.

Many images are expressed in display space, or what we take to
be sRGB - that is, the values of a color channel of a pixel are
the values you would send to the display to show a particular color.

However, sRGB isn’t a linear color space - an sRGB channel value
r corresponds to a luminance of about r^2.2, which appears to
be linear because our eyes also respond nonlinearly to color.
Downsampling images in sRGB space results in photometrically
incorrect images, because that blends between perceptually referenced
colors, instead of amounts of light. This can then lead to problems
with images with fine details and images with halftoning.

This setting converts the image to linear space before mipmapping,
which allows us to blend using amounts of light instead of
nonlinearly referenced colors.

The algorithm I used to turn a picture of a puzzle cube into an image that disappears when Gamma Correct is off comes from Eric Brasseur’s Gamma error in picture scaling page,

Hope this helps!


1 Like

Hey Neil, I was aware of the concepts of linear color space, gamma 2.2, etc., but have never seen an example like that. That is pretty wild. You have definitely answered my questions. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.