SoftGPU: A zero normal gets no diffuse or specular

It used (0, 0, 1) instead. The PSP keeps it zero, under every light kind
and type (gpu/probe exp173). SOCOM (UCES01242) lights meshes whose s8
normals are all zero; its PSP replay becomes exact.

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-10-02 15:09:43 -06:00
1 parent 0357baf1b7
commit ecaa961850
1 file changed
+3 -1
+3 -1
View File
@@ -537,9 +537,11 @@ ClipVertexData TransformUnit::ReadVertex(const VertexReader &vreader, const Tran
const float len2 = GEDot(worldnormal, worldnormal);
if (len2 > 0.0f && std::isfinite(len2)) {
normalRsqrt = GERsqrt(len2);
} else {
} else if (len2 != 0.0f) {
worldnormal = Vec3f(0.0f, 0.0f, 1.0f);
}
// A zero normal stays zero: no diffuse or specular from any light (gpu/probe exp173; SOCOM
// UCES01242 has meshes without normals but lit).
}
// Time to generate some texture coords. Lighting will handle shade mapping.