Skip to content

Good lightmap data unnecessarily tainted by bad deluxemaps #1424

Description

@slipher

To quote myself:

<perturbed> the random foggy patches on the windows are caused by deluxe mapping
<perturbed> on station15
<perturbed> with r_deluxeMapping 0, the windows have a more or less uniform opacity
<perturbed> i think it's the transparent parts that are buggy :)
<perturbed> i think it's caused by the useless, lossy round trip with the light color
<perturbed> with deluxemapping off, there's a simple calculation:
<perturbed> color.rgb += lightColor.rgb * diffuse.rgb;
<perturbed> where lightcolor is actually lightcolor * dot(normal, light dir)
<perturbed> with deluxe mapping on, we try to calculate the same thing but with extra, lossy steps
<perturbed> lightColor /= clamp(dot(normalize(var_Normal), lightDir), 0.3, 1.0);
<perturbed> float NdotL = dot( normal, lightDir );
<perturbed> NdotL = clamp( NdotL, 0.0, 1.0 );
<perturbed> color.rgb += lightColor.rgb * NdotL * diffuseColor.rgb;
<perturbed> luckily computeSpecularity is the only place where the lightColor is really used independently, as opposed to lightColor * NdotL
<perturbed> even physical mapping can be done without the lossy calculation

Activity

  1. slipher commented on Nov 7, 2024

    @slipher
    MemberAuthor

    Unvanquished/Unvanquished#2908 is the reference for the mapping pipeline producing bad deluxemaps.

  2. slipher commented on Feb 19, 2026

    @slipher
    MemberAuthor

    I should clarify that the easy fix in the OP only applies to textures with no normal map, such as the textures/shared_trak5/glass discussed there. When there is a normal map, it may make sense to divide out the normal of the original flat triangle and multiply with the one from the normal map.

  3. illwieckz commented on Feb 19, 2026

    @illwieckz
    Member

    the random foggy patches on the windows are caused by deluxe mapping

    Just to clarify: the bug is that the whole surface isn't foggy. The bug is the surface randomly becoming invisible.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions