[Bf-blender-cvs] [2559d79d2f8] master: Fix T94582: Cycles mapping shader node incorrectly skipped in Normal mode

Brecht Van Lommel noreply at git.blender.org
Thu Jan 20 20:41:14 CET 2022


Commit: 2559d79d2f8db16ad6152529345290f47e8cc31e
Author: Brecht Van Lommel
Date:   Thu Jan 20 19:08:19 2022 +0100
Branches: master
https://developer.blender.org/rB2559d79d2f8db16ad6152529345290f47e8cc31e

Fix T94582: Cycles mapping shader node incorrectly skipped in Normal mode

Even if no rotation or scale is specified, we must still always normalize
the output.

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

M	intern/cycles/scene/constant_fold.cpp

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

diff --git a/intern/cycles/scene/constant_fold.cpp b/intern/cycles/scene/constant_fold.cpp
index a5fb68bf229..e9fb3426b70 100644
--- a/intern/cycles/scene/constant_fold.cpp
+++ b/intern/cycles/scene/constant_fold.cpp
@@ -441,9 +441,13 @@ void ConstantFolder::fold_mapping(NodeMappingType type) const
   if (is_zero(scale_in)) {
     make_zero();
   }
-  else if ((is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
-            type == NODE_MAPPING_TYPE_NORMAL) &&
-           is_zero(rotation_in) && is_one(scale_in)) {
+  else if (
+      /* Can't constant fold since we always need to normalize the output. */
+      (type != NODE_MAPPING_TYPE_NORMAL) &&
+      /* Check all use values are zero, note location is not used by vector and normal types. */
+      (is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
+       type == NODE_MAPPING_TYPE_NORMAL) &&
+      is_zero(rotation_in) && is_one(scale_in)) {
     try_bypass_or_make_constant(vector_in);
   }
 }



More information about the Bf-blender-cvs mailing list