diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-28 15:55:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-28 15:55:41 +0400 |
commit | fe6c45e36e4fae22bbddbf3e51c7d1fca03c3c1a (patch) | |
tree | 31233740f13c5d32fc9791234197a03bd60ad510 /source/blender/blenlib/intern/math_color_inline.c | |
parent | 753fe9f0b970c83d253a79f4b12a13d3cc5f5fad (diff) |
Fix #34233: bad alpha blending for 3D texture painting. Same changes as the
previous fix for 2D image painting were done, and also:
* For brushes that do masking (keeping the max contribution to a pixel limited),
the alpha from textures is now part of the mask. In many cases the logic
worked out the same and where it didn't it used to cause artifacts.
* Color interpolation for smear and soften tools now happens in premultipied
space, to avoid bleeding of RGB colors from zero alpha areas.
* Fix a few cases where byte <=> float conversion was not doing the proper
straight <=> premul conversion.
* Replace some float division by constants with multiplications, is faster.
Note: float texture painting seems to have some issues updating the OpenGL
texture, but issue was already there before this commit.
Diffstat (limited to 'source/blender/blenlib/intern/math_color_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_color_inline.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index e9a1c0abc38..bef4e5adaaa 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -309,8 +309,8 @@ MINLINE void straight_to_premul_v4(float color[4]) MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4]) { - float alpha = color[3] / 255.0f; - float fac = alpha / 255.0f; + float alpha = color[3] * (1.0f / 255.0f); + float fac = alpha * (1.0f / 255.0f); result[0] = color[0] * fac; result[1] = color[1] * fac; |