Skip to content

Lights: Slice F — Shadow controls (directional cascaded, spot, point) #488

@fernandotonon

Description

@fernandotonon

Parent epic: #482
Depends on: Slice C

Goal

Per-light shadow casting with sensible defaults and Ogre's existing shadow techniques. Keeps the no-shadow path free for users who don't want shadows.

Scope

  • Per-light Cast Shadows toggle in the Light inspector.
  • Per-light Receive Shadows toggle on materials/entities (existing Ogre concept — surface via the inspector for entities).
  • Directional shadows: cascaded shadow maps via Ogre::PSSMShadowCameraSetup. Configurable cascade count (2/3/4, default 3) and split lambda. One global config for now — per-light overrides are stretch.
  • Spot shadows: standard shadow mapping. Resolution selectable (512/1024/2048).
  • Point shadows: cubic shadow mapping (or omni-directional via 6 spots if the cube path is messy in our Ogre version).
  • Global Shadow Quality preset: Off / Low / Medium / High — maps to shadow map resolution + filter quality + cascade count.
  • Bias controls: depth bias + slope-scaled bias, exposed in an advanced expander per light (defaults that work for most scenes).
  • New ShadowController (src/ShadowController.{h,cpp}, QML_SINGLETON) holds global shadow params; per-light overrides on the LightManager side.
  • Apply shadow technique lazily on first light enabling shadows; uninstall when no lights cast shadows (keeps no-shadow path zero-cost).

Acceptance Criteria

  • Each light type can cast a shadow that visibly affects the scene.
  • No shadow performance cost when no light has shadows enabled (verified by frame-time check on a fixture scene).
  • Shadow Quality presets produce visibly different shadow softness/resolution.
  • Cascaded directional shadows handle a 50m scene with reasonable quality at default settings.
  • Bias controls eliminate visible acne on a default-lit plane.
  • Cross-platform: works on macOS arm64, Windows MinGW, Linux CI.
  • Sentry breadcrumb scene.light.shadow_toggle per light.

Effort

~7 days. Highest technical risk in the epic, mostly platform/driver quirks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlightingScene lighting: add/edit/manage lights, shadows, IES

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions