RFE Dedicated Cubic Bezier Primitive Type

   609   4   1
User Avatar
Member
289 posts
Joined: June 2013
Offline
I'm not sure if a dedicated primitive type is the solution or a new sampling suffices, but I'll explain the goals.

When I consider the artist friendliness of beziers I don't bear in mind the cubic interpolation calculation, instead its mostly about how to achieve a desired shape, usually by first setting up the control points (where curve passes through) and then adjust the attached tangent handles to tweak the shape.

Accordingly, if I'm looking out to distribute values on said bezier curve I would consider the control points (CPs) to be the appropriate place to set up "key" values that would then be interpolated from CP to CP. But... Right now sampling a bezier curve with either Resample SOP or VEX primuv() will also partially take into account the handles information, which is the correct way to solve the cubic interpolation for the position, but not very useful to define linear, 0 to 1, transitions along the curve.

(Maybe then it will be possible to "roll" the curve like in Blender?)


Following this, I wondered, why not have dedicated primitive type in Houdini, a cubic bezier curve where the only explicit points are the CPs, and the tangent handles are a position vector relative to the CPs and stored in them, like v@handle_in/v@handle_out (with attributetypeinfo "vector" so they are transformed by SOP tools). I wonder if this would be a good use case for "point intrinsics" or "vertex intrinsics".



Some stretch ideas: (old gifs)
1) i@handle_auto, that defines if the CP handles will be explicit (default) or automatically adjusted to their neighbors (smooth spline or linear corner), which can be much more artist friendly than constantly readjusting handles.


2) i@handle_uv, that defines if the CP' uv sampling will be tied to UNIT or UNITLEN.


While it would probably be locked into order 4 (cubic) and necessitate a SOP to manipulate the tangent attributes in the viewport and interact with other explicit geometry, I think there will be some interesting advantages:
- A Polyline and a Bezier have the same amount of points, the latter just needs a tangent handles attributes added. This addresses the current kink when converting polyline to bezier and the polyline not having enough points for the target bezier order, aborting the conversion.
- Also going from a chain of line segments (Polyline SOP -> Convert Line SOP) to Bezier will produce the same shape but with individual bezier segments.
- CPs are neighbors of each other and not of the handles.
- Less finnicky routines to constantly distinguish CP points from handle points and have them share attributes even though they were only intended for CPs.
- Procedurally Turbulizing/Displacing the curve's points won't break its continuity.
- No need to constantly make the absolute handles position, relative to the CPs and then back to absolute; so using VEX on them is more straight forward.
- This hierarchical representation with Implicit tangents seems to be common among other applications and maybe could provide better bridging, like for example do away with "Unreal Spline Resolution" in Houdini Engine.
- Would not replacing existing Bezier primitive type.

Curve2.0 brought us amazing and due improvements; here I'm just pushing the whole thing a bit more for workflows that I think will make setups and interactions with beziers more rational and artist friendly.

Cheers
prb
Edited by probiner - May 29, 2022 15:53:56

Attachments:
RFE_CubicBevierCPs_PrimitiveType.hip (244.5 KB)

User Avatar
Member
187 posts
Joined: Nov. 2013
Offline
In the past when I've needed interpolation through just the knot points I've computed the interpolated "handle" values in a wrangle. Maybe there's an easier way than vex but an example is attached.
Edited by antc - May 28, 2022 19:40:06

Attachments:
interpolate_handles.gif (82.0 KB)
interpolate.hipnc (145.0 KB)

User Avatar
Member
289 posts
Joined: June 2013
Offline
@antc
That almost works! Although the idea is to have access to this sampling straight forward.

I changed the position of the Bezier CPs and made Cd.x into @width for polyframe. In the image, top your setup, bottom what I'm going for here with, linearly sampling along the curve's length. Admittedly I had to fix the first post's file to depict that accurately.


Thanks
Edited by probiner - May 29, 2022 15:54:50
User Avatar
Member
187 posts
Joined: Nov. 2013
Offline
Ah ok, yeah I've never needed it to be super accurate. I guess you could always interpolate the data on the resampled poly line based on each segment length if you wanted something 100% accurate. I agree though it would be nice if this was easier. It would be cool if it were possible to add a side car attribute which detailed for a given attribute which points were supposed to take part in the interpolation. That way you could even skip internal knots if desired. A common need for width for example is to have a linear transition from base to tip regardless of all the control points required to get the desired shape.

Also it would be nice to see some updated nodes for manipulating parametric curves in general (splitting, subdividing, rebuilding etc). Part of the problem in your example is that the parametric space of the curve is heavily weighted towards the end due to the extreme difference in hull lengths. If it were simple to rebuild the curve into a series of even length beziers the parametric space would be more uniform and easier to work with. The carve node can only subdivide based on parametric length, not arc length and so isn't much help. That said the math for subdividing a bezier curve is pretty straight forward and easy to do in a wrangle. I have the vex for that somewhere and can dig it out if it's helpful to you.
Edited by antc - May 30, 2022 18:45:50
User Avatar
Member
289 posts
Joined: June 2013
Offline
antc
Ah ok, yeah I've never needed it to be super accurate. I guess you could always interpolate the data on the resampled poly line based on each segment length if you wanted something 100% accurate. I agree though it would be nice if this was easier. It would be cool if it were possible to add a side car attribute which detailed for a given attribute which points were supposed to take part in the interpolation. That way you could even skip internal knots if desired. A common need for width for example is to have a linear transition from base to tip regardless of all the control points required to get the desired shape.
Correct, in a way that would be the comprehensive best. Your mentioned exampled is somewhat easy to solve with a Ramp, but the one where you want to skip particular knots its indeed harder cause even with a ramp you have to guess the U of the control points and they don't sync with added/deleted points.

antc
Also it would be nice to see some updated nodes for manipulating parametric curves in general (splitting, subdividing, rebuilding etc). Part of the problem in your example is that the parametric space of the curve is heavily weighted towards the end due to the extreme difference in hull lengths. If it were simple to rebuild the curve into a series of even length beziers the parametric space would be more uniform and easier to work with. The carve node can only subdivide based on parametric length, not arc length and so isn't much help. That said the math for subdividing a bezier curve is pretty straight forward and easy to do in a wrangle. I have the vex for that somewhere and can dig it out if it's helpful to you.
Yup, splitting the bezier into it's own isolated sections is how I achieve most of those, I was just on the look out to have these done in a more straight forward, supported fashion, instead of cutting them into isolated beziers at the control points. While primuvconvert() function can help with a lot of this, it's too slow imho to be relied on heavily.
Not sure how I would split sections for NURBS, but for splitting I did this back then:
[twitter.com]
Thanks for the offer and feedback!

Cheers
prb
  • Quick Links