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:
authorSebastian Parborg <darkdefende@gmail.com>2020-05-18 16:50:36 +0300
committerSebastian Parborg <darkdefende@gmail.com>2020-05-18 16:50:36 +0300
commit27cac4a102b917f9045ed4a4682bd8740852458c (patch)
tree858faf0aa0be0ce814ed19d009da5c92366e12a4 /source/blender/render
parentdcf67fdf7f7239c7c1c4fc867541bf7d5da561e6 (diff)
Fix T62422: Baking ray distance do not work
The previous naming scheme for the "selected to active" baking options lead to confusion and they were not describing what they actually did. To remedy this, I've added a new settings that does what the older setting implied it did. Reviewed By: Brecht, Dalai, Andy Davies Differential Revision: http://developer.blender.org/D7733
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/RE_bake.h1
-rw-r--r--source/blender/render/intern/source/bake_api.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h
index 59e34404074..3bab9179f84 100644
--- a/source/blender/render/extern/include/RE_bake.h
+++ b/source/blender/render/extern/include/RE_bake.h
@@ -84,6 +84,7 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
const size_t num_pixels,
const bool is_custom_cage,
const float cage_extrusion,
+ const float max_ray_distance,
float mat_low[4][4],
float mat_cage[4][4],
struct Mesh *me_cage);
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index e823a481d59..06f77854595 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -321,11 +321,16 @@ static bool cast_ray_highpoly(BVHTreeFromMesh *treeData,
const float co[3],
const float dir[3],
const int pixel_id,
- const int tot_highpoly)
+ const int tot_highpoly,
+ const float max_ray_distance)
{
int i;
int hit_mesh = -1;
- float hit_distance = FLT_MAX;
+ float hit_distance = max_ray_distance;
+ if (hit_distance == 0.0f) {
+ /* No ray distance set, use maximum. */
+ hit_distance = FLT_MAX;
+ }
BVHTreeRayHit *hits;
hits = MEM_mallocN(sizeof(BVHTreeRayHit) * tot_highpoly, "Bake Highpoly to Lowpoly: BVH Rays");
@@ -520,6 +525,7 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
const size_t num_pixels,
const bool is_custom_cage,
const float cage_extrusion,
+ const float max_ray_distance,
float mat_low[4][4],
float mat_cage[4][4],
struct Mesh *me_cage)
@@ -623,7 +629,8 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low,
co,
dir,
i,
- tot_highpoly)) {
+ tot_highpoly,
+ max_ray_distance)) {
/* if it fails mask out the original pixel array */
pixel_array_from[i].primitive_id = -1;
}