improved shadows a lot

This commit is contained in:
Tuomas Katajisto 2025-10-13 00:02:23 +03:00
parent 5075374773
commit 39f187689e
2 changed files with 4 additions and 5 deletions

View File

@ -461,8 +461,8 @@ create_plane_pipeline :: () {
g_shadowmap_sampler = sg_make_sampler(*(sg_sampler_desc.{
wrap_u = .CLAMP_TO_EDGE,
wrap_v = .CLAMP_TO_EDGE,
min_filter = .NEAREST,
mag_filter = .NEAREST,
min_filter = .LINEAR,
mag_filter = .LINEAR,
compare = .LESS,
}));

View File

@ -71,9 +71,8 @@ create_shadow_viewproj :: (cam: *Camera, conf: *World_Config) -> Matrix4 {
max_v.y = max(max_v.y, transformed_corner.y);
max_v.z = max(max_v.z, transformed_corner.z);
}
max_v *= 3;
min_v *= 3;
max_v.xy = avg.xy + Vector2.{50, 50};
min_v.xy = avg.xy - Vector2.{50, 50};
proj := matrix_ortho(min_v.x, max_v.x, min_v.y, max_v.y, -max_v.z-100, -min_v.z);
return view*proj;