File: interlace.effect

package info (click to toggle)
obs-retro-effects 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,004 kB
  • sloc: ansic: 7,133; sh: 153; makefile: 27; cpp: 16
file content (44 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
uniform float4x4 ViewProj;
uniform texture2d image;
uniform texture2d prior_frame;
uniform float2 uv_size;
uniform float frame;
uniform float thickness;
uniform float4 brightness_reduction;

sampler_state textureSampler{
    Filter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
    MinLOD = 0;
    MaxLOD = 0;
};

struct VertData
{
	float4 pos : POSITION;
	float2 uv : TEXCOORD0;
};

VertData mainTransform(VertData v_in)
{
	v_in.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
	return v_in;
}

float4 mainImage(VertData v_in) : TARGET
{
	float2 coord = v_in.uv * uv_size;
	float cur_row = fmod(floor(coord.y/thickness) + frame, 2.0);
	float4 color = cur_row > 0.5f ? image.Sample(textureSampler, v_in.uv) : (prior_frame.Sample(textureSampler, v_in.uv) * brightness_reduction);
	return color;
}

technique Draw
{
	pass
	{
		vertex_shader = mainTransform(v_in);
		pixel_shader = mainImage(v_in);
	}
}