Curve evaluation / to points for instancing #87429

Closed
opened 2021-04-12 15:40:03 +02:00 by Hans Goudey · 10 comments
Member

{F10158372 size=full}

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
{[F10158372](https://archive.blender.org/developer/F10158372/image.png) size=full} ### 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
Author
Member

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

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

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly

Added subscriber: @MiroHorvath

Added subscriber: @MiroHorvath
Hans Goudey self-assigned this 2021-05-06 01:40:26 +02:00
Author
Member

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.

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.

This issue was referenced by 3185084efb

This issue was referenced by 3185084efbe493bf232fb0de62b341ae2a2e2936
Hans Goudey removed their assignment 2021-05-11 04:21:46 +02:00
Hans Goudey changed title from Curve Sample Points Node to Curve to Points Node 2021-05-11 04:24:36 +02:00
Hans Goudey changed title from Curve to Points Node to Curve evaluation for instancing 2021-06-05 00:13:07 +02:00
Hans Goudey self-assigned this 2021-06-05 00:13:07 +02:00
Hans Goudey changed title from Curve evaluation for instancing to Curve evaluation / to points for instancing 2021-06-05 00:13:35 +02:00

Added subscriber: @GeorgiaPacific

Added subscriber: @GeorgiaPacific
Author
Member

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.

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.

Added subscriber: @jmargaud

Added subscriber: @jmargaud

This issue was referenced by fcbb20286a

This issue was referenced by fcbb20286a3163d1d6669502375aa3f096e9547a

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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
6 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#87429
No description provided.