From 8d297394ba51246f2db0d503df7f4cae19ca6e92 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 21 May 2014 15:04:59 -0300 Subject: Bake API: partial fix T40156 (applyRotation issues) This fixes most of the cases, the only situation not addressed is when the highpoly object(s) has non-uniform scale. mul_transposed_mat3_m4_v3() should take care of non-uniform scales so I'm a bit confused on why it doesn't work. The lowpoly object can have any transformation, the only issue is if the highpoly object has non-uniform scale. Test file of the remaining issue: https://developer.blender.org/file/info/PHID-FILE-tpw2xgddyzxtpg3e7xzs/ Reference reading: http://www.unknownroad.com/rtfm/graphics/rt_normals.html --- source/blender/render/extern/include/RE_bake.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/render/extern') diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h index d59819c8ef4..6ae8300b9d1 100644 --- a/source/blender/render/extern/include/RE_bake.h +++ b/source/blender/render/extern/include/RE_bake.h @@ -61,7 +61,9 @@ typedef struct BakeHighPolyData { struct ModifierData *tri_mod; struct Mesh *me; char restrict_flag; - float mat_lowtohigh[4][4]; + float mat_high[4][4]; + float imat_high[4][4]; + float scale; } BakeHighPolyData; /* external_engine.c */ @@ -80,7 +82,7 @@ bool RE_bake_internal( void RE_bake_pixels_populate_from_objects( struct Mesh *me_low, BakePixel pixel_array_from[], BakeHighPolyData highpoly[], const int tot_highpoly, const int num_pixels, - const float cage_extrusion); + const float cage_extrusion, float mat_low[4][4]); void RE_bake_pixels_populate( struct Mesh *me, struct BakePixel *pixel_array, @@ -95,7 +97,7 @@ void RE_bake_normal_world_to_object( struct Object *ob, const BakeNormalSwizzle normal_swizzle[3]); void RE_bake_normal_world_to_tangent( const BakePixel pixel_array[], const int num_pixels, const int depth, float result[], - struct Mesh *me, const BakeNormalSwizzle normal_swizzle[3]); + struct Mesh *me, const BakeNormalSwizzle normal_swizzle[3], float mat[4][4]); void RE_bake_normal_world_to_world( const BakePixel pixel_array[], const int num_pixels, const int depth, float result[], const BakeNormalSwizzle normal_swizzle[3]); -- cgit v1.2.3