obs-StreamFX/data/examples/shaders/source/shadertoy-template.effect

84 lines
1.5 KiB
Text

// https://www.shadertoy.com/view/XljBW3
#define vec2 float2
#define vec3 float3
#define vec4 float4
#define ivec2 int2
#define ivec3 int3
#define ivec4 int4
#define mat2 float2x2
#define mat3 float3x3
#define mat4 float4x4
#define fract frac
#define mix lerp
#define iTime Time.x
#define iResolution ViewSize
uniform float2 mouse<
string name = "Virtual Mouse Coordinates";
string field_type = "slider";
float2 minimum = {0, 0};
float2 maximum = {100., 100.};
float2 scale = {.01, .01};
float2 step = {.01, .01};
> = {0., 0.};
uniform float4x4 ViewProj<
bool automatic = true;
>;
uniform bool direction<
string name = "Invert Direction";
> = true;
uniform float4 Time<
bool automatic = true;
>;
uniform float4 ViewSize<
bool automatic = true;
>;
uniform float4x4 Random <
bool visible = false;
string name = "Random Array";
string description = "A float4x4 value containing random values between 0 and 1";
>;
uniform float4x4 Random <
bool automatic = true;
>;
int2 iMouse() {
return int2(mouse.x * ViewSize.x, mouse.y * ViewSize.y);
}
/*ps start*/
/*ps end*/
struct VertFragData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertFragData VSDefault(VertFragData vtx) {
vtx.pos = mul(float4(vtx.pos.xyz, 1.0), ViewProj);
return vtx;
}
float4 PSDefault(VertFragData vtx) : TARGET {
float4 col = float4(1., 1., 1., 1.);
mainImage(col, vtx.uv * ViewSize.xy);
return col;
}
technique Draw
{
pass
{
vertex_shader = VSDefault(vtx);
pixel_shader = PSDefault(vtx);
}
}