Skip to content

Commit

Permalink
add default linear conversion code
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Jan 6, 2024
1 parent c0c3a5d commit 082780d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
10 changes: 0 additions & 10 deletions data/examples/fade-transition.shader
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ uniform float transition_time<
> = 0.5;
uniform bool convert_linear = true;

float srgb_nonlinear_to_linear_channel(float u)
{
return (u <= 0.04045) ? (u / 12.92) : pow((u + 0.055) / 1.055, 2.4);
}

float3 srgb_nonlinear_to_linear(float3 v)
{
return float3(srgb_nonlinear_to_linear_channel(v.r), srgb_nonlinear_to_linear_channel(v.g), srgb_nonlinear_to_linear_channel(v.b));
}

float4 mainImage(VertData v_in) : TARGET
{
float4 a_val = image_a.Sample(textureSampler, v_in.uv);
Expand Down
12 changes: 1 addition & 11 deletions data/examples/pixelation-transition.shader
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ uniform float power<
float minimum = 0.5;
float maximum = 8.0;
float step = 0.01;
> = 3;
> = 3.0;
uniform float center_x<
string label = "X";
string widget_type = "slider";
Expand All @@ -30,16 +30,6 @@ uniform float center_y<
float step = 0.001;
> = 0.5;

float srgb_nonlinear_to_linear_channel(float u)
{
return (u <= 0.04045) ? (u / 12.92) : pow((u + 0.055) / 1.055, 2.4);
}

float3 srgb_nonlinear_to_linear(float3 v)
{
return float3(srgb_nonlinear_to_linear_channel(v.r), srgb_nonlinear_to_linear_channel(v.g), srgb_nonlinear_to_linear_channel(v.b));
}

float4 mainImage(VertData v_in) : TARGET
{
//1..0..1
Expand Down

0 comments on commit 082780d

Please sign in to comment.