New surface data-block #100127

Open
opened 2022-08-01 19:30:33 +02:00 by Hans Goudey · 20 comments
Member

Background

Historically, surfaces, curves, and text object data has been grouped in the Curve data-block.
This is more of a historical relic than proper design, since there is little similarity in the data stored for each type.
With #95355, we already have a new data-type for curves that doesn't include the other two.
Any development of NURBS surfaces in Blender should probably head in that direction too.

Over the years there have been various attempts to contribute to and improve surfaces in Blender,
but the messy state of the code and design has made this hard.

Proposal

  • New Surface data-block that holds a grids of control points (separate arrays for positions, weights, and knot spans)
    Surface data-blocks have an implicit evaluated surface (evaluated after modifiers) (just a Mesh internally for now) Surface object supports attributes per control point
    • Multiple evaluation methods could be supported, with NURBS as the equivalent to the existing feature-set
  • Geometry Nodes is the main method to interact with the data prodecurally
    Some nodes could output a changed surface, other nodes create meshes or curves, etc. Surface to Mesh and Sample Surface with UV are two obvious nodes
  • Edit mode ported from existing surface edit mode
    • Initially there wouldn't need to be any changes

Future

"Solid" CAD objects are created with surface patches, so having a proper surface data-block
accessible procedurally opens door for future improvements there. Various libraries like OpenCASCADE
(used by FreeCAD) could be used to manipulate surfaces in Blender. While Blender doesn't need to
become a complete CAD tool, opening up different workflows is a more general improvement for artists too.

### Background Historically, surfaces, curves, and text object data has been grouped in the `Curve` data-block. This is more of a historical relic than proper design, since there is little similarity in the data stored for each type. With #95355, we already have a new data-type for curves that doesn't include the other two. Any development of NURBS surfaces in Blender should probably head in that direction too. Over the years there have been various attempts to contribute to and improve surfaces in Blender, but the messy state of the code and design has made this hard. ### Proposal * New `Surface` data-block that holds a grids of control points (separate arrays for positions, weights, and knot spans) **Surface data-blocks have an implicit evaluated surface (evaluated after modifiers) (just a `Mesh` internally for now)** Surface object supports attributes per control point * Multiple evaluation methods could be supported, with NURBS as the equivalent to the existing feature-set * Geometry Nodes is the main method to interact with the data prodecurally **Some nodes could output a changed surface, other nodes create meshes or curves, etc.** `Surface to Mesh` and `Sample Surface with UV` are two obvious nodes * Edit mode ported from existing surface edit mode * Initially there wouldn't need to be any changes ### Future "Solid" CAD objects are created with surface patches, so having a proper surface data-block accessible procedurally opens door for future improvements there. Various libraries like OpenCASCADE (used by FreeCAD) could be used to manipulate surfaces in Blender. While Blender doesn't need to become a complete CAD tool, opening up different workflows is a more general improvement for artists too. * Allow attaching trim curves to surface in UV space (https://devtalk.blender.org/t/better-curve-surface-support/21113) * ...
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: @mod_moder

Added subscriber: @mod_moder
Author
Member

To clarify, I'm not planning on working on this now, but I'd like to settle on a design so contributors could work on this instead of being turned away. I would be happy to help anyone who wants to work on such a project.

To clarify, I'm not planning on working on this now, but I'd like to settle on a design so contributors could work on this instead of being turned away. I would be happy to help anyone who wants to work on such a project.

Added subscriber: @rygelXVI

Added subscriber: @rygelXVI

Added subscriber: @Yuro

Added subscriber: @Yuro
Contributor

Added subscriber: @laurynas

Added subscriber: @laurynas
Contributor

New Surface data-block that holds a grid of NURBS control points

Will it be only one grid per data-block or few?

separate arrays for positions, weights, and knot spans

Are weights meant to be in a separate array from positions?

> New Surface data-block that holds a grid of NURBS control points Will it be only one grid per data-block or few? > separate arrays for positions, weights, and knot spans Are weights meant to be in a separate array from positions?

This goes along with the idea of the attribute as a separate data block. How the surface geometry structure is organized will depend on the implementation.

This goes along with the idea of the attribute as a separate data block. How the surface geometry structure is organized will depend on the implementation.
Author
Member

Will it be only one grid per data-block or few?

I think it would be more than one grid, like the current surface object, and like the new "Curves" type.

I'd also imagine a similar approach to the curves object-- the control point data for all grids would be stored contiguously in one array.

Are weights meant to be in a separate array from positions?

Yeah, the idea is to move away from using specific structs like BPoint and instead use generic types like float3 and float.
That way if we want to deform the surface control points, we just need to pass the array to a generic function (like in the set position node, etc.)

>Will it be only one grid per data-block or few? I think it would be more than one grid, like the current surface object, and like the new "Curves" type. I'd also imagine a similar approach to the curves object-- the control point data for all grids would be stored contiguously in one array. >Are weights meant to be in a separate array from positions? Yeah, the idea is to move away from using specific structs like `BPoint` and instead use generic types like `float3` and `float`. That way if we want to deform the surface control points, we just need to pass the array to a generic function (like in the set position node, etc.)
Member

Added subscriber: @lone_noel

Added subscriber: @lone_noel

Added subscriber: @xrogueleaderx

Added subscriber: @xrogueleaderx

Added subscriber: @GeorgiaPacific

Added subscriber: @GeorgiaPacific

Added subscriber: @surfacionado

Added subscriber: @surfacionado

Hello Hans

we are actually good with just cirrectly rendering Bezier patches
(ie NURBS with maximal number of inserted knots = degree+1 many)
since one can always build spline surfaces in Bezier form (for example using B-splines or Polyhedral Splines).

The question is whether one should do the evaluation and rendering in software (C++)
or
use the tessellation engine (that was introduced for that purpose), i.e. a "shader" program (quite standard)

Hello Hans we are actually good with just cirrectly rendering Bezier patches (ie NURBS with maximal number of inserted knots = degree+1 many) since one can always build spline surfaces in Bezier form (for example using B-splines or Polyhedral Splines). The question is whether one should do the evaluation and rendering in software (C++) or use the tessellation engine (that was introduced for that purpose), i.e. a "shader" program (quite standard)
Author
Member

Hi @surfacionado. In the end I think it would be important to support both. CPU evaluation would be used to interface with other CPU algorithms. GPU evaluation could be used for rendering, and eventually more generic GPU algorithms as we move some other processing to the GPU.

As for spline types, I think the surfaces could support multiple types, just like the curves (#68981, etc.). I wouldn't imagine it would be too complex to have an initial implementation with a simple type like Bezier patches while keeping the possibility of other types open for the future.
That's basically what we have right now with the GPU evaluation of the new Curves type anyway.

Hi @surfacionado. In the end I think it would be important to support both. CPU evaluation would be used to interface with other CPU algorithms. GPU evaluation could be used for rendering, and eventually more generic GPU algorithms as we move some other processing to the GPU. As for spline types, I think the surfaces could support multiple types, just like the curves (#68981, etc.). I wouldn't imagine it would be too complex to have an initial implementation with a simple type like Bezier patches while keeping the possibility of other types open for the future. That's basically what we have right now with the GPU evaluation of the new `Curves` type anyway.

How do we find the Curves implementation in Blender?
If it already uses the Tessellation Engine, it should not be tricky to make the same evaluation sequence happen for Bezier surfaces by seeing how it is linked to the Blender C++ code.

How do we find the Curves implementation in Blender? If it already uses the Tessellation Engine, it should not be tricky to make the same evaluation sequence happen for Bezier surfaces by seeing how it is linked to the Blender C++ code.
Author
Member

Curves in Blender are undergoing a large rewrite at the moment. To find the new curves type, some terms to search for are Curves, CurvesGeometry, OB_CURVES. Some related tasks are #68981, #95355, #96455.

To use a similar process for surfaces, I do think the first step is a new data-block type as described in this task. It's a bit hard to render arbitrary data without first sending it through depsgraph evaluation.

Curves in Blender are undergoing a large rewrite at the moment. To find the new curves type, some terms to search for are `Curves`, `CurvesGeometry`, `OB_CURVES`. Some related tasks are #68981, #95355, #96455. To use a similar process for surfaces, I do think the first step is a new data-block type as described in this task. It's a bit hard to render arbitrary data without first sending it through depsgraph evaluation.

Added subscriber: @pafurijaz-4

Added subscriber: @pafurijaz-4

Added subscriber: @Schiette

Added subscriber: @Schiette
Bastien Montagne added this to the Core project 2023-02-09 15:42:54 +01:00
Bastien Montagne removed this from the Core project 2023-02-09 18:20:30 +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
11 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#100127
No description provided.