131 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			131 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| // Always provided by OBS
 | |
| uniform float4x4 ViewProj<
 | |
| 	bool visible = false;
 | |
| 	string name = "View Projection Matrix";
 | |
| >;
 | |
| 
 | |
| // Provided by Stream Effects
 | |
| uniform float4 Time<
 | |
| 	bool visible = false;
 | |
| 	string name = "Time Array";
 | |
| 	string description = "A float4 value containing the total time, rendering time and the time since the last tick. The last value is a random number between 0 and 1.";
 | |
| >;
 | |
| uniform float4x4 Random<
 | |
| 	bool visible = false;
 | |
| 	string name = "Random Array";
 | |
| 	string description = "A float4x4 value containing random values between 0 and 1";
 | |
| >;
 | |
| 
 | |
| // Shader Parameters
 | |
| uniform float4 p_my_val<
 | |
| 	bool visible = true;
 | |
| 	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;
 | |
| 	AddressV  = Wrap;
 | |
| 	Filter    = Linear;
 | |
| };
 | |
| 
 | |
| struct VertData {
 | |
| 	float4 pos : POSITION;
 | |
| 	float2 uv  : TEXCOORD0;
 | |
| };
 | |
| 
 | |
| struct FragData {
 | |
| 	float4 pos : POSITION;
 | |
| 	float2 uv  : TEXCOORD0;
 | |
| };
 | |
| 
 | |
| FragData VSDefault(VertData v_in) {
 | |
| 	FragData vert_out;
 | |
| 	vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
 | |
| 	vert_out.uv  = v_in.uv;
 | |
| 	return vert_out;
 | |
| }
 | |
| 
 | |
| // ---------- Random Color
 | |
| float4 PS_Random(FragData v_in) : TARGET {
 | |
| 	return float4(Random[0][0], Random[0][1], Random[0][2], 1.0); 
 | |
| }
 | |
| 
 | |
| technique Random
 | |
| {
 | |
| 	pass
 | |
| 	{
 | |
| 		vertex_shader = VSDefault(v_in);
 | |
| 		pixel_shader  = PS_Random(v_in);
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // ---------- 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; 
 | |
| }
 | |
| 
 | |
| technique Draw
 | |
| {
 | |
| 	pass
 | |
| 	{
 | |
| 		vertex_shader = VSDefault(v_in);
 | |
| 		pixel_shader  = PS_Fixed(v_in); 
 | |
| 	}
 | |
| }
 |