#[Vulkan] Cascaded shadow mapping

7 messages · Page 1 of 1 (latest)

sly zenith
#

I have been struggling with cascaded shadow mapping for the past 2 weeks now, and face a large set of issues which results in a broken CSM.

**Latest issue: **
Shadow map are being cut depending of the camera position.

Investigation:
Latest work is based on the example provided by Sasha + various tutorial.
I checked the way the camera projection(perspective) and view were computed and it appears to be correct.
I checked the algorithm to compute cascaded shadow multiple times: split main frustum, inverse of camera projection * view, light direction,up vector, etc. And it appears to be correct.
I checked the vertex and fragment shaders for the depth map rendering and scene rendering. It appears to be correct.

I checked the depth map: this is where there is a problem.
As seen in the figure 2 and 3 (custom scene, that's the one with transparency disabled), the depth map in my scene seems to have a formatting issue? Depth tends to have a value at 0 easily, either the scene is close or far. Logically, since most values are at 0, there's no way to compare object in the scene and so there's no shadow visible.

In comparison, the figure 4 and 5 (sasha CSM demonstration) depth map seems properly rendered.

Details:
Graphics pipeline configuration are the same (VK_COMPARE_OP_LESS_EQUAL)
Render pass configuration is the same.
Render pass attachment and dependencies are the same.
Image format are the same (VK_FORMAT_D32_SFLOAT)
Image view configurations are the same.
Sampler configurations are the same.

Only difference found so far. Sasha example consider Stencil, when I do not.

I did these comparison both with the actual code, and the details provided by xCode at running time (used instead of renderdoc).

I would welcome any suggestions. Thank you in advance.

GitHub

Examples and demos for the new Vulkan API. Contribute to SaschaWillems/Vulkan development by creating an account on GitHub.

sly zenith
#

One week later, I still did not found the problem.

astral zephyr
#

did you enable depth clamping

sly zenith
#

Yes I did

astral zephyr
#

how are you sampling

sly zenith
#

I am using VK_FILTER_LINEAR with VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_MIPMAP_MODE_LINEAR, maxLod and anisotropy fixed at 1.0f.

opal forge
#

Did you checked you cascade split code? I guess, maybe the issue is with how you generating you view and projections matrices