lighting: compute highlight clamp after one-/two-sided diffuse pass
This commit is contained in:
parent
33a0e87ac2
commit
0d6db4a0b3
2 changed files with 21 additions and 24 deletions
|
@ -256,22 +256,16 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(
|
|||
}
|
||||
|
||||
auto dot_product = Math::Dot(light_vector, normal);
|
||||
|
||||
// Calculate clamp highlights before applying the two-sided diffuse configuration to the dot
|
||||
// product.
|
||||
float clamp_highlights = 1.0f;
|
||||
if (lighting.config0.clamp_highlights) {
|
||||
if (dot_product <= 0.0f)
|
||||
clamp_highlights = 0.0f;
|
||||
else
|
||||
clamp_highlights = 1.0f;
|
||||
}
|
||||
|
||||
if (light_config.config.two_sided_diffuse)
|
||||
dot_product = std::abs(dot_product);
|
||||
else
|
||||
dot_product = std::max(dot_product, 0.0f);
|
||||
|
||||
float clamp_highlights = 1.0f;
|
||||
if (lighting.config0.clamp_highlights) {
|
||||
clamp_highlights = dot_product == 0.0f ? 0.0f : 1.0f;
|
||||
}
|
||||
|
||||
if (light_config.config.geometric_factor_0 || light_config.config.geometric_factor_1) {
|
||||
float geo_factor = half_vector.Length2();
|
||||
geo_factor = geo_factor == 0.0f ? 0.0f : std::min(dot_product / geo_factor, 1.0f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue