Objects don't take the light of where they stand: too bright indoors and at night

Open
#488 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, unity

Research direction

Start by reading the C# side of EnableVobWorldLight in #479 and the Lit-World and Lit-SingleMesh lighting paths mentioned here; compare them with the referenced zCVob::CalcStaticLighting behavior. Check how objects obtain their ground polygon and baked light, including the no-floor case. Done means objects reflect their surroundings indoors and at night, and nearby baked lights affect the world as described.

Written by the indexing model from the issue text.

Description

bug
Description
  • Objects ignore the light of their spot. Static objects (tables, beds, kettles) are drawn with Lit-World, but with a flat full base light (no baked light of their own) times the day colour. Items and NPCs use Lit-SingleMesh (sun + ambient). None of them gets the light of the floor they stand on. Indoors and at night they are much brighter than the world around them.
  • The world barely brightens near fires. Static lights are added per vertex, and Gothic's world polygons are large, so a fire in the middle of a room hardly reaches the polygon corners.
Expected Behavior (original engine)
  • Each zCVob has lightColorStat, lightColorDyn, lightDirectionStat and groundPoly. The engine computes the static light per object (zCVob::CalcLightSampleAtOrigin, zCPolygon::GetLightStatAtPos).
  • Enhanced-Gothic-Renderer does the same on top of the original engine (zCVob.h, CalcStaticLighting):
    • a ray down from the bounding box centre onto the ground polygon;
    • the baked light at the hit point (lightmap indoors, vertex light outdoors);
    • grey 160 when there is no floor.
  • Static zCVobLights only exist in the bake (vertex light and lightmaps).
Actual Behavior

See the description. Seen on Quest 3 in G1 and G2 (huts and Khorinis at night). It's the same on PC, since the shaders are the same.

Environment Information

  • Reproducibility: Always
  • Platform: all
  • Game Version: main 83a1aebd2
Notes
Dominant language
C#
Stars
33
Forks
1
Avg merge
1d 17h
Merged PRs (30d)
51

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gothic-Unity-Project/Gothic-Unity

All issues in Gothic-Unity-Project/Gothic-Unity

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.