Changeset View
Changeset View
Standalone View
Standalone View
intern/opencolorio/gpu_shader_display_transform.glsl
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | vec4 curvemapping_evaluate_premulRGBF(vec4 col) | ||||
| result.b = curvemap_evaluateF(2, col.b); | result.b = curvemap_evaluateF(2, col.b); | ||||
| result.a = col.a; | result.a = col.a; | ||||
| return result; | return result; | ||||
| } | } | ||||
| #endif /* USE_CURVE_MAPPING */ | #endif /* USE_CURVE_MAPPING */ | ||||
| /* Using a triangle distribution which gives a more final uniform noise. | /* Using a triangle distribution which gives a more final uniform noise. | ||||
| * See Banding in Games:A Noisy Rant(revision 5) Mikkel Gjøl, Playdead (slide 27) */ | * See Banding in Games:A Noisy Rant(revision 5) Mikkel Gjøl, Playdead (slide 27) */ | ||||
| /* GPUs are rounding before writting to framebuffer so we center the distribution around 0.0. */ | /* GPUs are rounding before writing to framebuffer so we center the distribution around 0.0. */ | ||||
| /* Return triangle noise in [-1..1[ range */ | /* Return triangle noise in [-1..1[ range */ | ||||
| float dither_random_value(vec2 co) | float dither_random_value(vec2 co) | ||||
| { | { | ||||
| /* Original code from https://www.shadertoy.com/view/4t2SDh */ | /* Original code from https://www.shadertoy.com/view/4t2SDh */ | ||||
| /* Uniform noise in [0..1[ range */ | /* Uniform noise in [0..1[ range */ | ||||
| float nrnd0 = fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); | float nrnd0 = fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); | ||||
| /* Convert uniform distribution into triangle-shaped distribution. */ | /* Convert uniform distribution into triangle-shaped distribution. */ | ||||
| float orig = nrnd0 * 2.0 - 1.0; | float orig = nrnd0 * 2.0 - 1.0; | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||