Skip to content

Instantly share code, notes, and snippets.

@behreajj
Created November 10, 2021 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save behreajj/62a5e8d29e60f8955fec4feafa8f5873 to your computer and use it in GitHub Desktop.
Save behreajj/62a5e8d29e60f8955fec4feafa8f5873 to your computer and use it in GitHub Desktop.
Linear Gamma Luts
byte[ ] stlLut = new byte[256];
byte[ ] ltsLut = new byte[256];
for (int i = 0; i < 256; ++i)
{
float x = i / 255.0f;
float y = StandardToLinearChannel (x);
stlLut[i] = (byte) (0.5f + 255.0f * y);
float z = LinearToStandardChannel (x);
ltsLut[i] = (byte) (0.5f + 255.0f * z);
}
Debug.Log (stlLut[127]);
Debug.Log ((int) (0.5f + 255.0f * StandardToLinearChannel (0.498f)));
Debug.Log (ltsLut[127]);
Debug.Log ((int) (0.5f + 255.0f * LinearToStandardChannel (0.498f)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment