Skip to content

Follow-ups: PC shadows and lighting (#555 review) #564

Backlog

Description

@BoroBongo

Follow-ups from the review of #555 (PC shadows and lighting). The PR fixed the dark lamps on Quest and lower quality levels, the torch's leftover shadow after a world change, the moving-light cap (the torch now has priority, and the cap is logged) and the unused _MAIN_LIGHT_SHADOWS_SCREEN variants. These were left for later.

Quest / build

  • Shader variant stripper (IPreprocessShaders) for Android/Pico: strip the main/additional shadow, soft shadow and SSAO keywords from the Gothic shaders. The build contains all three URP assets, and HighFidelity has shadows, so URP keeps these variants for the Quest build too. Compare APK build time, size and variant count before and after.
  • Check the Quest look in the headset. Darker nights, mines and rain, stronger lamps and day dimming also apply on Quest, without shadows (kept on purpose, see the ADR). Fix it separately if it looks wrong.
  • Per-pixel cost on Quest. World, plants and objects now compute GothicSunAndAmbient / GothicClampLight per pixel; SingleMesh carries two extra interpolators. Do a GPU capture on Quest; maybe keep the old per-vertex path when no shadow keyword is set.
  • The sun is created in code on every platform, including Quest, where it becomes URP's main light. Skip or disable it when supportsMainLightShadows is false.

Structure

  • Split the shadow logic out of StationaryLightsService (1100+ lines, 7 responsibilities) into a StationaryLightShadowsDomain: UpdateShadowLights, RefreshShadowLights, Add/RemoveDynamicShadowLight, ApplyDynamicShadow, SetLightShadow, plus the shadow cache wiring from feat: every lamp and fire in reach casts a cached shadow (GD3D11-like) - no more light through walls #559.
  • The "Shadows" option mapping as an enum (off/hard/medium/soft -> LightShadows + SoftShadowQuality). It is written in StationaryLightsService (2x) and SkyService.
  • IsOutdoor / IsIndoor: two bools for one fact.
  • _maxShadowLights (64) appears in both GothicShadowLightsFeature and GothicShadows.hlsl, and nothing checks that the two match.

Smaller

  • SSAO is not tied to the "Shadows" option, so a weak PC can't turn it off.
  • RefreshShadowLights returns early without a main camera.
  • UpdateRenderer: the sort lambda captures center (allocates for every renderer with >16 lights), and each change of the shadow set re-sorts all affected renderers.
  • The Dynamic shaders have no DepthOnly / DepthNormals pass, so NPCs and the hero get no SSAO.
  • GothicShadowLightsFeature: the catch-all swallows silently (log once); VisibleLight copies for up to 256 lights per camera per frame.
  • Two stacked <summary> blocks near HasLightMappedCeiling; the slider reuses SmoothRotationSettingAmount; check the removed NpcHeadMeshBuilder warning.
  • Wiki / Player guide: the new ini keys shadows (default 3) and shadowRange (default 0.75).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions