[Bf-blender-cvs] [d9d81cb1ffa] master: 3d texture painting: Use center uv pixel as anchor.

Jeroen Bakker noreply at git.blender.org
Tue May 10 15:54:50 CEST 2022


Commit: d9d81cb1ffa964439630963cd4cd504137c91d20
Author: Jeroen Bakker
Date:   Tue May 10 15:52:28 2022 +0200
Branches: master
https://developer.blender.org/rBd9d81cb1ffa964439630963cd4cd504137c91d20

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.

===================================================================

M	source/blender/blenkernel/intern/pbvh_pixels.cc

===================================================================

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);



More information about the Bf-blender-cvs mailing list