mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-06 00:02:26 +01:00
Vulkan: parity with GL (P1–P7), shared GPU culling records (N6c), threaded command recording and render thread (M1, M4)
This commit is contained in:
34
shaders/vk14/clouds_shadow.comp
Normal file
34
shaders/vk14/clouds_shadow.comp
Normal file
@@ -0,0 +1,34 @@
|
||||
#version 460 core
|
||||
#define STAGE_COMPUTE 1
|
||||
// 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
|
||||
|
||||
#define LAYOUT_COMPUTE 1
|
||||
#include "common.glsl"
|
||||
#include "clouds_common.glsl"
|
||||
|
||||
layout(local_size_x = WEATHER_GROUP_SIZE, local_size_y = WEATHER_GROUP_SIZE, local_size_z = 1) in;
|
||||
|
||||
layout(r16f, set = COMPUTE_SET, binding = 0) uniform writeonly image2D shadow;
|
||||
|
||||
// the parameters of the kernel (push constants)
|
||||
layout(push_constant) uniform kernel_constants
|
||||
{
|
||||
int size;
|
||||
// world x and z of the centre of the map relative to the camera, size of the map (metres)
|
||||
vec3 placement;
|
||||
// samples through a layer
|
||||
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)));
|
||||
}
|
||||
Reference in New Issue
Block a user