File: utilities.effect

package info (click to toggle)
obs-noise 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,744 kB
  • sloc: ansic: 1,937; sh: 153; makefile: 26; cpp: 16
file content (49 lines) | stat: -rw-r--r-- 1,061 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
45
46
47
48
49
sampler_state textureSampler{
    Filter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
    MinLOD = 0;
    MaxLOD = 0;
};

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


float2 global_transform(float2 uv_in, float2 shift, float rot)
{
	uv_in -= shift;
	uv_in = uv_in * uv_size;
	uv_in += global_offset;
	uv_in = float2(uv_in.x * cos(rot) - uv_in.y * sin(rot), uv_in.x * sin(rot) + uv_in.y * cos(rot));
	uv_in = uv_in / uv_size;
	uv_in += shift;
	return uv_in;
}

float2 transform(float2 uv_in, float2 shift, float rot)
{
	uv_in -= shift;
	uv_in = uv_in * uv_size;
	uv_in = float2(uv_in.x * cos(rot) - uv_in.y * sin(rot), uv_in.x * sin(rot) + uv_in.y * cos(rot));
	uv_in = uv_in / uv_size;
	uv_in += shift;
	return uv_in;
}

float4 adjustments(float4 color, float b, float c)
{
	// Calculate Contrast Value
	float ca = c < 0.0f ? 1.0f / (-c + 1.0f) : (c + 1.0f);

	float3 col = float3(
		ca * color.r + b,
		ca * color.g + b,
		ca * color.b + b
	);
	col = ridged ? 1.0 - col : col;
	return float4(col.r, col.g, col.b, color.a);
}