Fix T96942: disable Adjacent Faces margin for UVs and tangent space bake

Use the Extend method for these, as these do not work correctly. For UVs
it's better to extend the UVs from the same face, and for tangent space
the normals should be encoded in a matching tangent space.

Later the Adjacent Faces method might be improved to support these cases.

Ref T96977

Differential Revision: https://developer.blender.org/D14572
This commit is contained in:
Martijn Versteegh
2022-04-08 17:43:44 +02:00
committed by Brecht Van Lommel
parent 1db3e26c74
commit 811371a6bd
3 changed files with 30 additions and 8 deletions

View File

@@ -359,7 +359,12 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
/* copy data stored in job descriptor */
bkr.scene = scene;
bkr.bake_margin = scene->r.bake_margin;
bkr.bake_margin_type = scene->r.bake_margin_type;
if (scene->r.bake_mode == RE_BAKE_NORMALS) {
bkr.bake_margin_type = R_BAKE_EXTEND;
}
else {
bkr.bake_margin_type = scene->r.bake_margin_type;
}
bkr.mode = scene->r.bake_mode;
bkr.use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
bkr.bias = scene->r.bake_biasdist;
@@ -404,7 +409,12 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
/* backup scene settings, so their changing in UI would take no effect on baker */
bkj->scene = scene;
bkj->bake_margin = scene->r.bake_margin;
bkj->bake_margin_type = scene->r.bake_margin_type;
if (scene->r.bake_mode == RE_BAKE_NORMALS) {
bkj->bake_margin_type = R_BAKE_EXTEND;
}
else {
bkj->bake_margin_type = scene->r.bake_margin_type;
}
bkj->mode = scene->r.bake_mode;
bkj->use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
bkj->bake_clear = scene->r.bake_flag & R_BAKE_CLEAR;

View File

@@ -1670,6 +1670,11 @@ static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
if (bkr->save_mode == R_BAKE_SAVE_EXTERNAL) {
bkr->save_mode = R_BAKE_SAVE_INTERNAL;
}
if (((bkr->pass_type == SCE_PASS_NORMAL) && (bkr->normal_space == R_BAKE_SPACE_TANGENT)) ||
bkr->pass_type == SCE_PASS_UV) {
bkr->margin_type = R_BAKE_EXTEND;
}
}
static int bake_exec(bContext *C, wmOperator *op)