Annotations
This commit is contained in:
@@ -7,6 +7,8 @@ float3 sampleLutCell(float3 index)
|
||||
float g = floor(index.g + 0.5);
|
||||
float b = floor(index.b + 0.5);
|
||||
|
||||
// The 33^3 cube is packed as blue slices laid horizontally, with red across
|
||||
// each slice and green down the atlas.
|
||||
float atlasWidth = LUT_SIZE * LUT_SIZE;
|
||||
float2 lutUv;
|
||||
lutUv.x = (r + b * LUT_SIZE + 0.5) / atlasWidth;
|
||||
@@ -30,6 +32,9 @@ float3 applyLut33(float3 color)
|
||||
float3 c011 = sampleLutCell(float3(baseIndex.r, nextIndex.g, nextIndex.b));
|
||||
float3 c111 = sampleLutCell(float3(nextIndex.r, nextIndex.g, nextIndex.b));
|
||||
|
||||
// Tetrahedral interpolation chooses one of six paths through the cube.
|
||||
// This avoids the muddy diagonals that simple trilinear LUT sampling can
|
||||
// introduce for strong grades.
|
||||
if (blend.r > blend.g)
|
||||
{
|
||||
if (blend.g > blend.b)
|
||||
@@ -55,6 +60,8 @@ float hash12(float2 value)
|
||||
|
||||
float3 outputDither(float2 pixel)
|
||||
{
|
||||
// Subtract paired hashes to center the dither around zero, then scale to
|
||||
// roughly one 8-bit code value.
|
||||
float r = hash12(pixel + float2(17.0, 31.0)) - hash12(pixel + float2(83.0, 47.0));
|
||||
float g = hash12(pixel + float2(29.0, 71.0)) - hash12(pixel + float2(53.0, 19.0));
|
||||
float b = hash12(pixel + float2(61.0, 11.0)) - hash12(pixel + float2(7.0, 97.0));
|
||||
|
||||
Reference in New Issue
Block a user