Fix #112802: EEVEE-Next: Invalid weight when mixing closures

This was caused by a weight of 0 leading to `x = 0 / 0` which
resulted in NaNs and missing closure data.

Pull Request: https://projects.blender.org/blender/blender/pulls/112855
This commit is contained in:
Clément Foucault 2023-09-25 15:14:45 +02:00 committed by Clément Foucault
parent 6b53fd5cf6
commit f2fb74d30c
1 changed files with 3 additions and 0 deletions

View File

@ -32,6 +32,9 @@ float g_volume_absorption_rand;
*/
bool closure_select(float weight, inout float total_weight, inout float r)
{
if (weight < 1e-5) {
return false;
}
total_weight += weight;
float x = weight / total_weight;
bool chosen = (r < x);