EEVEE-Next: Shadow: Add LOD system to directional clipmap shadows #120031
|
@ -56,12 +56,15 @@ void main()
|
||||||
ShadowSamplingTile tile_prev = shadow_sampling_tile_unpack(tile_prev_packed);
|
ShadowSamplingTile tile_prev = shadow_sampling_tile_unpack(tile_prev_packed);
|
||||||
|
|
||||||
if (tile_prev.is_valid) {
|
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.
|
/* Previous level is now twice as big as this level.
|
||||||
* Double the offset to the valid page. */
|
* 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.
|
/* 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. */
|
* 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);
|
tile_prev_packed = shadow_sampling_tile_pack(tile_prev);
|
||||||
/* Replace the missing page with the one from the lower LOD. */
|
/* Replace the missing page with the one from the lower LOD. */
|
||||||
|
|
Loading…
Reference in New Issue