Page MenuHome

Geometry Nodes: Add Factor and Size to Index Input
AcceptedPublic

Authored by Hans Goudey (HooglyBoogly) on Nov 24 2021, 9:24 PM.

Details

Summary

Adds a domain size and "factor of index on size" to Index input node.

Diff Detail

Repository
rB Blender
Branch
geometry-nodes-index-factor-size (branched from master)
Build Status
Buildable 19066
Build 19066: arc lint + arc unit

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Nov 24 2021, 9:24 PM
Johnny Matthews (guitargeek) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Nov 26 2021, 2:28 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_input_index.cc
46

Call it factors (plural).

48

It should be enough to iterate over mask.

49

It's important to divide by size - 1 here so that you actually get a value between 0 and 1 as factor. Make sure to handle the division by zero case as well.

76

Mask is unused.

This revision now requires changes to proceed.Nov 26 2021, 2:28 PM
source/blender/nodes/geometry/nodes/node_geo_input_index.cc
49

And actually, I've gotten a noticeable speedup by doing the 1 / size division outside of the loop and multiplying by that value inside the loop, so this is likely a place to do that too.

Johnny Matthews (guitargeek) marked 5 inline comments as done.
  • Merge branch 'master' into indexfields
  • Some minor improvements from comments
  • Merge branch 'master' into indexfields

I was reviewing this but ended up changing the implementation enough that it doesn't share much resemblance to the original patch, so I'll take this one over.

Use a FieldOperation to build the factor output. This is like using more nodes
internally to build this output, and it means that theoretically this can be optimized
in the future without really thinking about the optimization here.
Or maybe it won't have much of an effect, since it's also similar to using VArray<float>::ForFunc(...).
Anyway, it's good to move towards building things like this.

Hans Goudey (HooglyBoogly) planned changes to this revision.Nov 30 2021, 5:16 AM

This requires versioning now, I'll do that tomorrow.

Hans Goudey (HooglyBoogly) requested review of this revision.Dec 1 2021, 4:02 PM

Nevermind, we decided we don't have to do versioning for every socket we add.

This revision is now accepted and ready to land.Jan 18 2022, 3:45 PM