Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Versteegh <Baardaap>2022-01-17 20:00:35 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-01-17 21:36:13 +0300
commit449db0ab1e34976f3936310b846ab38cc2d6467d (patch)
treea0eb26c834c1a6b89e5461d219c042abde200b5f /source/blender/render/intern/bake.c
parent8af22719d0c98e24104d01089ecb0cff840df7e8 (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/render/intern/bake.c')
-rw-r--r--source/blender/render/intern/bake.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c
index 2d7f964a968..93d2f721cc5 100644
--- a/source/blender/render/intern/bake.c
+++ b/source/blender/render/intern/bake.c
@@ -83,6 +83,7 @@
#include "IMB_imbuf_types.h"
#include "RE_bake.h"
+#include "RE_texture_margin.h"
/* local include */
#include "render_types.h"
@@ -154,10 +155,24 @@ void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, c
}
}
-void RE_bake_margin(ImBuf *ibuf, char *mask, const int margin)
+void RE_bake_margin(ImBuf *ibuf,
+ char *mask,
+ const int margin,
+ const char margin_type,
+ Mesh const *me,
+ char const *uv_layer)
{
/* margin */
- IMB_filter_extend(ibuf, mask, margin);
+ switch (margin_type) {
+ case R_BAKE_ADJACENT_FACES:
+ RE_generate_texturemargin_adjacentfaces(ibuf, mask, margin, me, uv_layer);
+ break;
+ default:
+ /* fall through */
+ case R_BAKE_EXTEND:
+ IMB_filter_extend(ibuf, mask, margin);
+ break;
+ }
if (ibuf->planes != R_IMF_PLANES_RGBA) {
/* clear alpha added by filtering */