3
$\begingroup$

I'm trying to understand how a 2-D profile curve is oriented when it is extruded along another curve path. i.e. when using the curve to mesh geo node.

I've gathered that the 2D profile curve should be constrained to the XY plane, and that the origin point of the profile curve will follow the path itself. The XY plane will be perpendicular to the curve path, with Z going along the curve path.

However, the XY plane could be in any rotation around the curve path and still satisfy the conditions above. But I need the profile to be oriented in a particular direction. The only solution I have right now is to make the profile curve to the shape I want, then rotate it until the resulting extruded path looks right. But this is inefficient and heaven forbid I have to use the same profile in two unrelated geometries.

This post states that the "Y" direction in the profile curve will become aligned with the global "Z" direction in the output. But my test showed the opposite (that is, -Y was aligned with +Z), so I think some understanding is still missing. Can someone clarify?

The example is a simple plane mesh that has been converted to a curve, with a simple profile curve as shown on the left in the screenshot. The object on the right is generated using geo-nodes. The yellow outline is the path curve. All transforms are applied on both the profile curve and the path curve in this example.

enter image description here

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ The post you've linked to which states that +Y will become +Z (curve local, not global) is correct. In the question and answer they are talking about using a curve as profile in the Geometry > Bevel > Object settings of the curve's Object Data Properties. You are talking about using the Curve to Mesh node in Geometry Nodes - they don't work the same. $\endgroup$ Commented Feb 19, 2023 at 16:19
  • $\begingroup$ @GordonBrinkmann: ok, thanks for that clarification. so...the question remains - how does XY orientation work with the Curve to Mesh node? $\endgroup$
    – rothloup
    Commented Feb 19, 2023 at 20:11
  • 1
    $\begingroup$ It's time for me to go to bed now, but I'm preparing a detailed answer - but you already figured it out I guess. Profile origin is on the curve, +X goes to the "right" in curve direction, -Y goes "up" in curve direction. Only thing you don't know is probably in which direction the curve goes when you convert a mesh (like the plane in your example) into a curve. But I'd say along the indices of the vertices (can't test it now). $\endgroup$ Commented Feb 19, 2023 at 22:25
  • $\begingroup$ I look forward to your detailed answer...I'm sure I'll learn something. I have no idea if my experience on this one project generalizes to all cases. $\endgroup$
    – rothloup
    Commented Feb 20, 2023 at 4:31
  • 1
    $\begingroup$ I hope the answer helps. $\endgroup$ Commented Feb 20, 2023 at 14:36

1 Answer 1

5
$\begingroup$

First of all a quick information: the alignment of profile curves along a curve path in Blender is different between the Geometry > Bevel > Object option in the curve's Object Data Properties and the Geometry Nodes method where you use the Curve to Mesh node to extrude a profile along the curve.

So these are the two methods, to the left the Object Data Properties where you can use a profile curve to "bevel" the curve to get a mesh. To the right a simple Geometry Nodes setup with which you can create a mesh from a curve and a profile. (I start with a curve instead of converting a mesh beforehand like in the question to use the same curve for both methods.)

curve profile methods

The next image shows the curve and the profile I used. Important: the following explanations are based on all objects having their rotations, scales etc. applied, otherwise you might get differing results.

On the left is the curve I used, a simple Bézier curve. In Edit Mode with Normals enabled you can see in which direction the curve is moving "forward". I also defined a "right" side of the curve as well as "up" and "down" for convenience and demonstration purposes. On the right is the 2D profile curve in top down view so that you can see its XY alignment.

curve and profile

A comparison between the "Bevel" method and the "Curve to Mesh" method now shows a significant difference in the results. Both methods extrude the profile with its origin point on the curve, but while the "Bevel" method uses the profile in forward direction as it appears when you look at it top down - the +X is on the "right" side of the curve and the +Y is "up" - the "Curve to Mesh" method flips the profile. +X is still on the "right" side, but +Y is now pointing "down".

method comparison

Looking at the profile curve again, this is what you discover: the "Bevel" method (left) extrudes the profile more "intuitively" correct (or at least so it feels to me), as if looking down on it is looking in curve forward direction. The "Curve to Mesh" method (right) seems to be somehow incorrect, as it is not just rotated 180° when looking down on it, but flipped (mirrored) on the X axis:

profile alignment

Admittedly I have no idea why the "Bevel" method works this way, because although it feels more correct to me, I will show why the "Curve to Mesh" method is more consistent with the curve's orientation and since you are especially interested in the Geometry Nodes version, let's focus on that.

To see what's going on with the curve I built an object with arrows pointing in the direction of the three positive axes X, Y and Z and instanced it on the curve. Without any aligned orientation, they simply still point to global X, Y and Z.

orientation pointers instanced on curve

Let's find some alignment for the arrow object. Since our profile lies in the XY plane, we assume the Z direction as the curve's "forward" direction. Forward is in this case the curve's tangent. So I use an Align Euler to Vector node to align the object's Z to the tangent vector. Now the blue Z arrow is pointing "forward", the other arrows are not aligned yet:

Z aligned to tangent

Both methods have +X pointing to the "right", which is the direction of the curve normal. In order to align the X of the object with the normal, the output of the Align Euler to Vector needs to be plugged into another Align Euler to Vector node. This time to align X with the already aligned Z axis as pivot. And if you look at the result you might notice the following: the +Y arrow is now pointing down. This is the "natural" alignment of the curve, this is the way the profile is oriented and this is why I called the "Curve to Mesh" method more correct than the "Bevel" method:

object fully aligned to curve

Although I defined the convention to use the terms "right", "up" and "down" on the curve, these directions are not always so easy to determine. In the previous example "right" was always in the XY plane and "up" and "down" were in Z direction. However, if curve points are tilted, this is no longer true. In the following setup I use the Set Curve Tilt node together with the Index to increase the tilt from start to end:

tilted curve

And of course this influences the alignment of the profile as well:

tilted profile

The "forward" on the other hand is clearly defined: in Geometry Nodes, it's the direction from the point with the lowest index to the point with the highest index. On a curve object in Edit Mode this direction is shown (like before) with the Normals overlay enabled. In your case where you have a mesh plane as original object, this option is not available. Nevertheless the direction is the same: from lowest index to highest index.

In the image below there is a mesh plane converted to a curve. To simply show in which order the points are numbered I instanced cubes on the points and scaled them on the Z axis by their index, i.e. the smallest cube is index 0, the largest index 3.

With the things said before this means the "forward" direction of the curve is going from 0 to 1, then further to 2 and 3, the curve's "right" side (which is the profile's +X) is pointing inside the square and the curve's "down" (and profile's +Y) is pointing down Z. From this the assumption can be drawn that the profile will be extruded along the curve as shown by the dotted lines:

determining the extrusion alignment

Using a Curve to Mesh node now with the profile plugged in, the result is as expected. The "bulged" part is on the inside of the square pointing upwards:

mesh to curve to mesh

$\endgroup$
3
  • $\begingroup$ Thank you for an absolutely fantastic answer. You not only answered my question, you showed me the structure behind the answer and even taught about some geo nodes I haven't used yet. $\endgroup$
    – rothloup
    Commented Feb 20, 2023 at 16:00
  • 1
    $\begingroup$ So the geo-nodes method obeys the right-handed 3D coord system rule (z_hat=x_hat X y_hat), but the geometry bevel method violates it. Perhaps because it "feels right", as you mentioned, but the geo node method is more correct and easier to avoid weird bugs/misunderstandings when combined with other vector math calculations. You can see this in your 4th pic - the +Z axis is "forward" on the curve, which should be into the screen. The geo node accomplishes that by flipping Y to face down. In fact, viewing a scene from the -Z direction (i.e. along the curve) shows the XY axis as you describe. $\endgroup$
    – rothloup
    Commented Feb 20, 2023 at 16:11
  • 1
    $\begingroup$ @rothloup Yes, you're correct. I didn't know how much mathematical background you have, but the right-hand rule is exactly what I was talking about without using the term ;) $\endgroup$ Commented Feb 20, 2023 at 16:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .