Page MenuHome

Geometry Nodes: Curve to Points Node
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Jun 9 2021, 12:32 AM.
Tokens
"Love" token, awarded by duarteframos."Love" token, awarded by lopoIsaac."Love" token, awarded by asmitty."Love" token, awarded by HEYPictures.

Details

Summary

This node implements the second option of T87429, creating points
along the input splines with the necessary evaluated information
for instancing: tangent, normal, and rotation attributes.
All generic curve point and spline attributes are copied to the
result points as well.

I'm actually quite happy with the implementation right now. It's
readable enough and there isn't too much boilerplate code. The thing
I expect could use improvement is that there is a lot of temporary
memory allocation. Sharing a buffer for each thread would be a nice
improvement in the future.

The patch currently includes some refactoring of the curve resample
node with some newly abstracted functions. I may commit that separately.
The "Evaluated" mode for the resample node will be a separate commit.

Diff Detail

Repository
rB Blender
Branch
geometry-nodes-curve-to-points-node (branched from master)
Build Status
Buildable 15043
Build 15043: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Jun 9 2021, 12:32 AM
Hans Goudey (HooglyBoogly) created this revision.
  • Fix RNA struct type
Jacques Lucke (JacquesLucke) requested changes to this revision.Jun 9 2021, 1:37 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
75

Add a comment that says that this is just filling the cache.

137

This function can make use of the function below to avoid duplication.

191

What is a non-poly case here?

227

even -> uniform?

237

In my test size was sometimes zero which leads to crash in sample_uniform_index_factors.

My guess is that sample_uniform_index_factors should just support the case when samples_size == 0.

239

I wonder whether position, radius and tilt could be handled as part of the more generic loop below. It could just use the attribute api.

This revision now requires changes to proceed.Jun 9 2021, 1:37 PM
Hans Goudey (HooglyBoogly) marked 5 inline comments as done.
  • Merge branch 'master' into geometry-nodes-curve-to-points-node
  • Add comment
  • Check for size==0, reduce duplication
source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
191

I just meant the other two spline types, I'll make that more clear.

239

Right, I thought that at first too, but since we're using the evaluated values here the situation is different. We need a single span for each spline, and the only way to get that from the attribute API would be to pick about the VArray that it returns, which I don't think is a good thing to do.

I thought a bit about moving the spline attribute API from the custom data storage to the spline itself, so that it could have special cases for the builtin attributes. I'm not sure that's better though, it has some other downsides.

Seems to work as expected now. It's just a bit annoying that the radius of the points is so large by default..

Simon and/or Dalai should still have a look at it.

This revision is now accepted and ready to land.Jun 9 2021, 4:38 PM
Dalai Felinto (dfelinto) requested changes to this revision.Jun 9 2021, 6:05 PM
  • I think the default "mode" should be Count (or at least Length)
  • I think the radius should now be interpolated from the curve, but instead set to the same we use in the Point Distribute (0.05)
  • Why to call it Length instead of Distance?
This revision now requires changes to proceed.Jun 9 2021, 6:05 PM

I think the radius should now be interpolated from the curve, but instead set to the same we use in the Point Distribute (0.05)

Interpolating the radius seems like the right thing to do. I don't see why radius should be a special case. Maybe we should set a smaller default radius in some nodes.

  • Change default to "Count", divide radius by 10

I'm curious what people think about this solution for the radius.
I think it's a good compromise.

Suggested limit of 2 for count minimum. Other than that good to go.

I would still love to hear from artists on this. Specially in regarding to the expectations regarding the tangents. But nothing blocking the patch.

This revision is now accepted and ready to land.Jun 14 2021, 3:36 PM

Specially in regarding to the expectations regarding the tangents.

What do you mean by this?