-
Notifications
You must be signed in to change notification settings - Fork 0
/
Retinotopy.frag.txt
39 lines (32 loc) · 1.12 KB
/
Retinotopy.frag.txt
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
/* Retinotopy.frag.txt */
const float twopi = 2.0*3.141592653589793;
/* Values passed from vertex shader: */
varying vec4 White;
varying vec4 Grey;
varying vec4 Black;
varying float CenterX;
varying float CenterY;
varying float Radius;
varying float spatFreq;
varying float orientation;
varying float phase;
void main()
{
/* Query current output texel position: */
vec2 pos = gl_TexCoord[0].xy;
/* Convert distance, apply shift offset: */
float x = pos[0]-CenterX;
float y = pos[1]-CenterY;
/* if (mod(floor((x+random)/(checkSize))+floor((y+random)/(checkSize)),2.0) <= 0.5) { */
/* gl_FragColor = Grey; */
/* } */
/* else { */
/* gl_FragColor = White; */
/* } */
float orient_vec = cos(orientation-twopi/4.0)*x+sin(orientation-twopi/4.0)*y;
float mix_coeff = sin(twopi*spatFreq*orient_vec+phase);
/* float kernel = exp(-(x*x+y*y)/(Radius*Radius/2.0)); */
float kernel = 1-1/(1+exp(-(sqrt(x*x+y*y)-Radius+40)*0.075));
mix_coeff = 0.5*mix_coeff*kernel+0.5;
gl_FragColor = vec4(mix_coeff,mix_coeff,mix_coeff,1);
}