17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-05 06:24:27 +01:00

Shade the sky and the sun by the scenery around the camera instead of the track environment flags

This commit is contained in:
2026-10-27 16:02:36 +01:00
parent 9dde5b0e5e
commit 2a876befb0
35 changed files with 2351 additions and 55 deletions

View File

@@ -12,6 +12,7 @@
#include "common.glsl"
#include "clouds_common.glsl"
#include "sky_occlusion.glsl"
layout(local_size_x = WEATHER_GROUP_SIZE, local_size_y = WEATHER_GROUP_SIZE, local_size_z = 1) in;
@@ -253,14 +254,16 @@ void main()
{
vec3 direction = normalize(world);
// the light of the sky and the sun, held back by the shadows
float sunlit = cloud_shadow(world);
// the scenery around holds back the sky and the key light (tunnels, under bridges: gfx.skyvisibility.fog)
vec2 skyoccl = (sky_occlusion_origin.w > 1.5) ? sky_occlusion_world(world, vec3(0.0)) : vec2(1.0);
float sunlit = cloud_shadow(world) * skyoccl.y;
if (options.z > 0.5 && sunlit > 0.0)
{
// two points of the segment, one in each half: a shaft of light no longer comes and goes with the one point sampled
float shadow = sun_shadow(start + raydirection * (span * 0.5 * offset.z)) + sun_shadow(start + raydirection * (span * 0.5 * (offset.z + 1.0)));
sunlit *= 1.0 - 0.5 * shadow;
}
vec3 light = fog_whiten(fog_color_world(direction), (ground + clouds) / extinction) * fog_light_factor(sunlit);
vec3 light = fog_whiten(fog_color_world(direction), (ground + clouds) / extinction) * ((1.0 - fog_light.x) * skyoccl.x + fog_light.x * sunlit);
// lamps and headlights of the clusters the segment of the cell goes through, each part of the segment with the lights of
// its own cluster. the lights of the cluster of the point sampled would change with the point, frame to frame, where the
// cell reaches into two clusters which don't hold the same lights (a full cluster leaves the least important out)