Baking: support vertex color baking of normal material, UV discontinuities

Baking vertex colors per-corner leads to unwanted discontinuities when there is
sampling noise, for example in ambient occlusion or with a bevel shader node for
normals. For this reason the code used to always average results per-vertex.

However when using split normals, multiple materials or UV islands, we do want to
preserve discontinuities. So now bake per corner, but make sure the sampling seed
is shared for vertices.

Fix T85550: vertex color baking crash with split normals, Ref D10399
Fix T84663: vertex color baking blending at UV seams
This commit is contained in:
2021-02-11 18:48:21 +01:00
parent 9fa6e06287
commit 9febda912b
5 changed files with 66 additions and 33 deletions

View File

@@ -194,7 +194,7 @@ static RenderResult *render_result_from_bake(RenderEngine *engine, int x, int y,
primitive[1] = int_as_float(-1);
}
else {
primitive[0] = int_as_float(bake_pixel->object_id);
primitive[0] = int_as_float(bake_pixel->seed);
primitive[1] = int_as_float(bake_pixel->primitive_id);
primitive[2] = bake_pixel->uv[0];
primitive[3] = bake_pixel->uv[1];