mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
data/shaders: Update examples
This commit is contained in:
parent
a04d102568
commit
e953932913
2 changed files with 116 additions and 15 deletions
|
@ -19,26 +19,14 @@ uniform texture2d ImageSource<
|
|||
bool visible = false;
|
||||
string name = "Source Texture (Filter, Transition)";
|
||||
>;
|
||||
uniform texture2d ImageSource_Size<
|
||||
uniform float2 ImageSource_Size<
|
||||
bool visible = false;
|
||||
string name = "Source Texture Size (Filter, Transition)";
|
||||
>;
|
||||
uniform texture2d ImageSource_Texel<
|
||||
uniform float2 ImageSource_Texel<
|
||||
bool visible = false;
|
||||
string name = "Source Texture Texel Size (Filter, Transition)";
|
||||
>;
|
||||
uniform texture2d ImageTarget<
|
||||
bool visible = false;
|
||||
string name = "Target Texture (Transition)";
|
||||
>;
|
||||
uniform texture2d ImageTarget_Size<
|
||||
bool visible = false;
|
||||
string name = "Target Texture Size (Transition)";
|
||||
>;
|
||||
uniform texture2d ImageTarget_Texel<
|
||||
bool visible = false;
|
||||
string name = "Target Texture Texel Size (Transition)";
|
||||
>;
|
||||
|
||||
// Shader Parameters
|
||||
uniform float4 p_my_val<
|
||||
|
@ -57,12 +45,44 @@ uniform float p_hue_shift <
|
|||
float step = 0.01;
|
||||
> = 0.0;
|
||||
|
||||
uniform float p_flag_amplitude <
|
||||
bool visible = true;
|
||||
string name = "Flag Amplitude";
|
||||
string mode = "slider"; // Default is input/spinbox
|
||||
float minimum = 0.01;
|
||||
float maximum = 100.0;
|
||||
float step = 0.01;
|
||||
> = 1.0;
|
||||
uniform float p_flag_speed <
|
||||
bool visible = true;
|
||||
string name = "Flag Speed";
|
||||
string mode = "slider"; // Default is input/spinbox
|
||||
float minimum = 0.01;
|
||||
float maximum = 100.0;
|
||||
float step = 0.01;
|
||||
> = 1.0;
|
||||
uniform float p_flag_whatever <
|
||||
bool visible = true;
|
||||
string name = "Flag Repeats";
|
||||
string mode = "slider"; // Default is input/spinbox
|
||||
float minimum = 0.01;
|
||||
float maximum = 100.0;
|
||||
float step = 0.01;
|
||||
> = 8.0;
|
||||
|
||||
|
||||
// ---------- Shader Code
|
||||
sampler_state def_sampler {
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
Filter = Linear;
|
||||
};
|
||||
sampler_state def_sampler2 {
|
||||
AddressU = Border;
|
||||
AddressV = Border;
|
||||
Filter = Linear;
|
||||
Border = 0000000000;
|
||||
};
|
||||
|
||||
struct VertData {
|
||||
float4 pos : POSITION;
|
||||
|
@ -144,6 +164,35 @@ technique HueShift
|
|||
}
|
||||
}
|
||||
|
||||
// ---------- Flag
|
||||
float4 PS_Flag(FragData v_in) : TARGET {
|
||||
float time = Time.y * p_flag_speed + v_in.uv.x * p_flag_whatever;
|
||||
float v_offset = sin(time) + cos(Time.x);
|
||||
float pi = 3.141;
|
||||
float v_orig = v_offset;
|
||||
v_offset = lerp(v_offset, v_orig * 0.25, 0.5 + cos(time + pi / 3) * 0.5);
|
||||
v_offset = lerp(v_offset, v_orig * 0.125, 0.5 + sin(time + pi / 3 * 2) * 0.5);
|
||||
v_offset = lerp(v_offset, v_orig * 0.333, 0.5 + cos(time + pi) * 0.5);
|
||||
v_offset = lerp(v_offset, v_orig * 0.4, 0.5 + sin(time + pi / 3 * 4) * 0.5);
|
||||
v_offset = lerp(v_offset, v_orig * 0.2, 0.5 + cos(time + pi / 3 * 5) * 0.5);
|
||||
v_offset *= v_in.uv.x;
|
||||
|
||||
float d = p_flag_amplitude * ImageSource_Texel.y * 2;
|
||||
v_in.uv.x *= 1.0;
|
||||
v_in.uv.y = v_in.uv.y + v_offset * d;
|
||||
v_in.uv.y -= d / 2.;
|
||||
v_in.uv.y *= 1.0 / (1.0 - d);
|
||||
return ImageSource.Sample(def_sampler2, v_in.uv);
|
||||
}
|
||||
|
||||
technique Flag
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PS_Flag(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Pass Through
|
||||
float4 PS_Draw(FragData v_in) : TARGET {
|
||||
|
|
|
@ -19,12 +19,36 @@ uniform float4x4 Random<
|
|||
// Shader Parameters
|
||||
uniform float4 p_my_val<
|
||||
bool visible = true;
|
||||
string name = "This is a Value";
|
||||
string name = "Color";
|
||||
float4 minimum = {0., 0., 0., 0.};
|
||||
float4 maximum = {1., 1., 1., 1.};
|
||||
float4 step = {.01, .01, .01, .01};
|
||||
> = {0., 0., 0., 1.};
|
||||
|
||||
uniform float2 p_plasma1<
|
||||
bool visible = true;
|
||||
string name = "Plasma UV 1";
|
||||
string mode = "slider";
|
||||
float2 minimum = {0., 0.};
|
||||
float2 maximum = {1., 1.};
|
||||
float2 step = {.01, .01};
|
||||
> = {0.25, 0.25};
|
||||
uniform float2 p_plasma2<
|
||||
bool visible = true;
|
||||
string name = "Plasma UV 2";
|
||||
string mode = "slider";
|
||||
float2 minimum = {0., 0.};
|
||||
float2 maximum = {1., 1.};
|
||||
float2 step = {.01, .01};
|
||||
> = {0.75, 0.75};
|
||||
uniform float4 p_plasma_color<
|
||||
bool visible = true;
|
||||
string name = "Plasma Color";
|
||||
float4 minimum = {0., 0., 0., 0.};
|
||||
float4 maximum = {1., 1., 1., 1.};
|
||||
float4 step = {.01, .01, .01, .01};
|
||||
> = {1.0, 1.0, 1.0, 1.0};
|
||||
|
||||
// ---------- Shader Code
|
||||
sampler_state def_sampler {
|
||||
AddressU = Wrap;
|
||||
|
@ -63,6 +87,34 @@ technique Random
|
|||
}
|
||||
}
|
||||
|
||||
// ---------- Plasma Color
|
||||
float4 PS_Plasma(FragData v_in) : TARGET {
|
||||
float dst1 = distance(v_in.uv, p_plasma1);
|
||||
float dst2 = distance(v_in.uv, p_plasma2);
|
||||
|
||||
float dst1s = dst1 * dst1;
|
||||
float dst2s = dst2 * dst2;
|
||||
|
||||
float dst = min(dst1s, dst2s) * (50. + (1. + sin(Time.y * 5.0)) * 100.0);
|
||||
|
||||
float4 t;
|
||||
t.a = 1.;
|
||||
t.r = p_plasma_color.r * ((1. + sin(dst)) * .5);
|
||||
t.g = p_plasma_color.g * ((1. + cos(dst)) * .5);
|
||||
t.b = p_plasma_color.b * ((1. + sin(dst)) * .5) * ((1. + cos(dst)) * .5);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
technique Plasma
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PS_Plasma(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Fixed Color
|
||||
float4 PS_Fixed(FragData v_in) : TARGET {
|
||||
return p_my_val;
|
||||
|
|
Loading…
Reference in a new issue