Page MenuHome

Fix T95084: Evaluate all output attributes before changing the geometry.
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Feb 1 2022, 5:23 PM.

Details

Summary

This refactors how output attributes are computed in the geometry nodes modifier. Previously, all output attributes were computed one after the other. Every attribute was stored on the geometry directly after computing it. The issue was that other output attributes might depend on the already overwritten attribute leading to unexpected behavior.

The solution is to compute all output attributes first before changing the geometry. Under specific circumstances, this refactor can result in a speedup, because output attributes on the same domain are evaluated together now.
For example, the following setup is about twice as fast now, because the noise is only computed once.

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Feb 1 2022, 5:23 PM
Jacques Lucke (JacquesLucke) created this revision.
Jacques Lucke (JacquesLucke) retitled this revision from Fix T94609: Evaluate all output attributes before changing the geometry. to Fix T95084: Evaluate all output attributes before changing the geometry..

Works well in my "worst case" test:

Might this also make writing to existing attributes slower, since we use a temporary array instead of evaluating to the attribute directly. If so, you could mention that in the commit too.
The speedup is nice though.

source/blender/modifiers/intern/MOD_nodes.cc
916

Might as well use a const NodesModifierData & argument.

940

(const bNodeSocket *)BLI_findlink

1030

Small thing, but this comma isn't necessary

This revision is now accepted and ready to land.Feb 1 2022, 11:46 PM