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:
authorHans Goudey <h.goudey@me.com>2022-03-22 00:55:55 +0300
committerHans Goudey <h.goudey@me.com>2022-03-22 00:55:55 +0300
commit3a8a7d93f9271935ac28d19b26aff0a671b65551 (patch)
tree00f3a2bd161eab2c15997cfac080a92e5c7d7995
parent923b28aab85768e2b4aff89494c321028252cf1e (diff)
Fix T96401: Broken multires baked normals result
A 7 year old commit, 2ec00ea0c1be1ace7c, used incorrect indexing for the optional array of precomputed poly normals. Apparently that code path was never used, or this issue would have been discovered earlier. Recent changes calculate normals on a temporary mesh and use those for the "low-res" layer, meaning the precomputed path was always taken.
-rw-r--r--source/blender/render/intern/multires_bake.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c
index a5c13c26590..a3fc22f5dbc 100644
--- a/source/blender/render/intern/multires_bake.c
+++ b/source/blender/render/intern/multires_bake.c
@@ -66,7 +66,7 @@ typedef struct {
MLoopUV *mloopuv;
const MLoopTri *mlooptri;
float *pvtangent;
- const float *precomputed_normals;
+ const float (*precomputed_normals)[3];
int w, h;
int tri_index;
DerivedMesh *lores_dm, *hires_dm;
@@ -116,7 +116,7 @@ static void multiresbake_get_normal(const MResolvePixelData *data,
if (!smoothnormal) { /* flat */
if (data->precomputed_normals) {
- copy_v3_v3(norm, &data->precomputed_normals[poly_index]);
+ copy_v3_v3(norm, data->precomputed_normals[poly_index]);
}
else {
BKE_mesh_calc_poly_normal(mp, &data->mloop[mp->loopstart], data->mvert, norm);
@@ -542,7 +542,7 @@ static void do_multires_bake(MultiresBakeRender *bkr,
handle->data.mlooptri = mlooptri;
handle->data.mloop = mloop;
handle->data.pvtangent = pvtangent;
- handle->data.precomputed_normals = (float *)poly_normals; /* don't strictly need this */
+ handle->data.precomputed_normals = poly_normals; /* don't strictly need this */
handle->data.w = ibuf->x;
handle->data.h = ibuf->y;
handle->data.lores_dm = dm;