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:
authorJeroen Bakker <jeroen@blender.org>2022-05-10 16:52:28 +0300
committerJeroen Bakker <jeroen@blender.org>2022-05-10 16:52:28 +0300
commitd9d81cb1ffa964439630963cd4cd504137c91d20 (patch)
treedd91b2234beb366f7e5101600623e365bd7ea46e
parentb4b85c5ce2752ea9241cbcfa1ddc3f639ad64262 (diff)
3d texture painting: Use center uv pixel as anchor.
Previously the bottom left of a pixel was used during pixel extraction what resulted in that the pixels were moved a bit to the bottom left. By using the center uv pixel the extracted pixels are more balanced and would improve future features like seam bleeding.
-rw-r--r--source/blender/blenkernel/intern/pbvh_pixels.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc
index 5623cac44ac..9ea7f991677 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -26,7 +26,7 @@ namespace blender::bke::pbvh::pixels {
* During debugging this check could be enabled.
* It will write to each image pixel that is covered by the PBVH.
*/
-constexpr bool USE_WATERTIGHT_CHECK = false;
+constexpr bool USE_WATERTIGHT_CHECK = true;
/**
* Calculate the delta of two neighbor UV coordinates in the given image buffer.
@@ -71,7 +71,7 @@ static void extract_barycentric_pixels(UDIMTilePixels &tile_data,
int x;
for (x = minx; x < maxx; x++) {
- float2 uv(float(x) / image_buffer->x, float(y) / image_buffer->y);
+ float2 uv((float(x) + 0.5f) / image_buffer->x, (float(y) + 0.5f) / image_buffer->y);
float3 barycentric_weights;
barycentric_weights_v2(uvs[0], uvs[1], uvs[2], uv, barycentric_weights);