Page MenuHome

Geometry Nodes: Scale Instances node
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Sep 28 2021, 10:24 PM.

Details

Summary

Adds a node that can scale a geometry's instances. With "Local" turned on,
the instance is scaled individually from the center point input, while when
local space is turned off, it's more like the transform node, except it scales
outward from the center point.

Addresses T91654

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Sep 28 2021, 10:24 PM
Erik Abrahamsson (erik85) created this revision.
Hans Goudey (HooglyBoogly) requested changes to this revision.Oct 12 2021, 12:30 AM

I didn't test it yet (merge conflicts with master), but this looks pretty straightforward, though it feels like some of the matrix math could be simplified. Maybe avoiding the full multiplication for the scale is a place to start?

I think the code would look much nicer with something like this in float4x4:

void operator*=(const float4x4 &other)
{
  mul_m4_m4_post(values, other.values);
}
source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc
55

I don't think this is quite right, the index here is the index into the mask, not the index of the index. Here's an example from the curve reverse node:

threading::parallel_for(selection.index_range(), 128, [&](IndexRange range) {
  for (const int i : range) {
    splines[selection[i]]->reverse();
  }
});
61

Constructing a transform matrix from an Euler rotation is very slow. We should try to avoid this constructor whenever we can.

I wonder if this matrix is actually necessary, or if float4x4::apply_scale(scale) would work.

This revision now requires changes to proceed.Oct 12 2021, 12:30 AM
source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc
47

Since this is only called once, this could call extract_input

48

Since this is only called once, these could call extract_input

Simplified matrix math and fixed bugs pointed out in review.

Erik Abrahamsson (erik85) marked 4 inline comments as done.Oct 12 2021, 7:15 PM
  • Fixed autoformatting line breaking issue
  • Removed float4x4 operator overloading.
  • Fix whitespace error.
  • Merge branch 'master' into arcpatch-D12681
  • Small cleanup
  • Rename "Pivot Point" to "Center"
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)

I'm fine with reverting the change from "Pivot Point" to "Center" in my update to this patch. I just felt that it was more accurate for this node.

This revision is now accepted and ready to land.Oct 13 2021, 5:58 AM
This revision now requires review to proceed.Oct 13 2021, 5:58 AM
This revision is now accepted and ready to land.Oct 13 2021, 1:10 PM
This revision was automatically updated to reflect the committed changes.