Page MenuHome

Geometry Nodes: Index Offset Node
AbandonedPublic

Authored by Johnny Matthews (guitargeek) on Oct 5 2021, 10:41 PM.
Subscribers
None
Tokens
"Love" token, awarded by SimontheSorcerer."Love" token, awarded by HEYPictures."Love" token, awarded by Draise."Love" token, awarded by corpse.

Details

Summary

This node allows for an offset in the field data stream for all field compatible types.

The offset is a field and can be set per index.

Clip is also a field capable input:
When clip is on, if the calculated offset is < 0 then that point gets the first value in the field or the last for an offset >= size()
When clip is off, it wraps around using a modulo.

Diff Detail

Repository
rB Blender
Branch
offset (branched from master)
Build Status
Buildable 17582
Build 17582: arc lint + arc unit

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Oct 5 2021, 10:41 PM
Johnny Matthews (guitargeek) created this revision.
  • Add supports_field() marker to clip socket
  • Merge branch 'master' into offset
  • Fix variable naming
  • Use corrent DNA type
  • Merge branch 'master' into offset
  • Naming

I just had the thought, maybe "Index Offset" would be a better name for this. Two benefits:

  • It doesn't break the "field is not really data, it's just a function" idea
  • It makes it clear how the offset works-- it's offsetting the index in the array by a certain amount.
source/blender/nodes/geometry/nodes/node_geo_input_data_offset.cc
239

I think this is conceptually a utility, rather than an input-- since its input data is quite important, it's just remapped.

245

The default size would probably fit everything well enough.

  • Merge branch 'master' into offset
  • name change
  • change node size back to default
Johnny Matthews (guitargeek) retitled this revision from Geometry Nodes: Data Offset Node to Geometry Nodes: Index Offset Node.Oct 13 2021, 3:38 AM
  • Merge branch 'master' into offset

My design question here is whether we want offset or "get" behavior.

  • Offset is based on the existing index, with a default of 0.
  • "Get" is more like the transfer attribute node, with an implicit index input.

Both of these are possible with the (badly named) transfer attribute node, just in a very clumsy way. Maybe it's worth watching what people do with that. Or having both features available as modes or separate nodes or something.

My design question here is whether we want offset or "get" behavior.

  • Offset is based on the existing index, with a default of 0.
  • "Get" is more like the transfer attribute node, with an implicit index input.

Both of these are possible with the (badly named) transfer attribute node, just in a very clumsy way. Maybe it's worth watching what people do with that. Or having both features available as modes or separate nodes or something.

In general, I think there is room for duplicate functionality (for basic tasks rather than uber-specific use cases) when the 'other' way is cumbersome, hackish, or too unruly to accomplish. If you can do the same task with just a couple nodes and conceptually the idea fits in the context of what you are trying to do (not using side effects of some other node) then maybe not duplicate. But if the other way to do it feels like a 'trick' then perhaps it is a good candidate for functional duplication in a nicer package. In the end, we want the tools to be intuitive.