Page MenuHome

Proper fix T40156 Cycles Baking and applyRotation issues
ClosedPublic

Authored by Dalai Felinto (dfelinto) on May 27 2014, 4:01 AM.

Details

Summary

This should be the final fix for the applyrotation issue. It baffles me that the fix involves discarding the scale transformations for the normals but it works so I'm happy with it.

Diff Detail

Branch
fix-bake-nonuniform-scale

Event Timeline

Dalai Felinto (dfelinto) updated this revision to Unknown Object (????).May 27 2014, 4:44 AM

Bake-API: fix for overlapping objects wrongly sorted when nonuniform scale

Dalai Felinto (dfelinto) updated this revision to Unknown Object (????).May 27 2014, 6:18 AM
  • squared len should do as well and it is faster
Campbell Barton (campbellbarton) added inline comments.
source/blender/blenlib/intern/math_matrix.c
1301

Not sure this really needs its own function?

It seems a very specific function, and the resulting matrix isn't generally useful for rotation, in use cases other then the one you need it for.

Suggest to just do this inline:

normalize_m3_m3(mat3_n, mat3);
if (is_negative_m3(mat3_n))
    mul_m3_fl(mat3_n, -1.0f)
source/blender/render/intern/source/bake_api.c
256

No need for fabsf(), length is always positive

Campbell Barton (campbellbarton) requested changes to this revision.May 29 2014, 4:18 PM

Maybe it's not needed indeed, no problems.
I will incorporate those changes (test ;) and commit. Thanks Campbell

Note: added negate_m3

normalize_m3_m3(mat3_n, mat3);
if (is_negative_m3(mat3_n))
    negate_m3(mat3_n)
source/blender/editors/object/object_bake_api.c
607

This doesn't need to be initialized.

Dalai Felinto (dfelinto) updated this revision to Unknown Object (????).May 29 2014, 5:16 PM
  • Merge remote-tracking branch 'upstream/master' into fix-bake-nonuniform-scale
  • remove newly added math_matrix functions (will do it inline now)
  • changes after revision (way simpler now)