Page MenuHome

Curve evaluation / to points for instancing
Closed, ResolvedPublicTO DO

Description

Use Case

For many use cases it is necessary to instance geometry along a curve, for things like rock paths, roads, etc. In those situations the following information is needed:

  • Position
  • Rotation
  • Scale (sometimes)
  • Alternatively a transform matrix could be used directly, but that isn't currently possible in geometry nodes, since the information is stored as attributes.

Background

Currently in geometry nodes you can generate instances on any point data. That includes point clouds, meshes, and curve control points.
With their evaluated tangent and normal information, curves have the unique ability to adjust these parameters very efficiently (quick changes can have big results on many instances).

However, curve control points do not have the required tangent, normal, (and therefore rotation) information for instancing.
To retrieve that information, evaluating the curve is necessary. This can create tangent, normal, and rotation information.

The question is where to store this information:

  • On curves, this is derived information, meaning changing the curve would "logically" change this data (not necessarily in practice).
  • On point clouds, this data is simply a flat list. In other words, there is no correspondence between it and the original points.

Generate a new point cloud

This method would not modify the curve but create point cloud data instead, copying over all of the curve attributes to the result.
More operations like "resampling" could be in the same node.

Pros
  • Simplicity: Separation of data logically (point clouds are "points" more directly than curve splines
  • No confusion about derived data (the curve is no longer around)
Cons
  • Complexity: There is no essential need to create a point cloud to do instancing. This is evident with how we handle meshes, where you can easily do instancing on points (even faces in the old system)
  • Performance: Copying attributes around during evaluation is not at all trivial
  • Arbitrary: Does not use the fact that attributes are stored on geometry to our advantage. In this case the point cloud is just an "array container"
  • Code: The required code is harder to maintain, more confusing, and requires more duplication
  • If there are more operations in this node, they are duplicated from operations that keep the curve a curve.

Evaluate splines

This method takes advantage of the 1 to 1 correspondence of evaluated points and control points on poly splines.
All Bezier and NURB splines are converted to poly splines, and three attributes are added: tangent, normal, and rotation.

Pros
  • Use curves to our advantage: We can adjust the resulting attributes using methods unique to curves with the maintained "topology" information.
  • Performance: In many cases only three attributes need to be added. The operation is much simpler. And the data can be used later for other curve-related things.
  • Standard: Sverchok and AN both have similar nodes
  • Simplicity: There is no unnecessary change of data type
Cons
  • Complexity: Exposes users to the different spline types when they might not have known about it before.
  • Subsequent curve operations maintain these attributes, even they they are derived

Event Timeline

Hans Goudey (HooglyBoogly) changed the task status from Needs Triage to Confirmed.Apr 12 2021, 3:40 PM
Hans Goudey (HooglyBoogly) created this task.

So, in the first pass I implemented a "Curve Resample" node. I would like to think about changing "Point Instance" to "Geometry Instance" and making it work on evaluated curves with the point, normal, tangent, and radius information. Otherwise you would have to construct a rotation from this information, which would be slower and move involved.

A "Sample Points" node also makes sense, but since the initial goal is instancing (I think), I'd like to do "Resample" first.

Hans Goudey (HooglyBoogly) renamed this task from Curve Sample Points Node to Curve to Points Node.May 11 2021, 4:24 AM
Hans Goudey (HooglyBoogly) updated the task description. (Show Details)
Hans Goudey (HooglyBoogly) renamed this task from Curve to Points Node to Curve evaluation for instancing.Jun 5 2021, 12:13 AM
Hans Goudey (HooglyBoogly) renamed this task from Curve evaluation for instancing to Curve evaluation / to points for instancing.
Hans Goudey (HooglyBoogly) claimed this task.
Hans Goudey (HooglyBoogly) updated the task description. (Show Details)
Hans Goudey (HooglyBoogly) updated the task description. (Show Details)

For the records: I've been outvoted here and we're going with the "Curve to Points" method. I'll create a patch with that node and the different modes shortly.

Dalai Felinto (dfelinto) closed this task as Resolved.Jun 15 2021, 11:58 AM