bevyengine / bevyengine/bevy

Improve culling for cascaded shadow maps

Open
#10,397 1 comment 0 reactions 0 assignees View on GitHub
A-Rendering C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Problem

Currently we cull to the orthographic projection of each cascade, and that is created from the sphere containing the view frustum slice that the cascade covers, which means there are a lot of meshes that could be culled that are not.

## Solutions

* [ ] Cull to the back faces of the view frustum slice
* Calculate the dot product of the view frustum slice plane normal and the -light direction. If > 0.0 then the plane is a back face and should be used for culling. Use these faces for culling.
* [ ] Cull to half spaces formed by the light direction and the edges of the silhouette of the view frustum slice for the cascade from the perspective of the light
* Project the view frustum slice corners to a plane defined by the light direction and d = 0 (through the origin)
* Change the basis of the points from 3D world space to 2D coordinates in the plane
* Use a convex hull algorithm to find the silhouette edges
* Create culling planes from the light direction and the silhouette edges

I have implemented most of the already but am debugging the second part and cleaning it up before I make a PR.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the existing cascaded shadow-map culling implementation, then compare it with the two proposed culling approaches; done means the back-face and silhouette half-space culling work is debugged, cleaned up, and covered by the relevant project checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.