Skip to content

Commit 197b77b

Browse files
committed
Simpler fragment shader for 9 px mode
1 parent be3cc07 commit 197b77b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

shaders/star_frag.glsl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const float degree_per_px = 0.01; // higher value causes blinking due to optimizations in the psf_glow()
2+
const float inv_max_offset = 2.0 / (3.0 * sqrt(2.0) * degree_per_px); // 1/px
23

34
varying vec3 v_color;
45
varying float max_theta;
@@ -7,10 +8,8 @@ varying float pointSize;
78
float psf_core(float offset)
89
{
910
// Human eye's point source function from the research by Greg Spencer et al. (1995)
10-
// Optimized for the central part of the PSF. The flow from the nine neighboring pixels is constant.
11-
// Designed for degree_per_px == 0.01.
12-
return 1.0 + offset * (0.2789 * offset - 1.0);
13-
// the second summand is allowed to be scaled to achieve a seamless transition between modes
11+
// Optimized for the central part of the PSF (3x3 pixels square).
12+
return 1.0 - offset * inv_max_offset;
1413
}
1514

1615
float psf_glow(float offset)

0 commit comments

Comments
 (0)