mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-03 17:50:21 +01:00
Add screen-space contact shadows for the sun, lamps and headlights
This commit is contained in:
@@ -70,6 +70,7 @@ void gl::glsl_common_setup()
|
||||
"#define CLOUD_DETAIL_TEX " + std::to_string(CLOUD_DETAIL_TEX) + "\n" +
|
||||
"#define CLOUD_COVERAGE_TEX " + std::to_string(CLOUD_COVERAGE_TEX) + "\n" +
|
||||
"#define CLOUD_HISTORY_TEX " + std::to_string(CLOUD_HISTORY_TEX) + "\n" +
|
||||
"#define SCENE_DEPTH_TEX " + std::to_string(SCENE_DEPTH_TEX) + "\n" +
|
||||
"#define WEATHER_UBO_BINDING " + std::to_string(WEATHER_UBO_BINDING) + "\n" +
|
||||
"#define WEATHER_SCRATCH_SSBO_BINDING " + std::to_string(WEATHER_SCRATCH_SSBO_BINDING) + "\n" +
|
||||
"#define MAX_CLOUD_LAYERS " + std::to_string(MAX_CLOUD_LAYERS) + "\n" +
|
||||
@@ -214,6 +215,9 @@ void gl::glsl_common_setup()
|
||||
// shadow maps of the headlights, see gl::scene_ubs
|
||||
mat4 headlight_shadow[MAX_HEADLIGHT_SHADOWS];
|
||||
vec4 headlight_shadow_params[MAX_HEADLIGHT_SHADOWS];
|
||||
// contact shadows, see gl::scene_ubs
|
||||
vec4 contact_shadow_params;
|
||||
vec4 contact_shadow_lamps;
|
||||
};
|
||||
|
||||
#ifdef STAGE_VERTEX
|
||||
|
||||
11
gl/ubo.h
11
gl/ubo.h
@@ -75,6 +75,9 @@ namespace gl
|
||||
const size_t CLOUD_DETAIL_TEX = MAX_TEXTURES + HELPER_TEXTURES + 8;
|
||||
const size_t CLOUD_COVERAGE_TEX = MAX_TEXTURES + HELPER_TEXTURES + 9;
|
||||
const size_t CLOUD_HISTORY_TEX = MAX_TEXTURES + HELPER_TEXTURES + 10;
|
||||
// the depth of the opaque scene of the main view drawn before its colour, resolved, for the contact shadows (light_common.glsl).
|
||||
// bound directly, like the ones above
|
||||
const size_t SCENE_DEPTH_TEX = MAX_TEXTURES + HELPER_TEXTURES + 11;
|
||||
|
||||
struct scene_ubs
|
||||
{
|
||||
@@ -92,9 +95,15 @@ namespace gl
|
||||
// projector. and x: size of a texel of the map one metre from the projector, y: radius of the filter in texels
|
||||
glm::mat4 headlight_shadow[MAX_HEADLIGHT_SHADOWS];
|
||||
glm::vec4 headlight_shadow_params[MAX_HEADLIGHT_SHADOWS];
|
||||
// contact shadows, read from SCENE_DEPTH_TEX; set only for the colour pass of the main view, zero elsewhere.
|
||||
// x: length of the rays towards the lights, metres (0: off), y: distance from the camera at which they end, z: steps
|
||||
// of the ray towards the sun, w: steps of the rays towards lamps and headlights
|
||||
glm::vec4 contact_shadow_params;
|
||||
// x: how many lamps and headlights a pixel traces the rays to (0: only the sun), yzw unused
|
||||
glm::vec4 contact_shadow_lamps;
|
||||
};
|
||||
|
||||
static_assert(sizeof(scene_ubs) == 400 + 80 * MAX_HEADLIGHT_SHADOWS, "bad size of ubs");
|
||||
static_assert(sizeof(scene_ubs) == 432 + 80 * MAX_HEADLIGHT_SHADOWS, "bad size of ubs");
|
||||
|
||||
const size_t MAX_PARAMS = 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user