Skip to content

Commit

Permalink
Merge pull request #82546 from viksl/volumetric-fog-spot-light-artifacts
Browse files Browse the repository at this point in the history
Fix cluster artifacts and negative light
  • Loading branch information
akien-mga committed Oct 5, 2023
2 parents 1edf0f3 + 8a2d345 commit 950139e
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -576,8 +576,9 @@ void main() {
float attenuation = get_omni_attenuation(d, spot_lights.data[light_index].inv_radius, spot_lights.data[light_index].attenuation);

vec3 spot_dir = spot_lights.data[light_index].direction;
float scos = max(dot(-normalize(light_rel_vec), spot_dir), spot_lights.data[light_index].cone_angle);
float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - spot_lights.data[light_index].cone_angle));
highp float cone_angle = spot_lights.data[light_index].cone_angle;
float scos = max(dot(-normalize(light_rel_vec), spot_dir), cone_angle);
float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - cone_angle));
attenuation *= 1.0 - pow(spot_rim, spot_lights.data[light_index].cone_attenuation);

vec3 light = spot_lights.data[light_index].color;
Expand Down

0 comments on commit 950139e

Please sign in to comment.