Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Good lightmap data unnecessarily tainted by bad deluxemaps #1424

Open
slipher opened this issue Nov 7, 2024 · 1 comment
Open

Good lightmap data unnecessarily tainted by bad deluxemaps #1424

slipher opened this issue Nov 7, 2024 · 1 comment

Comments

@slipher
Copy link
Member

slipher commented Nov 7, 2024

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
@slipher
Copy link
Member Author

slipher commented Nov 7, 2024

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

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

No branches or pull requests

1 participant