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.
This commit is contained in:
Jeroen Bakker 2022-05-10 15:52:28 +02:00
parent b4b85c5ce2
commit d9d81cb1ff
1 changed files with 2 additions and 2 deletions

View File

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