17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 01:09:13 +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

@@ -100,6 +100,8 @@ void gl::glsl_common_setup()
"#define SCENE_AO_TEX " + std::to_string(SCENE_AO_TEX) + "\n" +
"#define CAB_PROBE_TEX " + std::to_string(CAB_PROBE_TEX) + "\n" +
"#define CAB_PROBE_ALBEDO_TEX " + std::to_string(CAB_PROBE_ALBEDO_TEX) + "\n" +
"#define SKY_OCCLUSION_HEIGHT_TEX " + std::to_string(SKY_OCCLUSION_HEIGHT_TEX) + "\n" +
"#define SKY_OCCLUSION_TEX " + std::to_string(SKY_OCCLUSION_TEX) + "\n" +
"#define CAB_PROBE_SSBO_BINDING " + std::to_string(CAB_PROBE_SSBO_BINDING) + "\n" +
"#define CAB_PROBE_SH_SIZE " + std::to_string(CAB_PROBE_SH_SIZE) + "\n" +
"#define CAB_PROBE_SH_GROUP_SIZE " + std::to_string(CAB_PROBE_SH_GROUP_SIZE) + "\n" +

View File

@@ -91,6 +91,11 @@ namespace gl
// the cab and of its albedo. bound directly, like the ones above
const size_t CAB_PROBE_TEX = MAX_TEXTURES + HELPER_TEXTURES + 15;
const size_t CAB_PROBE_ALBEDO_TEX = MAX_TEXTURES + HELPER_TEXTURES + 16;
// the occlusion of the sky and of the sun by the scenery around the camera (gfx::sky_occlusion, gl::scene_ubs::sky_occlusion_*):
// the height of the top of the scenery (R32F) and the shares of the sky and the limits of the key light (RGBA16F), toroidal maps
// read texel by texel with textureGather. bound directly, like the ones above
const size_t SKY_OCCLUSION_HEIGHT_TEX = MAX_TEXTURES + HELPER_TEXTURES + 17;
const size_t SKY_OCCLUSION_TEX = MAX_TEXTURES + HELPER_TEXTURES + 18;
struct scene_ubs
{
@@ -154,9 +159,18 @@ namespace gl
glm::vec4 cab_probe_lamp;
glm::vec4 cab_probe_lamp_color;
glm::vec4 cab_probe_lamp_shadow;
// the occlusion of the sky and of the sun by the scenery around the camera (gfx.skyvisibility, gfx::sky_occlusion), zero when
// there are no maps: x, y the world x, z of the camera of the pass wrapped to the size of the maps (the place of the camera on
// them), metres; z the world height of the camera; w 1 with the maps, 2 when the volumetric fog reads them too
glm::vec4 sky_occlusion_origin;
// x the size of the maps, metres, y their texels across, z the distance from the middle of the maps (the larger of the ones
// along x and z) the occlusion fades out from, w the distance it fades over
glm::vec4 sky_occlusion_params;
// xy the middle of the maps (the main camera they follow) less the camera of the pass, world x and z, metres; zw unused
glm::vec4 sky_occlusion_center;
};
static_assert(sizeof(scene_ubs) == 864 + 80 * MAX_HEADLIGHT_SHADOWS, "bad size of ubs");
static_assert(sizeof(scene_ubs) == 912 + 80 * MAX_HEADLIGHT_SHADOWS, "bad size of ubs");
const size_t MAX_PARAMS = 3;