B-Spline interpolation in ColorRamp not behaving correctly (Ease too maybe) #108244

Open
opened 2023-05-24 22:39:09 +02:00 by Sebastien Larocque · 1 comment

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.61

Blender Version
Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash: e1ccd9d4a1d3
Worked: None.

Short description of error
B-Spline interpolation in ColorRamp not behaving correctly (Ease too maybe)

Exact steps for others to reproduce the error
*Open the attached project.
*Set to Viewport Shading to view the result.

B-Spline problem
The B-Spline interpolation in the ColorRamp node does not work as expect. To test the problem and demonstrate it, I built a test project with different scenarios.

Initially, I had noticed that certain color gradients had some sharp contrast. Since it was a B-Spline, I expected something really smooth all the way, but it was not the case.

My expectation of a B-Spline look was as demonstrated as on the following image shown on the Wikipedia article.
https://en.wikipedia.org/wiki/File:B-spline_curve.svg
https://en.wikipedia.org/wiki/B-spline

In Blender, it works well when a control point is perfectly halfway of its left and right control point neighbors. If we move the control point closer to the left or right neighbor, the curve starts to become sharper, which is not the behavior described about the B-Spline. Therefore, the trick to make it appear correctly is to position any control point perfectly in the middle of its neighbors. Varying the value (black to white) does not break anything in the expected behavior.

As far as I remember, to display a B-Spline of more than 3 control points, we have to reuse the previous control points to create this smoothness. It does not look like that here, but even with 3 control points, the smoothness is not there when moving the second control points towards the first or the third.

I tested the problem in the shader nodes to demonstrate the problem. However, the ColorRamp is available in many places like the Compositing, Geometry Nodes and other places. I presume the problem is in a library common to all places where the color ramp is accessible and probably also any B-Splines functions (maybe animation too).

Project configuration
Visualizing the B-Splines is not direct in Blender. I created a project where there are planes side by side showing the equivalent of the Y value on the X axis based on the texture coordinates.

Each plane is a test and has a different setup. Here are the descriptions of each test objects in the projects.

BSpline_Test_1: Displays correctly. Control point in the middle. Basic.
BSpline_Test_2: Displays correctly. Control point in the middle with closer control points.
BSpline_Test_3_Broken: Does not display correctly. Control points in the middle.
BSpline_Test_4_Broken: Same thing with a larger view. Illustrates the sharp corners.

Ease_Test_1, 2, 3: Display the Ease interpolation.

I also included the “Ease interpolation”. I’m not sure if there is a problem related like the B-Spline, but it does not show so smooth results. The test “Ease_Test_1” shows a problem where the tangent is always aligned with the X-axis. Is it normal? I would have expected a smooth curve when inserting a new control point. Unlike the B-Spline the Ease interpolation is always rounded, but new control points inserted between two other control points always create a “plateau” effect. To me, there is also a problem too here with the smoothness when using the Ease interpolation.

Test results
Here’s the result shown in the project here.

TestResults.jpg

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.61 **Blender Version** Broken: version: 3.5.1, branch: blender-v3.5-release, commit date: 2023-04-24 18:11, hash: `e1ccd9d4a1d3` Worked: None. **Short description of error** B-Spline interpolation in ColorRamp not behaving correctly (Ease too maybe) **Exact steps for others to reproduce the error** *Open the attached project. *Set to Viewport Shading to view the result. **B-Spline problem** The B-Spline interpolation in the ColorRamp node does not work as expect. To test the problem and demonstrate it, I built a test project with different scenarios. Initially, I had noticed that certain color gradients had some sharp contrast. Since it was a B-Spline, I expected something really smooth all the way, but it was not the case. My expectation of a B-Spline look was as demonstrated as on the following image shown on the Wikipedia article. https://en.wikipedia.org/wiki/File:B-spline_curve.svg https://en.wikipedia.org/wiki/B-spline In Blender, it works well when a control point is perfectly halfway of its left and right control point neighbors. If we move the control point closer to the left or right neighbor, the curve starts to become sharper, which is not the behavior described about the B-Spline. Therefore, the trick to make it appear correctly is to position any control point perfectly in the middle of its neighbors. Varying the value (black to white) does not break anything in the expected behavior. As far as I remember, to display a B-Spline of more than 3 control points, we have to reuse the previous control points to create this smoothness. It does not look like that here, but even with 3 control points, the smoothness is not there when moving the second control points towards the first or the third. I tested the problem in the shader nodes to demonstrate the problem. However, the ColorRamp is available in many places like the Compositing, Geometry Nodes and other places. I presume the problem is in a library common to all places where the color ramp is accessible and probably also any B-Splines functions (maybe animation too). **Project configuration** Visualizing the B-Splines is not direct in Blender. I created a project where there are planes side by side showing the equivalent of the Y value on the X axis based on the texture coordinates. Each plane is a test and has a different setup. Here are the descriptions of each test objects in the projects. BSpline_Test_1: Displays correctly. Control point in the middle. Basic. BSpline_Test_2: Displays correctly. Control point in the middle with closer control points. BSpline_Test_3_Broken: Does not display correctly. Control points in the middle. BSpline_Test_4_Broken: Same thing with a larger view. Illustrates the sharp corners. Ease_Test_1, 2, 3: Display the Ease interpolation. I also included the “Ease interpolation”. I’m not sure if there is a problem related like the B-Spline, but it does not show so smooth results. The test “Ease_Test_1” shows a problem where the tangent is always aligned with the X-axis. Is it normal? I would have expected a smooth curve when inserting a new control point. Unlike the B-Spline the Ease interpolation is always rounded, but new control points inserted between two other control points always create a “plateau” effect. To me, there is also a problem too here with the smoothness when using the Ease interpolation. **Test results** Here’s the result shown in the project here. ![TestResults.jpg](/attachments/ad65afa0-7a46-4d3f-b109-0dacebab30f9)
Sebastien Larocque added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-05-24 22:39:10 +02:00
Member

Can confirm.

Looks to me that ease is a cubic bezier with horizontal control handles placed automatically around the points and they are horizontal, looks to me that the tangent connects correctly.

Not sure what's going on with B-spline and Cardinal mode, definitely looking weird.

Looks like it's @ideasman42 's thing here.

Can confirm. Looks to me that ease is a cubic bezier with horizontal control handles placed automatically around the points and they are horizontal, looks to me that the tangent connects correctly. Not sure what's going on with B-spline and Cardinal mode, definitely looking weird. Looks like it's @ideasman42 's thing here.
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
2 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#108244
No description provided.