Skip to content
Snippets Groups Projects
Commit 07dc383f authored by Hans Goudey's avatar Hans Goudey Committed by Philipp Oeser
Browse files

Fix T96401: Broken multires baked normals result

A 7 year old commit, 2ec00ea0, 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.
parent 46585a49
No related branches found
Tags
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment