Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-01-20 21:08:19 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-01-20 22:40:55 +0300
commit2559d79d2f8db16ad6152529345290f47e8cc31e (patch)
tree47bc86001758323699392ed406389c48b15ffe61
parentcc1a48e39514a38eceb3ab353e6916ad4d7621d4 (diff)
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.
-rw-r--r--intern/cycles/scene/constant_fold.cpp10
1 files changed, 7 insertions, 3 deletions
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);
}
}