ID:2272577
 
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Currently BYOND is not sRGB-aware, so trying to reduce the brightness of a tile by 50% (through either alpha = 127 or BLEND_MULTIPLY) results in:

That may not look too off, but the correct result is:

Notice the difference between the darker colors. The issue is far more obvious when using smaller steps in the gradient, and is why lighting tends to look non-linear or have weird brightness. You will get similar brightness artifacts when scaling an object up.

To fix this, the sprites need to be transformed from the color space they're stored in (usually sRGB) into linear color, blended, and converted to sRGB before being written to the framebuffer.

This could be done with the addition of a simple appearance flag, presumably called SRGB. Setting this flag would set the DX D3DSAMP_SRGBTEXTURE flag on the sampler while rendering the object. If set on a plane master, it would set D3DRS_SRGBWRITEENABLE while rendering that plane. This maintans backwards compatibility.

This means that you would need to both set SRGB on a plane master for plane=0, and on every object on that plane. It might be easier to make objects on an sRGB plane simply default to being sRGB and have a LINEAR_COLOR flag to override it.

Just note that this is slightly trickier to implement in GL since sRGB-ness is not part of the sampler, and instead determined at texture creation time.