forked from Oncorporation/obs-shaderfilter
-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
322 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
uniform texture2d image_a; | ||
uniform texture2d image_b; | ||
uniform float transition_time< | ||
string label = "Transittion Time"; | ||
string widget_type = "slider"; | ||
float minimum = 0.0; | ||
float maximum = 1.0; | ||
float step = 0.001; | ||
> = 0.5; | ||
uniform bool convert_linear = true; | ||
|
||
float4 mainImage(VertData v_in) : TARGET | ||
{ | ||
float4 a_val = image_a.Sample(textureSampler, v_in.uv); | ||
float4 b_val = image_b.Sample(textureSampler, v_in.uv); | ||
float4 rgba = lerp(a_val, b_val, transition_time); | ||
if(convert_linear) | ||
rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb); | ||
return rgba; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
uniform float transition_time< | ||
string label = "Transittion Time"; | ||
string widget_type = "slider"; | ||
float minimum = 0.0; | ||
float maximum = 1.0; | ||
float step = 0.001; | ||
> = 0.5; | ||
uniform bool convert_linear = true; | ||
uniform float power< | ||
string label = "Power"; | ||
string widget_type = "slider"; | ||
float minimum = 0.5; | ||
float maximum = 8.0; | ||
float step = 0.01; | ||
> = 3.0; | ||
uniform float center_x< | ||
string label = "X"; | ||
string widget_type = "slider"; | ||
string group = "Center"; | ||
float minimum = 0.0; | ||
float maximum = 1.0; | ||
float step = 0.001; | ||
> = 0.5; | ||
uniform float center_y< | ||
string label = "Y"; | ||
string widget_type = "slider"; | ||
string group = "Center"; | ||
float minimum = 0.0; | ||
float maximum = 1.0; | ||
float step = 0.001; | ||
> = 0.5; | ||
|
||
float4 mainImage(VertData v_in) : TARGET | ||
{ | ||
//1..0..1 | ||
float scale = abs(transition_time - 0.5) * 2.0; | ||
scale = pow(scale, power); | ||
|
||
float2 uv = v_in.uv; | ||
uv -= float2(center_x, center_y); | ||
uv *= uv_size; | ||
uv *= scale; | ||
uv = floor(uv); | ||
uv /= scale; | ||
uv /= uv_size; | ||
uv += float2(center_x, center_y); | ||
uv = clamp(uv, 1.0/uv_size, 1.0); | ||
float4 rgba = image.Sample(textureSampler, uv); | ||
if(convert_linear) | ||
rgba.rgb = srgb_nonlinear_to_linear(rgba.rgb); | ||
return rgba; | ||
} |
Oops, something went wrong.