diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-02-23 20:44:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-02-24 21:35:36 +0300 |
commit | 0781c22ceedc6700a073c620723270d32b2f2852 (patch) | |
tree | d85bf340ce3d325adada7b9a371a2c367ae89f33 /source/blender/editors/object/object_bake_api.c | |
parent | 6e396e21e666d4c614ded626455011b5a5011b1d (diff) |
Fix T95969, T91856: bake AO to vertex color artifacts after ray offset removal
Without ray offsets intersections at neigbhoring triangles are found, as
the ray start is exactly at the vertex. There was a small offset towards
the center of the triangle, but not enough.
Now this offset computation is moved into Cycles and modified for better
results. It's still not perfect though like any offset approach, especially
with long thin triangles.
Additionaly, this uses the shadow terminate offset for AO rays now, which
helps remove some pre-existing artifacts.
Diffstat (limited to 'source/blender/editors/object/object_bake_api.c')
-rw-r--r-- | source/blender/editors/object/object_bake_api.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index f52d2103fff..cef99017b9c 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -1054,19 +1054,18 @@ static void bake_targets_populate_pixels_vertex_colors(BakeTargets *targets, * materials and UVs. */ pixel->seed = v; - /* Barycentric coordinates, nudged a bit to avoid precision issues that - * may happen when exactly at the vertex coordinate. */ + /* Barycentric coordinates. */ if (j == 0) { - pixel->uv[0] = 1.0f - FLT_EPSILON; - pixel->uv[1] = FLT_EPSILON / 2.0f; + pixel->uv[0] = 1.0f; + pixel->uv[1] = 0.0f; } else if (j == 1) { - pixel->uv[0] = FLT_EPSILON / 2.0f; - pixel->uv[1] = 1.0f - FLT_EPSILON; + pixel->uv[0] = 0.0f; + pixel->uv[1] = 1.0f; } else if (j == 2) { - pixel->uv[0] = FLT_EPSILON / 2.0f; - pixel->uv[1] = FLT_EPSILON / 2.0f; + pixel->uv[0] = 0.0f; + pixel->uv[1] = 0.0f; } } } |