Improvement/shadowmap - #217
Closed
xDanielBellido wants to merge 13 commits into
Closed
Conversation
Reorder the render pipeline so the camera depth buffer is generated before shadow rendering. Run the GPU min/max depth reduction and shadow frustum compute passes per viewport, then use the generated shadow data in both the shadow map and deferred lighting passes.
Remove the legacy bounds-based shadow fitting path and use the GPU-generated shadow data buffer as the sole source for directional shadow matrices and settings. Simplify shadow frame data, remove frame-global shadow reuse, and keep a safe disabled-shadow fallback when depth fitting is unavailable.
Extend Texture depth-stencil handling to create, access, and release individual DSVs for texture array slices while preserving existing 2D depth texture behaviour
Add configurable cascade count, split intervals, and Fit to Scene/Fit to Cascade modes to directional shadow settings, including editor controls, validation, and serialization.
Extend GPU shadow frustum fitting to partition the depth-fitted camera range and generate light view-projection matrices for each configured cascade while preserving the existing single-frustum shadow path
Add a cascaded depth texture array and render each configured directional shadow cascade into its own array slice while preserving the legacy shadow map for validation
Update deferred lighting to select the appropriate shadow cascade per fragment and sample the corresponding Texture2DArray slice while preserving shadow bias, strength, and PCF filtering
Add an optional per-cascade colour tint to visualise cascade selection during deferred lighting, using the existing shadow data layout.
Add debug visualization for the depth-fitted camera frustum and individual CSM cascade sub-frustum. Tint colour only visible in Game View.
Author
|
I close this PR because it's included in the Volumetric Fog System #221 |
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.
Directional shadow mapping improvement by adding Depth Buffer Fitting and Cascaded Shadow Maps (CSM).
Depth Buffer Fitting now uses the camera depth buffer on the GPU to calculate a tighter directional-light frustum, reducing wasted shadow-map space and avoiding GPU-to-CPU readback.
CSM divides the depth-fitted camera range into configurable cascades, generates a light projection for each one, and renders them into a Texture2DArray.
Debug tools can be found on the LightComponent, within the shadow settings. The Editor View shows the different cascades ranges of the Game Camera. The Game view shows the tint of each cascade.
The result is better shadow-map resolution usage and reduced aliasing, especially for geometry close to the camera.