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:
parent
1db3e26c74
commit
811371a6bd
Notes:
blender-bot
2023-02-14 06:54:28 +01:00
Referenced by issue #96977, TODO: set the default margin generation back to extend for the baking of normals in tangent space. Referenced by issue #96942, Bake Normal problem when adjoining faces have different UV orientation
|
@ -1916,13 +1916,20 @@ class CYCLES_RENDER_PT_bake_output_margin(CyclesButtonsPanel, Panel):
|
|||
cbk = scene.render.bake
|
||||
rd = scene.render
|
||||
|
||||
if rd.use_bake_multires:
|
||||
layout.prop(rd, "bake_margin_type", text="Type")
|
||||
layout.prop(rd, "bake_margin", text="Size")
|
||||
if (cscene.bake_type == 'NORMAL' and cbk.normal_space == 'TANGENT') or cscene.bake_type == 'UV':
|
||||
if rd.use_bake_multires:
|
||||
layout.prop(rd, "bake_margin", text="Size")
|
||||
else:
|
||||
if cbk.target == 'IMAGE_TEXTURES':
|
||||
layout.prop(cbk, "margin", text="Size")
|
||||
else:
|
||||
if cbk.target == 'IMAGE_TEXTURES':
|
||||
layout.prop(cbk, "margin_type", text="Type")
|
||||
layout.prop(cbk, "margin", text="Size")
|
||||
if rd.use_bake_multires:
|
||||
layout.prop(rd, "bake_margin_type", text="Type")
|
||||
layout.prop(rd, "bake_margin", text="Size")
|
||||
else:
|
||||
if cbk.target == 'IMAGE_TEXTURES':
|
||||
layout.prop(cbk, "margin_type", text="Type")
|
||||
layout.prop(cbk, "margin", text="Size")
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue