summaryrefslogtreecommitdiff
path: root/src/video_core/swrasterizer
diff options
context:
space:
mode:
authorGravatar bunnei2017-09-05 10:00:49 -0400
committerGravatar GitHub2017-09-05 10:00:49 -0400
commitff4941fb3a1a839033a27d6341d6212cd83de691 (patch)
tree7987ce9807dbc35b573439407cbe4ebb8e243163 /src/video_core/swrasterizer
parentMerge pull request #2831 from Subv/uds_auth (diff)
parentpica/lighting: only apply Fresnel factor for the last light (diff)
downloadyuzu-ff4941fb3a1a839033a27d6341d6212cd83de691.tar.gz
yuzu-ff4941fb3a1a839033a27d6341d6212cd83de691.tar.xz
yuzu-ff4941fb3a1a839033a27d6341d6212cd83de691.zip
Merge pull request #2914 from wwylele/fresnel-fix
pica/lighting: only apply Fresnel factor for the last light
Diffstat (limited to 'src/video_core/swrasterizer')
-rw-r--r--src/video_core/swrasterizer/lighting.cpp7
1 files changed, 4 insertions, 3 deletions
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