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.
This commit is contained in:
parent
4762a9b09f
commit
1eba32c3e9
Notes:
blender-bot
2023-02-14 02:08:37 +01:00
Referenced by issue #91576, Attribute node set for Normals (N) not working
|
@ -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)];
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue