Skip to content

WIP: lightMapping: blend a bit the normal map with the deluxe map#1906

Open
illwieckz wants to merge 1 commit intomasterfrom
illwieckz/blend-normal
Open

WIP: lightMapping: blend a bit the normal map with the deluxe map#1906
illwieckz wants to merge 1 commit intomasterfrom
illwieckz/blend-normal

Conversation

@illwieckz
Copy link
Member

HACK: blend a bit the normal map with the deluxe map to make the normal map align with the deluxe map to prevent NdotL collapsing to zero, while retaining enough normal details.

See: #1905

Disclosure: the blend trick was suggested by an LLM (ChatGPT) in a “discussion” with it where I described the visual look of the bug.

The trick works but that can be pure AI overconfident bullshit. Here are the « explanations » provided :

  • High-frequency normal maps locally rotate the surface normal away from the smooth underlying surface.
  • The baked direction [what we call deluxe maps] corresponds to the smooth underlying geometry, not the bumped normal.
  • Therefore, in some pixels the dot product between the bumped normal and the baked direction can be very small or even negative: dot(normalMapNormal, bakedNormal)≈0 or negative
  • This is not a bug in your code — it’s a physical consequence of combining a high-frequency normal with a low-frequency baked direction.

HACK: blend a bit the normal map with the deluxe map to make the normal
map align with the deluxe map to prevent NdotL collapsing to zero, while
retaining enough normal details.

See: #1905
@illwieckz
Copy link
Member Author

illwieckz commented Feb 19, 2026

  • Xonotic map xoylent, setviewpos 1100 30 880 170 40

Deluxe:

unvanquished_2026-02-19_050205_000

Normal:

unvanquished_2026-02-19_103411_000

Normal (as input for computeDeluxeLight()):

unvanquished_2026-02-19_053756_000

LightDir (as input for computeDeluxeLight()):

unvanquished_2026-02-19_053901_000

Blended Normal + LightDir (what this branch computes):

unvanquished_2026-02-19_100815_000


Deluxe mapping disabled:

unvanquished_2026-02-19_042403_000

Deluxe mapping enabled, before:

unvanquished_2026-02-19_042345_000

Deluxe mapping enabled, after:

unvanquished_2026-02-19_100831_000

@illwieckz
Copy link
Member Author

illwieckz commented Feb 19, 2026

This interacts with :

This cannot fix the bad baked data, but that can prevent translucent surface to become invisible.

  • Unvanquished map station15, setviewpos 1420 -1130 101 -40 0

Deluxe (broken):

unvanquished_2026-02-19_102138_000

Normal (correct):

unvanquished_2026-02-19_102114_000

Before:

unvanquished_2026-02-19_102007_000

(The fact the translucent surface is very opaque is a side effect of the linear pipeline and is unrelated to the deluxe mapping bug demonstrated, the shader has to be tweaked for the linear pipeline).

After:

unvanquished_2026-02-19_102223_000

@illwieckz
Copy link
Member Author

illwieckz commented Feb 19, 2026

This can also attenuate glitches caused by broken normals, like this model used in the Vega map that has broken normals.

  • Unvanquished map vega, setviewpos 1990 460 115 -120 10

Deluxe (correct):

unvanquished_2026-02-19_102715_000

Normal (broken):

unvanquished_2026-02-19_103113_000

Before:

unvanquished_2026-02-19_102549_000

After:

unvanquished_2026-02-19_102752_000

@slipher
Copy link
Member

slipher commented Feb 19, 2026

It has a general effect of making everything brighter. Some of the worse casualties from my test suite (before/after):

  • The bolts look flattened out:
    unvanquished-parpax-patch-seam
    unvanquished-parpax-patch-seam

  • The lower parts of the floor grate that aren't really supposed to be visible are lit up (note: heightmapping is off):
    unvanquished-plat23-grate-aliasing
    unvanquished-plat23-grate-aliasing

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments