Neutral color for multiply 2x blending?

In a simple shader I use

Blend DstColor SrcColor             // 2x Multiplicative

I expected that the 50% grays in textures will become invisible. However
as it turns out (63,63,63) is the gray which (almost) disappears. First I
thought that it’s a texture gamma problem (0.5^2.0) but I did a few tests
and now I’m not sure what’s going on.

I tried the following things without seeing any change:

  • Textures in PSD, PNG and TGA formats.
  • Exporting to PNG with and without “Convert to sRGB”.
  • Unity’s “Correct Gamma” flag on and off.

I’d really like to have (128,128,128) as the invisible color, so I’d
appreciate any help.

What’s the rest of your shader? You probably have a doubling calculation elsewhere. Comment out the blend line, and work on making that 50% when expected.

Thats modulate 2x you want, not multiply 2x.

Thanks Jessy, indeed I missed that one line. :slight_smile:

What is the difference between modulate 2x and
multiply 2x? In the docs I saw code only for the latter.

No idea but the correct terminology (for fixed function under dx or opengl) is modulate 2x, where if a pixel is 128 there is no colour change and if lower it will darken, and brighter it will lighten. I guess for shaders they call it something else?

I didn’t know there was a term for it. I just know the blend mode; seems most useful for matching what “Double” does, with lighting, when you run out of texture stages on old cards.