[Bf-blender-cvs] [1eba32c3e95] master: Fix T91576: Cycles attribute node with name N for smooth normal no longer working

Brecht Van Lommel noreply at git.blender.org
Wed Sep 22 17:05:43 CEST 2021


Commit: 1eba32c3e95effe3d3caef3bb7b6f508786c958f
Author: Brecht Van Lommel
Date:   Wed Sep 22 16:57:31 2021 +0200
Branches: master
https://developer.blender.org/rB1eba32c3e95effe3d3caef3bb7b6f508786c958f

Fix T91576: Cycles attribute node with name N for smooth normal no longer working

There was an optimization to remove duplicate storage of normals as attributes
when using normal maps. However for named attributes like this we still need to
store the attribute.

Don't request normal attribute from the normal map node now, instead of skipping it
in the geometry code.

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

M	intern/cycles/render/geometry.cpp
M	intern/cycles/render/nodes.cpp

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

diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp
index 6804a006fe6..4de458de271 100644
--- a/intern/cycles/render/geometry.cpp
+++ b/intern/cycles/render/geometry.cpp
@@ -794,11 +794,6 @@ void GeometryManager::device_update_attributes(Device *device,
     foreach (AttributeRequest &req, attributes.requests) {
       Attribute *attr = geom->attributes.find(req);
 
-      /* Vertex normals are stored in DeviceScene.tri_vnormal. */
-      if (attr && attr->std == ATTR_STD_VERTEX_NORMAL) {
-        continue;
-      }
-
       update_attribute_element_size(geom,
                                     attr,
                                     ATTR_PRIM_GEOMETRY,
@@ -811,11 +806,6 @@ void GeometryManager::device_update_attributes(Device *device,
         Mesh *mesh = static_cast<Mesh *>(geom);
         Attribute *subd_attr = mesh->subd_attributes.find(req);
 
-        /* Vertex normals are stored in DeviceScene.tri_vnormal. */
-        if (subd_attr && subd_attr->std == ATTR_STD_VERTEX_NORMAL) {
-          continue;
-        }
-
         update_attribute_element_size(mesh,
                                       subd_attr,
                                       ATTR_PRIM_SUBD,
@@ -870,11 +860,6 @@ void GeometryManager::device_update_attributes(Device *device,
       Attribute *attr = geom->attributes.find(req);
 
       if (attr) {
-        /* Vertex normals are stored in DeviceScene.tri_vnormal. */
-        if (attr->std == ATTR_STD_VERTEX_NORMAL) {
-          continue;
-        }
-
         /* force a copy if we need to reallocate all the data */
         attr->modified |= attributes_need_realloc[Attribute::kernel_type(*attr)];
       }
@@ -898,11 +883,6 @@ void GeometryManager::device_update_attributes(Device *device,
         Attribute *subd_attr = mesh->subd_attributes.find(req);
 
         if (subd_attr) {
-          /* Vertex normals are stored in DeviceScene.tri_vnormal. */
-          if (subd_attr->std == ATTR_STD_VERTEX_NORMAL) {
-            continue;
-          }
-
           /* force a copy if we need to reallocate all the data */
           subd_attr->modified |= attributes_need_realloc[Attribute::kernel_type(*subd_attr)];
         }
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 5303d55242e..03b79d7de3e 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -6749,8 +6749,6 @@ void NormalMapNode::attributes(Shader *shader, AttributeRequestSet *attributes)
       attributes->add(ustring((string(attribute.c_str()) + ".tangent").c_str()));
       attributes->add(ustring((string(attribute.c_str()) + ".tangent_sign").c_str()));
     }
-
-    attributes->add(ATTR_STD_VERTEX_NORMAL);
   }
 
   ShaderNode::attributes(shader, attributes);
@@ -7026,8 +7024,6 @@ void VectorDisplacementNode::attributes(Shader *shader, AttributeRequestSet *att
       attributes->add(ustring((string(attribute.c_str()) + ".tangent").c_str()));
       attributes->add(ustring((string(attribute.c_str()) + ".tangent_sign").c_str()));
     }
-
-    attributes->add(ATTR_STD_VERTEX_NORMAL);
   }
 
   ShaderNode::attributes(shader, attributes);



More information about the Bf-blender-cvs mailing list