EEVEE-Next: Shadow: Add LOD system to directional clipmap shadows #120031

Merged
Clément Foucault merged 16 commits from fclem/blender:eevee-next-shadow-directional-lod into main 2024-03-29 16:23:06 +01:00
1 changed files with 5 additions and 2 deletions
Showing only changes of commit e5d6ae2730 - Show all commits

View File

@ -56,12 +56,15 @@ void main()
ShadowSamplingTile tile_prev = shadow_sampling_tile_unpack(tile_prev_packed);
if (tile_prev.is_valid) {
/* Relative LOD. Used for reducing pixel rate at sampling time.
* Increase with each new invalid level. */
tile_prev.lod += 1;
/* Previous level is now twice as big as this level.
* Double the offset to the valid page. */
tile_prev.lod_offset = tile_prev.lod_offset * 2;
tile_prev.lod_offset *= 2;
/* Add the offset of this tile relative to the previous level to the tile data.
* There is only an offset if offset is odd since previous level is twice as big. */
tile_prev.lod_offset += ivec2(not(equal(offset_binary, ivec2(0))));
tile_prev.lod_offset += uvec2(not(equal(offset_binary, ivec2(0))));
tile_prev_packed = shadow_sampling_tile_pack(tile_prev);
/* Replace the missing page with the one from the lower LOD. */