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);
42 /* Expected output: vertex
43 layout(location=0) in vec4 position;
44 layout(location=0) out vec3 dir;
47 gl_Position = position;
48 dir = vec3(position.xy, 1.0);
52 /* Expected output: fragment
53 layout(set=0, binding=56) uniform Params
60 layout(location=0) out vec4 frag_color;
61 layout(location=0) in vec3 dir;
64 vec3 ndir = normalize(dir);
65 vec3 pos = vec3(0.0, 0.0, start_height);
66 float luminance = 0.0;
67 float extinction = 0.0;
70 if(pos.z<min_height || pos.z>max_height)
72 float density = exp(pos.z/-1000.0);
73 luminance += density*exp(-extinction);
74 extinction += density*step_size;
75 pos += ndir*step_size;
77 frag_color = vec4(vec3(luminance), 1.0);