17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-29 05:47:28 +01:00

Draw volumetric clouds, their shadows, a volumetric fog and catalogue stars from a new weather system in the GL 4.6 renderer

This commit is contained in:
2026-10-16 21:44:47 +02:00
parent d509775269
commit 2be85410ce
47 changed files with 5092 additions and 74 deletions

View File

@@ -0,0 +1,27 @@
// the shadow the clouds cast on the ground: for points of the ground reference around the camera, what the clouds let through
// towards the key light. the shading (light_common.glsl) and the fog (fog_inject.comp) look it up along the ray of the sun,
// see cloud_shadow() in weather_common.glsl
#include <common>
#include <clouds_common.glsl>
layout(local_size_x = WEATHER_GROUP_SIZE, local_size_y = WEATHER_GROUP_SIZE, local_size_z = 1) in;
layout(r16f, binding = 0) uniform writeonly image2D shadow;
layout(location = 1) uniform int size;
// world x and z of the centre of the map relative to the camera, size of the map (metres)
layout(location = 2) uniform vec3 placement;
// samples through a layer
layout(location = 3) uniform int steps;
void main()
{
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(texel, ivec2(size))))
return;
vec2 offset = placement.xy + ((vec2(texel) + 0.5) / float(size) - 0.5) * placement.z;
// the ground reference, the earth curving away
vec3 ground = vec3(offset.x, -weather_camera.x + dot(offset, offset) * (0.5 / CLOUD_EARTH_RADIUS), offset.y);
imageStore(shadow, texel, vec4(cloud_transmittance_to_sun(ground, steps)));
}