diff options
author | Martijn Versteegh <Baardaap> | 2022-01-17 20:00:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-01-17 21:36:13 +0300 |
commit | 449db0ab1e34976f3936310b846ab38cc2d6467d (patch) | |
tree | a0eb26c834c1a6b89e5461d219c042abde200b5f /source/blender/makesrna/intern/rna_scene.c | |
parent | 8af22719d0c98e24104d01089ecb0cff840df7e8 (diff) |
Baking: new method to generate margin, based on adjacent faces
This significantly reduces discontinuities on UV seams, by giving a better
match of the texture filtered colors on both sides of the seam. It works by
using pixels from adjacent faces across the UV seam.
This new option is called "Adjacent Faces" and is the default. The old option
is called "Extend", and extends border pixels outwards.
Differential Revision: https://developer.blender.org/D13303
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2cda19737da..5bfbd42866b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -432,6 +432,16 @@ const EnumPropertyItem rna_enum_normal_swizzle_items[] = { {0, NULL, 0, NULL, NULL}, }; +const EnumPropertyItem rna_enum_bake_margin_type_items[] = { + {R_BAKE_ADJACENT_FACES, + "ADJACENT_FACES", + 0, + "Adjacent Faces", + "Use pixels from adjacent faces across UV seams"}, + {R_BAKE_EXTEND, "EXTEND", 0, "Extend", "Extend border pixels outwards"}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_bake_target_items[] = { {R_BAKE_TARGET_IMAGE_TEXTURES, "IMAGE_TEXTURES", @@ -5055,6 +5065,11 @@ static void rna_def_bake_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "margin_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_bake_margin_type_items); + RNA_def_property_ui_text(prop, "Margin Type", "Algorithm to extend the baked result"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "max_ray_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3); @@ -5846,6 +5861,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem bake_margin_type_items[] = { + {R_BAKE_ADJACENT_FACES, + "ADJACENT_FACES", + 0, + "Adjacent Faces", + "Use pixels from adjacent faces across UV seams"}, + {R_BAKE_EXTEND, "EXTEND", 0, "Extend", "Extend border pixels outwards"}, + {0, NULL, 0, NULL, NULL}, + }; + static const EnumPropertyItem pixel_size_items[] = { {0, "AUTO", 0, "Automatic", "Automatic pixel size, depends on the user interface scale"}, {1, "1", 0, "1x", "Render at full resolution"}, @@ -6261,11 +6286,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "bake_margin", PROP_INT, PROP_PIXEL); - RNA_def_property_int_sdna(prop, NULL, "bake_filter"); + RNA_def_property_int_sdna(prop, NULL, "bake_margin"); RNA_def_property_range(prop, 0, 64); RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "bake_margin_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "bake_margin_type"); + RNA_def_property_enum_items(prop, bake_margin_type_items); + RNA_def_property_ui_text(prop, "Margin Type", "Algorithm to generate the margin"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_biasdist"); RNA_def_property_range(prop, 0.0, 1000.0); |