9 #pragma MSP stage(vertex)
10 layout(location=0) in vec4 position;
13 gl_Position = position;
14 out vec3 dir = vec3(position.xy, 1.0);
17 #pragma MSP stage(fragment)
18 layout(location=0) out vec4 frag_color;
21 vec3 ndir = normalize(dir);
22 vec3 pos = vec3(0.0, 0.0, start_height);
23 float luminance = 0.0;
24 float extinction = 0.0;
27 if(pos.z<min_height || pos.z>max_height)
30 float density = exp(pos.z/-1000.0);
31 luminance += density*exp(-extinction);
33 extinction += density*step_size;
34 pos += ndir*step_size;
37 frag_color = vec4(vec3(luminance), 1.0);
40 /* Expected output: vertex
41 layout(location=0) in vec4 position;
42 layout(location=0) out vec3 dir;
45 gl_Position = position;
46 dir = vec3(position.xy, 1.0);
50 /* Expected output: fragment
51 layout(binding=80) uniform Params
58 layout(location=0) out vec4 frag_color;
59 layout(location=0) in vec3 dir;
62 vec3 ndir = normalize(dir);
63 vec3 pos = vec3(0.0, 0.0, start_height);
64 float luminance = 0.0;
65 float extinction = 0.0;
68 if(pos.z<min_height || pos.z>max_height)
70 float density = exp(pos.z/-1000.0);
71 luminance += density*exp(-extinction);
72 extinction += density*step_size;
73 pos += ndir*step_size;
75 frag_color = vec4(vec3(luminance), 1.0);