From: HOSOKAWA Kenchi Date: Mon, 23 May 2011 15:13:44 +0000 (+0900) Subject: shaderplaid X-Git-Url: http://git.osdn.jp/view?p=psychlops%2Fsilverlight.git;a=commitdiff_plain;h=39e414403e124f21d684b744254e74539caceeb1 shaderplaid Signed-off-by: HOSOKAWA Kenchi --- diff --git a/dev4/Shader/Gabor.fx b/dev4/Shader/Gabor.fx index e588bb6..095d01f 100644 --- a/dev4/Shader/Gabor.fx +++ b/dev4/Shader/Gabor.fx @@ -50,7 +50,7 @@ float4 main(float2 uv : TEXCOORD) : COLOR //float _r = rp(uv)*sigma*4.0; //float env = exp( -(_r*_r) / 2.0 ) * alpha; float _r = rp(uv)*8; - float env = 1.0;//exp( -(_r*_r) / (2.0) ) * alpha; + float env = exp( -(_r*_r) / (2.0) ) * alpha; float _x = sin(orientation)*uv[0]-cos(orientation)*uv[1]; float l = 0.5+env*contrast*0.5*cos(frequency*_x + phase); diff --git a/dev4/Shader/Gabor.ps b/dev4/Shader/Gabor.ps index 1d39b76..cdc54db 100644 Binary files a/dev4/Shader/Gabor.ps and b/dev4/Shader/Gabor.ps differ diff --git a/dev4/Shader/Grating.fx b/dev4/Shader/Grating.fx new file mode 100644 index 0000000..88d73b8 --- /dev/null +++ b/dev4/Shader/Grating.fx @@ -0,0 +1,43 @@ +/// 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); + + +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 +{ + 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; +} diff --git a/dev4/Shader/Grating.ps b/dev4/Shader/Grating.ps new file mode 100644 index 0000000..1d39b76 Binary files /dev/null and b/dev4/Shader/Grating.ps differ diff --git a/dev4/Shader/Plaid.fx b/dev4/Shader/Plaid.fx new file mode 100644 index 0000000..e8635d1 --- /dev/null +++ b/dev4/Shader/Plaid.fx @@ -0,0 +1,69 @@ +/// Amplitude of Grating +/// 0 +/// 1 +/// 0.5 +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); + +/// Amplitude of Grating2 +/// 0 +/// 1 +/// 0.5 +float contrast2 : register(C5); + +/// Phase of Grating2 +/// 0 +/// 100 +/// 100 +float frequency2: register(C6); + +/// Phase of Grating2 +/// 0 +/// 6.283184 +/// 0 +float phase2: register(C7); + +/// Orientation of Grating2 +/// 0 +/// 6.283184 +/// 0.785398 +float orientation2: register(C8); + + +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 +{ + float _x1 = sin(orientation)*uv[0]-cos(orientation)*uv[1]; + float _x2 = sin(orientation2)*uv[0]-cos(orientation2)*uv[1]; + float l = 0.5 + + contrast*0.5*cos(frequency*_x1 + phase) + + contrast2*0.5*cos(frequency2*_x2 + phase2); + + float4 color = float4(l,l,l,1.0); + return color; +} diff --git a/dev4/Shader/Plaid.ps b/dev4/Shader/Plaid.ps new file mode 100644 index 0000000..31eee86 Binary files /dev/null and b/dev4/Shader/Plaid.ps differ diff --git a/test4/PsychlopsMain.cs b/test4/PsychlopsMain.cs index 5fe3ea7..fe1a13a 100644 --- a/test4/PsychlopsMain.cs +++ b/test4/PsychlopsMain.cs @@ -1,4 +1,4 @@ - +/* ///+ Prefix linkto BasicCode1 //// Lines for set up Psychlops environment using Psychlops; @@ -70,6 +70,7 @@ namespace PsychlopsSilverlightApp } } + * */ /* @@ -541,7 +542,7 @@ using Psychlops; */ -/* + using Psychlops; //Position Bias Program namespace PsychlopsSilverlightApp @@ -607,4 +608,3 @@ namespace PsychlopsSilverlightApp } } } -*/ \ No newline at end of file