/// Amplitude of Grating
/// 0
/// 1
/// 1
float contrast : register(C1);
/// Phase of Grating
/// 0
/// 100
/// 100
float frequency: register(C2);
/// Phase of Grating
/// 0
/// 6.283184
/// 0
float phase: register(C3);
/// Orientation of Grating
/// 0
/// 6.283184
/// 0
float orientation: register(C4);
/// Half bandwidth of envelope
/// 2
/// 8
/// 4
float sigma : register(C5);
/// Transparency of Figure
/// 0
/// 1
/// 1
float alpha : register(C6);
float rp(float2 uv)
{
const float2 Center = float2(0.5,0.5);
float2 dir = uv - Center; // vector from center to pixel
float dist = length(dir);
//dir /= dist;
return dist;
}
float4 main(float2 uv : TEXCOORD) : COLOR
//float4 main(float2 uv : VPOS ) : COLOR
{
//float _r = rp(uv)*sigma*4.0;
//float env = exp( -(_r*_r) / 2.0 ) * alpha;
float _r = rp(uv)*8;
float env = exp( -(_r*_r) / (2.0) ) * alpha;
float _x = sin(orientation)*uv[0]-cos(orientation)*uv[1];
float l = 0.5+contrast*0.5*cos(frequency*_x + phase);
float4 color = float4(l,l,l,1.0);
return color;
}