From a6fd2c8227d616ad1b1da902877e2fd23c37dc04 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 7 Aug 2013 14:22:15 +0200 Subject: [PATCH] fix lightning for inconsitent config It's possible to configure to use the vertex color as lightning source without enabling the vertex color at all. The old implementation will use zero, but it seems to be wrong (prooven by THPS3), more likely is to disable the lightning and just return the global color. This fixes THPS3 on OpenGL, but it isn't verifed on hardware --- Source/Core/VideoCommon/Src/LightingShaderGen.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/Src/LightingShaderGen.h b/Source/Core/VideoCommon/Src/LightingShaderGen.h index 031dce44bd..b7f596bdd3 100644 --- a/Source/Core/VideoCommon/Src/LightingShaderGen.h +++ b/Source/Core/VideoCommon/Src/LightingShaderGen.h @@ -150,7 +150,10 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com else if (components & VB_HAS_COL0 ) object.Write("lacc = %s0;\n", inColorName); else - object.Write("lacc = float4(0.0f, 0.0f, 0.0f, 0.0f);\n"); + // TODO: this isn't verified. Here we want to read the ambient from the vertex, + // but the vertex itself has no color. So we don't know which value to read. + // Returing 1.0 is the same as disabled lightning, so this could be fine + object.Write("lacc = float4(1.0f, 1.0f, 1.0f, 1.0f);\n"); } else // from color { @@ -191,7 +194,8 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com else if (components & VB_HAS_COL0 ) object.Write("lacc.w = %s0.w;\n", inColorName); else - object.Write("lacc.w = 0.0f;\n"); + // TODO: The same for alpha: We want to read from vertex, but the vertex has no color + object.Write("lacc.w = 1.0f;\n"); } else // from color {