[Bf-blender-cvs] [a2892f7] bake-cycles: Cycles-Bake: fix for swizzle (negative was positive and vice-versa)

Dalai Felinto noreply at git.blender.org
Sat May 3 01:54:35 CEST 2014


Commit: a2892f7302150d6e3549d5a531cf68f008d08717
Author: Dalai Felinto
Date:   Fri May 2 15:45:39 2014 -0300
https://developer.blender.org/rBa2892f7302150d6e3549d5a531cf68f008d08717

Cycles-Bake: fix for swizzle (negative was positive and vice-versa)

===================================================================

M	source/blender/editors/object/object_bake_api.c
M	source/blender/render/intern/source/bake_api.c

===================================================================

diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 33085b0..2d4ed11 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -646,15 +646,16 @@ static int bake(Main *bmain, Scene *scene, Object *ob_low, ListBase *selected_ob
 			ok = RE_bake_internal(re, ob_low, pixel_array_low, num_pixels, depth, pass_type, result);
 	}
 
-	/* normal space conversion */
+	/* normal space conversion
+	 * the normals are expected to be in world space, +X +Y +Z */
 	if (pass_type == SCE_PASS_NORMAL) {
 		switch (normal_space) {
 			case R_BAKE_SPACE_WORLD:
 			{
 				/* Cycles internal format */
-				if ((normal_swizzle[0] == R_BAKE_NEGX) &&
-				    (normal_swizzle[1] == R_BAKE_NEGY) &&
-				    (normal_swizzle[2] == R_BAKE_NEGZ))
+				if ((normal_swizzle[0] == R_BAKE_POSX) &&
+				    (normal_swizzle[1] == R_BAKE_POSY) &&
+				    (normal_swizzle[2] == R_BAKE_POSZ))
 				{
 					break;
 				}
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index d8963ce..53b835a 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -474,14 +474,13 @@ void RE_bake_pixels_populate(
 
 /**
  * convert a normalized normal to the -1.0 1.0 range
- * the input is expected to be NEG_X, NEG_Y, NEG_Z
- * the output is POS_X, POS_Y, POS_Z
+ * the input is expected to be POS_X, POS_Y, POS_Z
  */
 static void normal_uncompress(float out[3], const float in[3])
 {
 	int i;
 	for (i = 0; i < 3; i++)
-		out[i] = - (2.0f * in[i] - 1.0f);
+		out[i] = 2.0f * in[i] - 1.0f;
 }
 
 static void normal_compress(float out[3], const float in[3], const BakeNormalSwizzle normal_swizzle[3])




More information about the Bf-blender-cvs mailing list