@@ -2,10 +2,10 @@ const float degree_per_px = 0.05;
22const float br_limit = 1.0 / (255.0 * 12.92 );
33
44varying vec3 v_color;
5- varying vec3 v_max_tetha_hk ;
5+ varying vec3 v_tetha_k ;
66varying float pointSize;
77
8- float psf_square(float theta, float min_theta, float max_theta, float h, float k, float b )
8+ float psf_square(float theta, float min_theta, float max_theta, float k )
99{
1010 // Human eye's point source function, optimized to fit a square.
1111 // Lower limit on brightness and angular size: 1 Vega and 0.05 degrees per pixel.
@@ -16,44 +16,28 @@ float psf_square(float theta, float min_theta, float max_theta, float h, float k
1616
1717 if (theta < max_theta)
1818 {
19- float brackets = b / ( theta - h) - 1.0 ;
20- return brackets * brackets / k ;
19+ float brackets = max_theta / theta - 1.0 ;
20+ return k * brackets * brackets ;
2121 }
2222
23- return 0.0 ; // after max_theta function starts to grow again
23+ return 0.0 ;
2424}
2525
26- /*
27- float psf_fullscreen(float theta, float min_theta):
28- {
29- // Human eye's point source function, optimized to be a full-screen shader.
30- // The price to pay for simplification is a brightness reduction compared to the original PSF.
31-
32- if (theta2 < min_theta)
33- return 1; // overexposed
34-
35- return 4.43366571e-6 / theta;
36- }
37- */
38-
3926void main(void )
4027{
41- float max_theta = v_max_tetha_hk .x;
28+ float max_theta = v_tetha_k .x;
4229 if (max_theta == - 1.0 )
4330 {
4431 gl_FragColor = vec4 (v_color, 1.0 );
4532 }
4633 else
4734 {
48- float h = v_max_tetha_hk.y;
49- float k = v_max_tetha_hk.z;
50-
51- float b = max_theta - h;
52- float min_theta = h + b / (sqrt (k) + 1.0 );
53-
35+ float min_theta = v_tetha_k.y;
36+ float k = v_tetha_k.z;
37+ // Option 2: glare square render
5438 vec2 offset = (gl_PointCoord .xy - vec2 (0.5 )) * pointSize;
55- float theta = length (offset) * degree_per_px;
39+ float theta = length (offset) * degree_per_px;
5640
57- gl_FragColor = vec4 (v_color * psf_square(theta, min_theta, max_theta, h, k, b ), 1.0 );
41+ gl_FragColor = vec4 (v_color * psf_square(theta, min_theta, max_theta, k ), 1.0 );
5842 }
5943}
0 commit comments