X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fcommon_world.glsl;h=d7b3ccfefc0741947a9bcd380b64e44e24d4a23a;hb=a1741ec4aed057cbafff2d6bc9e5cf8a15ae322b;hp=4d9b0d3d6a7211f6cdb38499338264ab252ffc84;hpb=168eb5c363f510d60703498e01ffcdb52bf9fd07;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/common_world.glsl b/shaders/common_world.glsl index 4d9b0d3..d7b3ccf 100644 --- a/shaders/common_world.glsl +++ b/shaders/common_world.glsl @@ -9,6 +9,7 @@ layout (std140) uniform ub_world_lighting float g_water_fog; int g_light_count; int g_light_preview; + int g_shadow_samples; }; uniform sampler2D g_world_depth; @@ -50,7 +51,7 @@ float world_depth_sample( vec3 pos ) float shadow_sample( vec3 vdir ) { - vec3 sample_pos = aCo + vdir; + vec3 sample_pos = aWorldCo + vdir; float height_sample = world_depth_sample( sample_pos ); float fdelta = height_sample - sample_pos.y; @@ -73,6 +74,11 @@ vec3 do_light_shadowing_old( vec3 vfrag ) vec3 do_light_shadowing( vec3 vfrag ) { + if( g_shadow_samples == 0 ) + { + return vfrag; + } + float fspread = g_light_colours[0].w; vec3 vdir = g_light_directions[0].xyz; float flength = g_light_directions[0].w;