mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Lighter: No specular from a light behind the surface
The shaders and the software renderer only add specular when N.L >= 0, as the GE does (gpu/lighting/specular); the CPU lighter, used for points, lines and rectangles, didn't check. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
d7a96875fb
commit
48f3d5c907
1 file changed
+3
-1
@@ -117,6 +117,8 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[
|
||||
toLight /= distanceToLight;
|
||||
dot = Dot(toLight, norm);
|
||||
}
|
||||
// Specular only applies when the light is in front of the surface.
|
||||
const bool facingLight = dot >= 0.0f;
|
||||
// Clamp dot to zero.
|
||||
if (dot < 0.0f) dot = 0.0f;
|
||||
|
||||
@@ -151,7 +153,7 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[
|
||||
// Better specular
|
||||
// Vec3f toViewer = (viewer - pos).NormalizedOr001(cpu_info.bSSE4_1);
|
||||
|
||||
if (doSpecular) {
|
||||
if (doSpecular && facingLight) {
|
||||
Vec3f halfVec = (toLight + toViewer).NormalizedOr001(cpu_info.bSSE4_1);
|
||||
|
||||
dot = Dot(halfVec, norm);
|
||||
|
||||
Reference in new issue
Block a user