DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
306 stars 60 forks source link

Good lightmap data unnecessarily tainted by bad deluxemaps #1424

Open slipher opened 2 weeks ago

slipher commented 2 weeks ago

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 commented 2 weeks ago

https://github.com/Unvanquished/Unvanquished/issues/2908 is the reference for the mapping pipeline producing bad deluxemaps.