SoftGPU: Quantize fog per vertex, like the GE

The GE converts the fog factor to 8 bits per vertex, min(floor(256 * f), 255),
and interpolates that linearly in screen space. Clamping after interpolation
instead was up to 127 levels off on triangles that cross the fog range.
Measured with gpu/probe; points and wacky values still match exactly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-30 17:21:03 -06:00
1 parent 4582308cbf
commit 2e77b62207
3 files changed
+19 -3

No files matched your search

+1 -1
View File
@@ -523,7 +523,7 @@ ClipVertexData TransformUnit::ReadVertex(const VertexReader &vreader, const Tran
}
if (state.enableFog) {
vertex.v.fogdepth = Dot43(state.posToFog, pos);
vertex.v.fogdepth = GEFogFactor(Dot43(state.posToFog, pos)) * (1.0f / 256.0f);
} else {
vertex.v.fogdepth = 1.0f;
}