summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp9
-rw-r--r--src/video_core/swrasterizer/lighting.cpp7
2 files changed, 9 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 3f390491a..b5f359da6 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -750,7 +750,8 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) {
750 } 750 }
751 751
752 // Fresnel 752 // Fresnel
753 if (lighting.lut_fr.enable && 753 // Note: only the last entry in the light slots applies the Fresnel factor
754 if (light_index == lighting.src_num - 1 && lighting.lut_fr.enable &&
754 LightingRegs::IsLightingSamplerSupported(lighting.config, 755 LightingRegs::IsLightingSamplerSupported(lighting.config,
755 LightingRegs::LightingSampler::Fresnel)) { 756 LightingRegs::LightingSampler::Fresnel)) {
756 // Lookup fresnel LUT value 757 // Lookup fresnel LUT value
@@ -759,17 +760,17 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) {
759 lighting.lut_fr.type, lighting.lut_fr.abs_input); 760 lighting.lut_fr.type, lighting.lut_fr.abs_input);
760 value = "(" + std::to_string(lighting.lut_fr.scale) + " * " + value + ")"; 761 value = "(" + std::to_string(lighting.lut_fr.scale) + " * " + value + ")";
761 762
762 // Enabled for difffuse lighting alpha component 763 // Enabled for diffuse lighting alpha component
763 if (lighting.fresnel_selector == LightingRegs::LightingFresnelSelector::PrimaryAlpha || 764 if (lighting.fresnel_selector == LightingRegs::LightingFresnelSelector::PrimaryAlpha ||
764 lighting.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) { 765 lighting.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
765 out += "diffuse_sum.a *= " + value + ";\n"; 766 out += "diffuse_sum.a = " + value + ";\n";
766 } 767 }
767 768
768 // Enabled for the specular lighting alpha component 769 // Enabled for the specular lighting alpha component
769 if (lighting.fresnel_selector == 770 if (lighting.fresnel_selector ==
770 LightingRegs::LightingFresnelSelector::SecondaryAlpha || 771 LightingRegs::LightingFresnelSelector::SecondaryAlpha ||
771 lighting.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) { 772 lighting.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
772 out += "specular_sum.a *= " + value + ";\n"; 773 out += "specular_sum.a = " + value + ";\n";
773 } 774 }
774 } 775 }
775 776
diff --git a/src/video_core/swrasterizer/lighting.cpp b/src/video_core/swrasterizer/lighting.cpp
index b38964530..5fa748611 100644
--- a/src/video_core/swrasterizer/lighting.cpp
+++ b/src/video_core/swrasterizer/lighting.cpp
@@ -230,7 +230,8 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(
230 d1_lut_value * refl_value * light_config.specular_1.ToVec3f(); 230 d1_lut_value * refl_value * light_config.specular_1.ToVec3f();
231 231
232 // Fresnel 232 // Fresnel
233 if (lighting.config1.disable_lut_fr == 0 && 233 // Note: only the last entry in the light slots applies the Fresnel factor
234 if (light_index == lighting.max_light_index && lighting.config1.disable_lut_fr == 0 &&
234 LightingRegs::IsLightingSamplerSupported(lighting.config0.config, 235 LightingRegs::IsLightingSamplerSupported(lighting.config0.config,
235 LightingRegs::LightingSampler::Fresnel)) { 236 LightingRegs::LightingSampler::Fresnel)) {
236 237
@@ -242,14 +243,14 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(
242 if (lighting.config0.fresnel_selector == 243 if (lighting.config0.fresnel_selector ==
243 LightingRegs::LightingFresnelSelector::PrimaryAlpha || 244 LightingRegs::LightingFresnelSelector::PrimaryAlpha ||
244 lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) { 245 lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
245 diffuse_sum.a() *= lut_value; 246 diffuse_sum.a() = lut_value;
246 } 247 }
247 248
248 // Enabled for the specular lighting alpha component 249 // Enabled for the specular lighting alpha component
249 if (lighting.config0.fresnel_selector == 250 if (lighting.config0.fresnel_selector ==
250 LightingRegs::LightingFresnelSelector::SecondaryAlpha || 251 LightingRegs::LightingFresnelSelector::SecondaryAlpha ||
251 lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) { 252 lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) {
252 specular_sum.a() *= lut_value; 253 specular_sum.a() = lut_value;
253 } 254 }
254 } 255 }
255 256