Fix #109302: baking UDIM displacement normalization wrong #109409

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:109302 into main 2023-06-28 14:58:59 +02:00
1 changed files with 5 additions and 5 deletions

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;

The loop below needs to be changed to:

for (i = 0; i < tot_thread; i++) {
The loop below needs to be changed to: ``` for (i = 0; i < tot_thread; i++) { ```
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;

This should be outside the loop over images, otherwise it will use the height from the last image for all images.

This should be outside the loop over images, otherwise it will use the height from the last image for all images.

Yeah, I stumbled over this as well, but left it alone because this was always the case afaict and would mean a change in behavior (a good one though, so will change...)

Yeah, I stumbled over this as well, but left it alone because this was always the case afaict and would mean a change in behavior (a good one though, so will change...)
for (link = static_cast<LinkData *>(bkr->image.first); link; link = link->next) {
Image *ima = (Image *)link->data;