mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix: EEVEE: Undefined behavior in view_z_to_volume_z
The remaped depth can become negative in the range between the camera near plane and the volume near plane. `log2` is not defined for `x <= 0`. This would cause artifact on Mac where volumes would poke through objects.
This commit is contained in:
parent
9ec4e6bf28
commit
d0ae9292f9
1 changed files with 1 additions and 1 deletions
|
|
@ -51,7 +51,7 @@ float view_z_to_volume_z(float depth, float near, float far, float distribution)
|
|||
{
|
||||
if (drw_view_is_perspective()) {
|
||||
/* Exponential distribution. */
|
||||
return distribution * log2(depth * far + near);
|
||||
return distribution * log2(max(1e-8, depth * far + near));
|
||||
}
|
||||
else {
|
||||
/* Linear distribution. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue