Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Castilla <manzanillawork@gmail.com>2021-10-15 21:01:30 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-10-15 23:23:21 +0300
commit5b9a911c4b3c888e80e314a987e34642eb317310 (patch)
tree11d8ddf4aeee70238cc8b21268c6d152c2428e1c /source/blender/compositor/operations/COM_SunBeamsOperation.cc
parent88d295f95260f063d65e23460d36eb13bb884fa8 (diff)
Fix T72583: Sun Beams node artifacts
The artifacts are due to the loss of precision when doing some calculations with float precision.
Diffstat (limited to 'source/blender/compositor/operations/COM_SunBeamsOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_SunBeamsOperation.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc
index b673a1ac754..38e9599f7e6 100644
--- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc
+++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc
@@ -127,9 +127,9 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator {
buffer_to_sector(source, co[0], co[1], pu, pv);
/* line angle */
- float tan_phi = pv / pu;
- float dr = sqrtf(tan_phi * tan_phi + 1.0f);
- float cos_phi = 1.0f / dr;
+ double tan_phi = pv / (double)pu;
+ double dr = sqrt(tan_phi * tan_phi + 1.0);
+ double cos_phi = 1.0 / dr;
/* clamp u range to avoid influence of pixels "behind" the source */
float umin = max_ff(pu - cos_phi * dist_min, 0.0f);
@@ -143,7 +143,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator {
sector_to_buffer(source, end, (int)ceilf(v), x, y);
- falloff_factor = dist_max > dist_min ? dr / (float)(dist_max - dist_min) : 0.0f;
+ falloff_factor = dist_max > dist_min ? dr / (double)(dist_max - dist_min) : 0.0f;
float *iter = input->get_buffer() + input->get_coords_offset(x, y);
return iter;