Setting curves to another spline type makes them shorter #86086

Open
opened 2021-02-28 15:41:34 +01:00 by Daniel Bystedt · 20 comments
Member

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.79

Blender Version
Broken: version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: 02948a2cab
Worked: (newest version of Blender that worked as expected)

Short description of error
I discussed this with Campbell during a meeting 2021-02-23. He suggested that I report it as a bug.

When setting curve spline type from nurbs to bezier, the curve becomes shorter. It also becomes shorter when I convert itfrom bezier to nurbs.

It is worth to note that when converting from bezier to nurbs, the curve can get back the length by changing the following settings in
object data properties > active spline
image.png


Screen grab of issue

convert curve spline makes it shorter.mp4

Exact steps for others to reproduce the error

  • Add curve > path
  • Go into curve edit mode
  • Subdivide the curve 2 times in order to get enough vertices for changing spline type to bezier
  • Change spline type from Nurbs to Bezier - observe that the curve becomes shorter.

Change spline type from Bezier to Nurbs - observe that the curve becomes shorter

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.79 **Blender Version** Broken: version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: `02948a2cab` Worked: (newest version of Blender that worked as expected) **Short description of error** I discussed this with Campbell during a meeting 2021-02-23. He suggested that I report it as a bug. When setting curve spline type **from nurbs to bezier**, the curve becomes shorter. It also becomes shorter when I convert it**from bezier to nurbs**. It is worth to note that when converting from bezier to nurbs, the curve can get back the length by changing the following settings in object data properties > active spline ![image.png](https://archive.blender.org/developer/F9852332/image.png) --- Screen grab of issue [convert curve spline makes it shorter.mp4](https://archive.blender.org/developer/F9852336/convert_curve_spline_makes_it_shorter.mp4) **Exact steps for others to reproduce the error** - Add curve > path - Go into curve edit mode - Subdivide the curve 2 times in order to get enough vertices for changing spline type to bezier - Change spline type from Nurbs to Bezier - observe that the curve becomes shorter. # Change spline type from Bezier to Nurbs - observe that the curve becomes shorter
Author
Member

Added subscriber: @DanielBystedt

Added subscriber: @DanielBystedt
Member

Added subscriber: @filedescriptor

Added subscriber: @filedescriptor
Member

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

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

Can confirm this on the 2.92 release and the latest 2.93.0 Alpha, branch: master, commit date: 2021-03-01 06:12, hash: bfc70a6a95.

Can confirm this on the 2.92 release and the latest 2.93.0 Alpha, branch: master, commit date: 2021-03-01 06:12, hash: `bfc70a6a95`.

Added subscriber: @mont29

Added subscriber: @mont29

Would consider that a known issue rather than a bug, this is just the conversion 'algorithm' being dumb and super-basic, instead of trying to be smart...

Note that you will always lose some data during such conversion anyway, since interpolation methods are quiet different.

Would consider that a known issue rather than a bug, this is just the conversion 'algorithm' being dumb and super-basic, instead of trying to be smart... Note that you will always lose some data during such conversion anyway, since interpolation methods are quiet different.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Setting as paper-cut since this should be straightforward.

The desirable behavior is to keep the same number of knots (control points) for each curve type instead of treating the handles of a bezier curve as knots.

Setting as paper-cut since this should be straightforward. The desirable behavior is to keep the same number of knots (control points) for each curve type instead of treating the handles of a bezier curve as knots.

Added subscriber: @KiloCharlieAlpha

Added subscriber: @KiloCharlieAlpha

Hi, new dev here. May I have a go at this? Also, any deadlines to complete this?

Hi, new dev here. May I have a go at this? Also, any deadlines to complete this?
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

Hi @KiloCharlieAlpha, the curve code is in a bit of a state of flux currently with the work on curves in geometry nodes for 3.0.
We have introduced a new data structure with support for attributes, clearer code, and better performance.

In geometry nodes there is a "Set Spline Type" node with an implementation the 6 type conversions.
If you're interested, you could look at changing the behavior in the node. Then as we transition edit mode curves to use
that data structure (still a loose plan at this point), we would get the improvements there too.

That said, I'm not sure I'd call this behavior a bug-- there are two possible goals here, keep the shape of the input curve, and keep the length.
AFAIK, the "dumb" algorithm that shortens the curve also keeps the shape quite nicely. Still worth some investigation though!

Hi @KiloCharlieAlpha, the curve code is in a bit of a state of flux currently with the work on curves in geometry nodes for 3.0. We have introduced a new data structure with support for attributes, clearer code, and better performance. In geometry nodes there is a "Set Spline Type" node with an implementation the 6 type conversions. If you're interested, you could look at changing the behavior in the node. Then as we transition edit mode curves to use that data structure (still a loose plan at this point), we would get the improvements there too. That said, I'm not sure I'd call this behavior a bug-- there are two possible goals here, keep the shape of the input curve, and keep the length. AFAIK, the "dumb" algorithm that shortens the curve also keeps the shape quite nicely. Still worth some investigation though!

I tried converting a simple Bezier with 2 BezTriples to NURBS. It doesnt generate any knots because the curve is invalid:

  • In BKE_nurb_check_valid_u, it checks if the number of ctrl pts is less than the order, that looks correct to me, but why does it only use the ctrl pts in the 2 BezTriples? Should it use the 2nd handle of the first ctrl pt, and the first handle of the second ctrl pt to make it 4 ctrl pts so that the validity check passes? But this still fails the next check, where 4th order Beziers must have at least 5 points, but isn't 4 points sufficient?

I have only worked with Beziers and B-splines, not NURBS, and even the Beziers I work with are 4 ctrl pts per segment, so these triples are confusing to me as well.

I tried converting a simple Bezier with 2 BezTriples to NURBS. It doesnt generate any knots because the curve is invalid: - In BKE_nurb_check_valid_u, it checks if the number of ctrl pts is less than the order, that looks correct to me, but why does it only use the ctrl pts in the 2 BezTriples? Should it use the 2nd handle of the first ctrl pt, and the first handle of the second ctrl pt to make it 4 ctrl pts so that the validity check passes? But this still fails the next check, where 4th order Beziers must have at least 5 points, but isn't 4 points sufficient? I have only worked with Beziers and B-splines, not NURBS, and even the Beziers I work with are 4 ctrl pts per segment, so these triples are confusing to me as well.

Removed subscriber: @KiloCharlieAlpha

Removed subscriber: @KiloCharlieAlpha

Added subscriber: @ksar

Added subscriber: @ksar

Hi, I think maybe I can have a try.

Hi, I think maybe I can have a try.
Member

I'm removing the "Good First Issue' tag from this one since I'm not convinced it's actually a bug (as in, the current algorithm is working as expected, it's not some easy mistake to fix). The conversions can be improved, but I would like that to be done for the set spline type node, since the edit mode code will be replaced with that version at some point.

I'm removing the "Good First Issue' tag from this one since I'm not convinced it's actually a bug (as in, the current algorithm is working as expected, it's not some easy mistake to fix). The conversions can be improved, but I would like that to be done for the set spline type node, since the edit mode code will be replaced with that version at some point.

Yes, since the interpolation methods are different, different performances are expected. However, should the backward conversion keep a consistent shape?

Yes, since the interpolation methods are different, different performances are expected. However, should the backward conversion keep a consistent shape?

Added subscriber: @pmakal

Added subscriber: @pmakal

@HooglyBoogly if you have a minute please take a look at: D13546

@HooglyBoogly if you have a minute please take a look at: [D13546](https://archive.blender.org/developer/D13546)
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:28:40 +01:00
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
8 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#86086
No description provided.