Geometry Nodes: Curve Support Implementation #87245

Closed
opened 2021-04-06 19:17:25 +02:00 by Hans Goudey · 34 comments
Member

Currently I'm just treating this as a personal project, but I thought it would be nice to have some public place to track progress.

Initial Design: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes

  • Basic design for data structures
  • Conversion from DNA Curve struct
    • Bezier
    • NURBS
    • Poly
  • Spline attributes
    • Cyclic
    • Length
    • Resolution
  • Spline evaluation
    • Position calculation
      • Bezier
      • NURBS
      • Poly
    • Tangents
    • Normals
      • Z-up method
      • Minimum twist method
      • Tangent method
      • Apply tilts to evaluated normals
    • Evaluate control point indices and interpolation factors
    • Different interpolation settings for Bezier curves
  • Curve to Mesh node (Extrude profile)
    • Extrude single vertex
    • Extrude another spline
    • Set edge sharp flag based on sharp control points
    • Use evaluated spline radius
    • Fill Caps option
    • Add UV data
    • Copy attribute data
  • 2D Curve to Mesh node
    • Investigate different triangulation methods
    • Implement flat mesh generation
  • Resample curve node
    • Add generic constant length curve evaluation
  • Trim Curve node
    • Bezier support
    • Fix bezier handles
    • Poly support
    • Figure out how to deal with NURBS
  • Bezier auto handle recalculation
  • Curve profile primitive node
    • Conversion from CurveProfile to CurveEval
    • Add a "Cyclic" option
    • Option to draw without fill unless cyclic
  • Builtin point attributes
    • Position
    • Radius
    • Tilt
    • Bezier Handles
    • NURBS weight
  • Curve Deform node
    • Figure out how to deal with extrapolation
    • Generic curve non-even sampling code
    • Build deformation on top of sampling code
  • Change Direction node
  • Curve modifier stack changes
  • Refactor to storing arrays separately
  • Refactor to speed up poly splines
  • Add support for generic attributes
    • Support in attribute nodes
    • Join attribute when joining curves
    • Support in curve nodes, create APIs, etc.
    • Interpolation between point and spline domain
  • Add instancing directly on evaluated points
  • Curve from Edges node
  • Curve end points node
  • Figure out design for curvature and length parameter attribute/data
  • Implement length parameter data
  • Implement curvature data
*Currently I'm just treating this as a personal project, but I thought it would be nice to have some public place to track progress.* Initial Design: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes - [x] Basic design for data structures - [x] Conversion from DNA `Curve` struct - [x] Bezier - [x] NURBS - [x] Poly - [x] Spline attributes - [x] Cyclic - [x] Length - [x] Resolution - [ ] Spline evaluation - [x] Position calculation - [x] Bezier - [x] NURBS - [x] Poly - [x] Tangents - [ ] Normals - [x] Z-up method - [x] Minimum twist method - [ ] Tangent method - [x] Apply tilts to evaluated normals - [x] Evaluate control point indices and interpolation factors - [ ] Different interpolation settings for Bezier curves - [x] Curve to Mesh node (Extrude profile) - [x] Extrude single vertex - [x] Extrude another spline - [x] Set edge sharp flag based on sharp control points - [x] Use evaluated spline radius - [x] Fill Caps option - [x] Add UV data - [x] Copy attribute data - [x] 2D Curve to Mesh node - [x] Investigate different triangulation methods - [x] Implement flat mesh generation - [x] Resample curve node - [x] Add generic constant length curve evaluation - [x] Trim Curve node - [x] Bezier support - [x] Fix bezier handles - [x] Poly support - [x] Figure out how to deal with NURBS - [x] Bezier auto handle recalculation - [ ] Curve profile primitive node - [ ] Conversion from `CurveProfile` to `CurveEval` - [ ] Add a "Cyclic" option - [ ] Option to draw without fill unless cyclic - [x] Builtin point attributes - [x] Position - [x] Radius - [x] Tilt - [x] Bezier Handles - [x] NURBS weight - [ ] Curve Deform node - [x] Figure out how to deal with extrapolation - [x] Generic curve non-even sampling code - [ ] Build deformation on top of sampling code - [x] Change Direction node - [x] Curve modifier stack changes - [x] Refactor to storing arrays separately - [x] Refactor to speed up poly splines - [x] Add support for generic attributes - [x] Support in attribute nodes - [x] Join attribute when joining curves - [x] Support in curve nodes, create APIs, etc. - [x] Interpolation between point and spline domain - [x] Add instancing directly on evaluated points - [x] Curve from Edges node - [x] Curve end points node - [x] Figure out design for curvature and length parameter attribute/data - [x] Implement length parameter data - [ ] Implement curvature data
Hans Goudey self-assigned this 2021-04-06 19:17:25 +02:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Hans Goudey changed title from Curve Support Implementation to Geometry Nodes: Curve Support Implementation 2021-04-06 19:20:20 +02:00

Added subscriber: @Erindale

Added subscriber: @Erindale

One thing that I would love to see included in the curve support is the option for natural parameterisation of specifically beziers. This lets you get even spacing along the curve which is a huge bonus when using curves for modelling tasks like positioning lamp posts or pillars or flights of stairs etc.

One thing that I would love to see included in the curve support is the option for natural parameterisation of specifically beziers. This lets you get even spacing along the curve which is a huge bonus when using curves for modelling tasks like positioning lamp posts or pillars or flights of stairs etc.

Added subscriber: @GeorgiaPacific

Added subscriber: @GeorgiaPacific

Added subscriber: @GregoryS

Added subscriber: @GregoryS

Added subscriber: @MiroHorvath

Added subscriber: @MiroHorvath

Hi Hans, lots of great stuff already implemented, good job! Here are my findings.

  • it feels bit weird that to make a road body(extrude profile along curve) I have to create a vertical line(BezierCurve1), I'd expect something like BezierCurve2
    image.png
    extrude.blend

  • it seems to me that trimming currently just offsets first(or last) control point along the curve, see the effect here
    trim.blend

Hi Hans, lots of great stuff already implemented, good job! Here are my findings. - it feels bit weird that to make a road body(extrude profile along curve) I have to create a vertical line(BezierCurve1), I'd expect something like BezierCurve2 ![image.png](https://archive.blender.org/developer/F10032062/image.png) [extrude.blend](https://archive.blender.org/developer/F10032064/extrude.blend) - it seems to me that trimming currently just offsets first(or last) control point along the curve, see the effect here [trim.blend](https://archive.blender.org/developer/F10032065/trim.blend)

This issue was referenced by 8216b759e9

This issue was referenced by 8216b759e9557c786e517aa64eee424fed0ac742

Added subscriber: @SteffenD

Added subscriber: @SteffenD

Added subscriber: @DuarteRamos

Added subscriber: @DuarteRamos

Added subscriber: @jmargaud

Added subscriber: @jmargaud

Added subscriber: @Nauss

Added subscriber: @Nauss

I noticed you've got a convert curve to mesh modifier/node planned and I was wondering if there is anything planned to go in opposite direction from a mesh to a curve? Having something like that would make it a lot easier to non-destructively create railings and pipes so you can very easily edit their shape on the fly.

Essentially what I want to be able to do is something like this:
mesh_to_curve.png
I want to just be able to just use the first mesh, add a vertex bevel modifier to it and then convert it to a curve (via a modifier) to extrude a pipe/railing from it. We can do this with current tools but it has to be done destructively, so if I wanted to change things up (add more kinks or do different angles) it's more difficult that it should be. Alternatively you could use the skin modifier to do it non-destructively but doing this adds a lot of unneeded geometry you don't want (especially if you do game modeling), it can also only do roundish profiles properly and it's generally just less precise.

I noticed you've got a convert curve to mesh modifier/node planned and I was wondering if there is anything planned to go in opposite direction from a mesh to a curve? Having something like that would make it a lot easier to non-destructively create railings and pipes so you can very easily edit their shape on the fly. Essentially what I want to be able to do is something like this: ![mesh_to_curve.png](https://archive.blender.org/developer/F10159060/mesh_to_curve.png) I want to just be able to just use the first mesh, add a vertex bevel modifier to it and then convert it to a curve (via a modifier) to extrude a pipe/railing from it. We can do this with current tools but it has to be done destructively, so if I wanted to change things up (add more kinks or do different angles) it's more difficult that it should be. Alternatively you could use the skin modifier to do it non-destructively but doing this adds a lot of unneeded geometry you don't want (especially if you do game modeling), it can also only do roundish profiles properly and it's generally just less precise.
Author
Member

@Nauss Have you seen the mesh to curve node in the alpha version of 3.0? I'd also like to support bevel/fillet directly on curves at some point though.

@Nauss Have you seen the mesh to curve node in the alpha version of 3.0? I'd also like to support bevel/fillet directly on curves at some point though.

@HooglyBoogly Thanks, Hans! I had not seen that as I've not used 3.0 at all until just now. It seems to do pretty much exactly what I needed, it just seems a little bit bugged at the moment.

I've not used geometry nodes in the past so it's very possible that I'm doing something wrong and I know Blender 3.0 is just in alpha, but I'm getting this kind of bugged looking result right now:
mesh_to_curve_taper.png
This is just with a beziercircle as the profile curve. I also tried using an attribute fill on the curves depth but I couldn't get it to work (probably missing something).

I can upload the blendfile if that'd help.

@HooglyBoogly Thanks, Hans! I had not seen that as I've not used 3.0 at all until just now. It seems to do pretty much exactly what I needed, it just seems a little bit bugged at the moment. I've not used geometry nodes in the past so it's very possible that I'm doing something wrong and I know Blender 3.0 is just in alpha, but I'm getting this kind of bugged looking result right now: ![mesh_to_curve_taper.png](https://archive.blender.org/developer/F10159163/mesh_to_curve_taper.png) This is just with a beziercircle as the profile curve. I also tried using an attribute fill on the curves depth but I couldn't get it to work (probably missing something). I can upload the blendfile if that'd help.
Contributor

Added subscriber: @Eary

Added subscriber: @Eary
Contributor

In #87245#1171543, @Nauss wrote:
@HooglyBoogly Thanks, Hans! I had not seen that as I've not used 3.0 at all until just now. It seems to do pretty much exactly what I needed, it just seems a little bit bugged at the moment.

I've not used geometry nodes in the past so it's very possible that I'm doing something wrong and I know Blender 3.0 is just in alpha, but I'm getting this kind of bugged looking result right now:
mesh_to_curve_taper.png
This is just with a beziercircle as the profile curve. I also tried using an attribute fill on the curves depth but I couldn't get it to work (probably missing something).

I can upload the blendfile if that'd help.

As far as I know this is not a bug. I just discussed this with my friends a few days ago. The conclusion was that this is because geometry nodes currently only supports z-up method for the normal, (as you can see in the main post of this page, under the normal category). So until the other two methods being implemented, we could only use some hacks to work around it.

> In #87245#1171543, @Nauss wrote: > @HooglyBoogly Thanks, Hans! I had not seen that as I've not used 3.0 at all until just now. It seems to do pretty much exactly what I needed, it just seems a little bit bugged at the moment. > > I've not used geometry nodes in the past so it's very possible that I'm doing something wrong and I know Blender 3.0 is just in alpha, but I'm getting this kind of bugged looking result right now: > ![mesh_to_curve_taper.png](https://archive.blender.org/developer/F10159163/mesh_to_curve_taper.png) > This is just with a beziercircle as the profile curve. I also tried using an attribute fill on the curves depth but I couldn't get it to work (probably missing something). > > I can upload the blendfile if that'd help. As far as I know this is not a bug. I just discussed this with my friends a few days ago. The conclusion was that this is because geometry nodes currently only supports z-up method for the normal, (as you can see in the main post of this page, under the normal category). So until the other two methods being implemented, we could only use some hacks to work around it.
Author
Member

It is a bug actually, since the existing Z up method for curves doesn't have this problem. Should be a simple fix hopefully. I just need to get to it. Thanks for sharing.

It is a bug actually, since the existing Z up method for curves doesn't have this problem. Should be a simple fix hopefully. I just need to get to it. Thanks for sharing.
Contributor

In #87245#1172160, @HooglyBoogly wrote:
It is a bug actually, since the existing Z up method for curves doesn't have this problem. Should be a simple fix hopefully. I just need to get to it. Thanks for sharing.

Oh it is? This is good news! And.. I need to talk to my friends about this.

> In #87245#1172160, @HooglyBoogly wrote: > It is a bug actually, since the existing Z up method for curves doesn't have this problem. Should be a simple fix hopefully. I just need to get to it. Thanks for sharing. Oh it is? This is good news! And.. I need to talk to my friends about this.
Contributor

In #87245#1172160, @HooglyBoogly wrote:
since the existing Z up method for curves doesn't have this problem.

image.png

Hmm I just tried it out using regular curves, and it some how also has the problem?

> In #87245#1172160, @HooglyBoogly wrote: > since the existing Z up method for curves doesn't have this problem. ![image.png](https://archive.blender.org/developer/F10160570/image.png) Hmm I just tried it out using regular curves, and it some how also has the problem?

@HooglyBoogly That's good to know! Thanks for looking into it, Hans!

@Eary I tried doing that curve manually again in both Blender 2.93 and 3.0 and it's working in both of them for me for some reason, just not when trying it with geometry nodes.

@HooglyBoogly That's good to know! Thanks for looking into it, Hans! @Eary I tried doing that curve manually again in both Blender 2.93 and 3.0 and it's working in both of them for me for some reason, just not when trying it with geometry nodes.
Contributor

In #87245#1172741, @Nauss wrote:
@Eary I tried doing that curve manually again in both Blender 2.93 and 3.0 and it's working in both of them for me for some reason, just not when trying it with geometry nodes.

Make sure to set the twist method to z-up, then I think you should see it @Nauss

> In #87245#1172741, @Nauss wrote: > @Eary I tried doing that curve manually again in both Blender 2.93 and 3.0 and it's working in both of them for me for some reason, just not when trying it with geometry nodes. Make sure to set the twist method to z-up, then I think you should see it @Nauss
Contributor
![image.png](https://archive.blender.org/developer/F10162153/image.png) [Curve Bevel Z-Up Problem.blend](https://archive.blender.org/developer/F10162148/Curve_Bevel_Z-Up_Problem.blend)

@Eary Thanks for the clarification! I'm seeing the same problem now, just missed the twist setting.

@Eary Thanks for the clarification! I'm seeing the same problem now, just missed the twist setting.

Added subscriber: @Panel_to_panel

Added subscriber: @Panel_to_panel

I dreaming of attribute that shows point position on a curve (length), many in percents.

I dreaming of attribute that shows point position on a curve (length), many in percents.
Author
Member

In #87245#1172274, @Eary wrote:
Hmm I just tried it out using regular curves, and it some how also has the problem?

Ah, sorry, I should have clarified. Because it's Z-up normal there will always be an artifact when is passes through horizontal. But there was a bug when a spline was completely vertical that is fixed now. (Thanks Jacques!)

> In #87245#1172274, @Eary wrote: > Hmm I just tried it out using regular curves, and it some how also has the problem? Ah, sorry, I should have clarified. Because it's Z-up normal there will always be an artifact when is passes through horizontal. But there was a bug when a spline was completely vertical that is fixed now. (Thanks Jacques!)
Author
Member

In #87245#1177586, @Panel_to_panel wrote:
I dreaming of attribute that shows point position on a curve (length), many in percents.

I am too! The issue is this sort of only makes sense for poly splines, maybe for bezier splines too (definitely not NURBS), and I would like to at least aim to have a goal of consistency between them.
But maybe the limitation is fine. I'll keep this in mind.

> In #87245#1177586, @Panel_to_panel wrote: > I dreaming of attribute that shows point position on a curve (length), many in percents. I am too! The issue is this sort of only makes sense for poly splines, maybe for bezier splines too (definitely not NURBS), and I would like to at least aim to have a goal of consistency between them. But maybe the limitation is fine. I'll keep this in mind.

Added subscriber: @Astronet-4

Added subscriber: @Astronet-4
Author
Member

This task is mostly finished, so I'll close it in favor of more specific followup tasks and patches:

The "Curve profile primitive node" item doesn't feel necessary at this point, since it relates more to custom profile bevels than curves.

This task is mostly finished, so I'll close it in favor of more specific followup tasks and patches: - #88702 (Curve Deform Node) - [D12004: Geometry Nodes: Expose NURBS weight as an attribute](https://archive.blender.org/developer/D12004) - [D12550: Geometry Nodes: Add Curve Curvature Node](https://archive.blender.org/developer/D12550) - #93267 (Tangent normal calculation mode for curves) - #93268 (Bezier Splines: Support different interpolation options) The "Curve profile primitive node" item doesn't feel necessary at this point, since it relates more to custom profile bevels than curves.
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

Added subscriber: @AndyCuccaro

Added subscriber: @AndyCuccaro

Removed subscriber: @AndyCuccaro

Removed subscriber: @AndyCuccaro
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
15 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#87245
No description provided.