From 2559d79d2f8db16ad6152529345290f47e8cc31e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Jan 2022 19:08:19 +0100 Subject: 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. --- intern/cycles/scene/constant_fold.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'intern') 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); } } -- cgit v1.2.3