Draft
Conversation
…culling, shader support Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add tile based shadow mapping implementation
Implement tile-based shadow map system (TBSM)
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a full tile-based shadow map system to the forward renderer. The screen is divided into 16×16 pixel tiles; each tile carries a bitmask of which shadow lights affect it, so fragment shaders skip irrelevant shadow lookups entirely.
New components
TileShadowPass– container (mirrorsHizGeneratorpattern) that owns:Texture2DArrayshadow atlas (1024×1024×MAX_SHADOW_LIGHTS=4, D32).TileShadowPassInfoUBO – per-light view-projection matrix + type + position/radius.uint32_t[128×72]where bit N = shadow light N affects that tile.ShadowSlotPass– oneRasterPassper active shadow light, rendering scene depth into its atlas layer via an importedImageView.Pipeline integration
DefaultForwardPipeline::Collectnow callstileShadow->Setup()first (to build shadow matrices beforeSetupGlobalreadsLightMatrix), thentileShadow->AddPasses()to enqueue slot passes before the forward pass.Four new descriptor bindings added to the default raster layout:
TileShadowInfoTileLightBitmaskShadowAtlasTexture2DArrayShadowAtlasSamplerShader integration
New
assets/shaders/layout/tile_shadow.hlslh(auto-included viadefault_pass.hlslh) provides:ComputeTileShadowlooks up the tile bitmask fromSV_Position, then performs 3×3 PCF sampling fromShadowAtlasfor each flagged light.New
ENABLE_TILE_SHADOWpragma option added tostandard_pbr.hlslalongside the existingENABLE_SHADOWpath.Light system additions
SpotLight::BuildShadowMatrix(SceneView&)– constructs a perspective shadow view from the spot light's position and cone direction.SpotLight: addedSetPosition,SetDirection,SetRange,GetRange.LightFeatureProcessor::GetLights()– exposes the local light list for shadow light collection.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.