Repository navigation
Conversation
…d a Shadows option (PC) - Gothic's lit shaders (world, VOBs, plants, NPCs, items) cast shadows (ShadowCaster passes with the same wind, alpha cut and fatness as the main pass) and receive them. The shadow darkens only the sun's light, GD3D11-like: Gothic's baked light of sun-facing outdoor surfaces and the sun part of objects; lightmaps, ambient and fires stay. - A "Sun" directional light (SkyService) is URP's main light: it rises at 6, is highest at 12 (60 degrees, the path tilted), sets at 18; at night the moon takes its place with a weaker shadow, faded out at the horizon. It moves every game second, so the shadows glide. _SunDirection was Euler angles, not a direction - N·L of objects was a switch on the normal's x. - DepthOnly/DepthNormals passes: URP's SSAO (HighFidelity renderer) finally sees the world; it darkens the baked/ambient light, less the sun and fires. - Immersion option Shadows: off / hard / medium / soft (default), 8 languages. - SunUpdateInterval defaults to every game second; InitSky no longer adds a sun listener per world load. Quest: the Performant asset has no shadows and no SSAO - nothing changes there.
…round), darker nights, rain darkens the world - The 6 lights closest to the camera (lamps, fires; not the lightmap-baked ones) become shadow casting URP point lights (StationaryLightsService, Shadows option). The shaders light them through URP with their cube shadow - a lamp's iron cage throws its ornament onto the street. GothicShadowLightsFeature tells the shaders their index among URP's additional lights every frame: URP's 8 per-object lights cut a lamp's light off at a world chunk's edge. - Only Unity lights within 40 m stay enabled: the city has ~770, URP takes 256 visible ones - turning the head pushed a lamp out and its light vanished. The pool still lights the world beyond. - Renderers sort their stationary lights: shadow casting first, then the closest (slot order left the market's lamps out). - Lamps/fires a bit stronger with a 1-(d/R)² falloff; the light sum stops at 1 like Gothic's 8 bit vertex light, pools next to each other no longer burn out orange. - Nights are darker (the world gets half of the night sky's light), indoor worlds (mines) darker, rain/thunderstorms darken the world and weaken the sun's shadow.
…on shaded walls at noon Gothic's lights burn all day, but its bright vertex light hid them. Ours are stronger and the sun's shadow leaves 40%, so lamps glowed on shaded walls at noon. Lights outside of houses and caves (no light mapped polygons within 3 m) follow the day light: full at night, 20% at noon - their pool slot and Unity light (objects, NPCs, lamp shadows). Fireplaces inside, mines and the hero's torch stay.
…orinis' street lamps next to light mapped walls dim by day too Light mapped polygons within 3 m made a light indoors: the market's street lamps stand next to light mapped walls and stairs (and the sewers run below), they kept glowing at noon. Now a light mapped polygon 2-8 m right above the light (roof, cave or sewer ceiling) makes it indoors.
How this PR was made: AI-assisted development logThis PR was written by Claude Code (Claude Opus) in one live session with BoroBongo. BoroBongo steered and played along in the Editor's Game view and reacted to what he saw; the agent wrote the code, tested it in the running game through the Unity MCP and took the screenshots. The prompt
1. Research (two parallel subagents)
2. Testing setup (Unity MCP, no headset)
3. Iterations driven by what we saw
Black carpets at Abuyin's stall turned out to be the same "lightmap nearby" heuristic. That is a separate PR: #554. 4. Verification
Screenshots are on BoroBongo's machine (
|
…adows; highlighted NPCs and objects keep theirs - ClaimHeroLight takes the hero light's Unity light (torch, Light spell): it casts a cube shadow (near plane 0.2 m, so the torch's stick doesn't hide its flame), its slot is marked (w < 0) and the shaders light it through URP like the lamps. - Spell projectiles (VRSpellThrow) register their light as a dynamic shadow light: a flying fireball now lights the walls it passes (before only NPCs and objects) and throws shadows. Up to 4 dynamic shadow lights; destroyed ones drop out. - Spell effect lights (VisualFxLight: summoning, fire rain) come before the lamps among the pooled shadow lights. - 12 shadow lights at most (feature and shader). - Lit/SingleMesh-Dynamic and Lit/AlphaToCoverage-Dynamic (highlight on hover, fading) got a ShadowCaster pass - a highlighted NPC lost its shadow. - The Shadows option switches them too.
…htness was outside UnityPerMaterial and ~1900 VOBs had a MaterialPropertyBlock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ps/fires within 40 m cast shadows Lights beyond the shadow casting ones have no shadow: a candle in a house lit the house's outside walls like a spotlight. A light under a light mapped ceiling (house, cave, sewer) is indoor (slot color alpha 1) and skips outdoor surfaces (vertex lit polygons, VOBs outside light mapped areas). 10 instead of 6 lamps/fires within 40 m cast shadows (16 shadow lights at most incl. the hero light and projectiles).
… m); the hero's head casts a shadow the camera never sees Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m), additional shadow atlas 4096, sun shadows 150 m; every Lit/World pass SRP batched Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hero body shadow, Shadow range option, SRP batcher rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>









What
Dynamic shadows and moodier lighting on PC, in the spirit of GD3D11 (the D3D11 renderer mod for the original games). Gothic's baked look stays; there is no overhaul. Quest is unchanged: its quality level (URP-Performant) has no shadows and no SSAO, and the shaders compile those parts away there.
This PR now also contains #556 (the hero's torch and spell shadows, highlighted NPCs keep their shadow), the hero's own shadow, the roof rule for indoor lights, the "Shadow range" option and the frame rate fixes from the first playtests. #558 (SRP batcher) is merged in, so merge #558 first. The cached shadows for all other lamps come in a stacked PR on top of this one.
Sun and moon
SunUpdateInterval: Production + default "every game second"), so shadows glide instead of jumping once per game minute._SunDirectionwas Euler angles, not a direction. N·L of objects/NPCs was effectively a switch onnormal.x. It is now the real light direction.Shaders (
Lit-World,Lit-AlphaToCoverage,Lit-SingleMesh)Cull Off, because Gothic's polygons are one-sided. The-Dynamicshaders (highlighted NPCs/items) got one too, so a highlighted NPC keeps its shadow.Lit/Worldpass has the same material buffer (perf: the world and its VOBs are SRP batched again (SetPass 3100 -> 190 with shadows) #558). Without it every shadow pass drew the world chunk by chunk.Lamps, fires, torch and spells
w < 0) and skips them; the shaders light them through URP with the cube shadow.GothicShadowLightsFeature(renderer feature onURP-HighFidelity-Renderer) finds their index among URP's additional lights every frame. URP's 8 per-object lights cut a lamp's light off at a world chunk's edge. It no longer resolves the lights service in edit mode (exceptions in the Render Graph).1 - (d/R)², strength 1.4.The hero's shadow (VR). The hero's body casts its shadow (sun, moon, lamps, torch). The head is scaled away so the camera doesn't see into it; a shadow-only copy of it follows the head bone, so the shadow has a head and the camera never draws it.
Darkness
Options (Immersion, 8 languages)
Frame rate. 40 shadow lamps (the first slider range) and the unbatched world tanked the frame rate in the first playtest. Now: max 12 lamps, additional-light shadow atlas 4096, sun shadows 150 m, world SRP batched. In the editor in Khorinis: SetPass calls 3100 → 190, opaque pass 86 ms CPU / 44 ms GPU → 5 / 9.5 ms, sun shadows 9.5 / 3.7 → 4.4 / 1.2 ms, lamp shadows 9.8 / 4.6 → 3.2 / 1.4 ms (sums of 4 profiler blocks). The PC build ran smoothly after it.
Decision record:
Docs/adr/2026-11-22-pcvr-shadows-lighting.md. Technical:Docs/world-lighting.md→ "Shadows and darkness".Why
How to test manually
PCVR build (quality High / URP-HighFidelity, the Standalone default). In the Editor, switch to quality "High" first; the Editor uses Low.
Tested so far: in the editor (G2 Khorinis day and night, quality High) and in a PC build with the keyboard/mouse VR simulator. Not tested with a headset yet, and nothing on Quest 2 or Quest 3 standalone.
Save/load
No new saved state. The sun follows the loaded game time; both options live in Gothic.ini.
Known gaps / follow-ups