Fix #109302: baking UDIM displacement normalization wrong

Since UDIM baking support in 6787cc13d4, the normalization of
diplacement heights was always based on the min/max height detected in
the _last_ tile, which could lead to clipping if the last tile had very
subtle (or no) displacement.

Now getting the min/max is spread across all images.
This also takes the first thread into account for getting the min/max (which for some reason was skipped).

Pull Request: https://projects.blender.org/blender/blender/pulls/109409
This commit is contained in:
Philipp Oeser
2023-06-28 14:58:52 +02:00
committed by Philipp Oeser
parent ab215965c6
commit 128c95438f

View File

@@ -611,11 +611,7 @@ static void do_multires_bake(MultiresBakeRender *bkr,
do_multires_bake_thread(&handles[0]);
}
/* construct bake result */
result->height_min = handles[0].height_min;
result->height_max = handles[0].height_max;
for (i = 1; i < tot_thread; i++) {
for (i = 0; i < tot_thread; i++) {
result->height_min = min_ff(result->height_min, handles[i].height_min);
result->height_max = max_ff(result->height_max, handles[i].height_max);
}
@@ -1472,6 +1468,10 @@ static void bake_images(MultiresBakeRender *bkr, MultiresBakeResult *result)
{
LinkData *link;
/* construct bake result */
result->height_min = FLT_MAX;
result->height_max = -FLT_MAX;
for (link = static_cast<LinkData *>(bkr->image.first); link; link = link->next) {
Image *ima = (Image *)link->data;