Page MenuHome

Geometry Nodes: Add "normal" attribute for face normals
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Mar 9 2021, 10:23 PM.

Details

Summary

This commit adds a normal attribute on the face domain. Since this
data is purely based off of the location of each face's vertices, it is
exposed as a read-only attribute. After rB80f7f1070f17, this attribute
can be interpolated to the other domains we currently use.

Since this attribute is a special case compared to the others, the
implementation subclasses BuiltinAttributeProvider. It's possible
there is a better way to abstract this, I'm not quite sure. Something
else might also become apparent if we add similar read-only attributes.

See D10676: Geometry Nodes: Revert current normal attribute implementation for why this is preferred over the previous implementation.

Diff Detail

Repository
rB Blender
Branch
geometry-nodes-normal-attribute-new (branched from master)
Build Status
Buildable 13385
Build 13385: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Mar 9 2021, 10:23 PM
Hans Goudey (HooglyBoogly) created this revision.
Hans Goudey (HooglyBoogly) retitled this revision from Merge branch 'master' into geometry-nodes-vertex-normal-revert to Geometry Nodes: Add "normal" attribute for face normals.Mar 9 2021, 10:43 PM
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)

I thought about replacing the special handling for the normal attribute in the point distribute node with this method, but it wasn't as nice as I hoped since the normal has to be transformed by the instance transforms anyway.
I'll save that for a separate patch if I continue with it.

Haven't tested it, but the code does look correct.

source/blender/blenkernel/intern/geometry_component_mesh.cc
771

wrong comment

This revision is now accepted and ready to land.Mar 9 2021, 11:35 PM