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
committerPhilipp Oeser <info@graphics-engineer.com>2022-03-23 19:53:03 +0300
commit07dc383f4b19e5a30dd5dced3cda7cd6160cb962 (patch)
treeeb6cb869d1c8e3b1a61ac4e808881c84d9ff5c9f
parent46585a49003c53f1d3de16563c3476868fd9dac9 (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 73f925f5905..f804877db3e 100644
--- a/source/blender/render/intern/multires_bake.c
+++ b/source/blender/render/intern/multires_bake.c
@@ -82,7 +82,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;
@@ -132,7 +132,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);
@@ -558,7 +558,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;