Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force spline normal to be always world up
#1
Hi there, I am trying to use curvy to generate a race track with curves and slopes. However, the curves tilt the normal of the track. I see that there are different orientation modes but those are all manual. Is it possible to force all spline normal to be world up?
Reply
#2
Hi
By setting the Orientation parameter of your spline to Static, and making sure all your Control Points have their local Y axis alligned with the world's Y one.
More about that parameter here:
https://curvyeditor.com/documentation/splines/curvyspline?redirect=1#orientation
Did this help?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(07-30-2022, 12:08 PM)_Aka_ Wrote: Hi
By setting the Orientation parameter of your spline to Static, and making sure all your Control Points have their local Y axis alligned with the world's Y one.
More about that parameter here:
https://curvyeditor.com/documentation/splines/curvyspline?redirect=1#orientation
Did this help?

Thanks for the help! I changed my input spline path's orientation to "static", and all my control points have 0, 0, 0 as their rotations. However, you can see that the generated mesh is still tilted. I placed a cuboid that's parallel to the xz plane.

[Image: H1pSQnb.png]
Reply
#4
Hi
Can you send me a reproduction case please, that way I could easily see what's wrong.
Thanks and have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
(08-01-2022, 11:14 AM)_Aka_ Wrote: Hi
Can you send me a reproduction case please, that way I could easily see what's wrong.
Thanks and have a nice day

I created a repro scene in this unitypackage. Correct me if I am wrong, but I think if the track's normal is world up, each line across on the texture should be parallel to the xz plane, which isn't the case here. (the white cube is parallel to the xz plane) Thanks again!

[Image: G9xsb6a.png]


Attached Files
.unitypackage   CurvyRepro.unitypackage (Size: 9.93 KB / Downloads: 2)
Reply
#6
Thanks. I will take a look at this as soon as possible, later today or tomorrow most probably.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
Hi

Thanks for your patience.

In the following post, I assume that you read the Orientation documentation (that you can find in the link I post earlier https://curvyeditor.com/documentation/splines/curvyspline?redirect=1#orientation) and that you are familiar with the concept of Orientation Anchor.

I will divide my answer into two, one about the normals being towards the world up vector, and the second regarding UVs.

1- The normals

The normals (also called orientation) are defined as being perpendicular to the spline's tangents. If the spline tangents are not all restricted to the XZ plane, then the normals could not be all equal to the world Up vector (0,0,1). If this previous sentence is clear to you, then you can skip to section 2, otherwise, here is an illustrated explanation:

In the following screenshot, I modified your spline. I did not change it's shape, only its normals, by setting the spline orientation type to Dynamic, setting all the Control Points (CPs) as Orientation Anchors, and rotating the CPs until I got the following result:
   
In green are the spline tangents. In yellow the normals. The long yellow lines are the normals of the orientation anchors.
As you can see, all the the normals are perpendicular to the tangents, which is what they are supposed to be.

I can rotate the middle CP to have it's normal equal to the world up vector, but that can be done only locally (around the middle CP). The shape of the spline makes it impossible to do for all the points of the spline while keeping the normals perpendicular to the tangents.
   

If you want the normals to be equal to the world up vector through the whole spline, then you need to change the shape of your spline, by setting all the CPs Y coordinate to the same value.
   

2- The UVs

The meshes created via the Shape Extrusion module have their UVs orientated the same way as the surface is, which in turn depends on the path spline's normals. There are no options to rotate the UVs independently from the surface's shape. There are only options to offset, scale, swap, and change the aspect ratio of the UVs.
https://curvyeditor.com/documentation/ge...#materials

Did I answer all your question?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
(08-03-2022, 01:33 PM)_Aka_ Wrote: Hi

Thanks for your patience.

In the following post, I assume that you read the Orientation documentation (that you can find in the link I post earlier https://curvyeditor.com/documentation/splines/curvyspline?redirect=1#orientation) and that you are familiar with the concept of Orientation Anchor.

I will divide my answer into two, one about the normals being towards the world up vector, and the second regarding UVs.

1- The normals

The normals (also called orientation) are defined as being perpendicular to the spline's tangents. If the spline tangents are not all restricted to the XZ plane, then the normals could not be all equal to the world Up vector (0,0,1). If this previous sentence is clear to you, then you can skip to section 2, otherwise, here is an illustrated explanation:

In the following screenshot, I modified your spline. I did not change it's shape, only its normals, by setting the spline orientation type to Dynamic, setting all the Control Points (CPs) as Orientation Anchors, and rotating the CPs until I got the following result:

In green are the spline tangents. In yellow the normals. The long yellow lines are the normals of the orientation anchors.
As you can see, all the the normals are perpendicular to the tangents, which is what they are supposed to be.

I can rotate the middle CP to have it's normal equal to the world up vector, but that can be done only locally (around the middle CP). The shape of the spline makes it impossible to do for all the points of the spline while keeping the normals perpendicular to the tangents.


If you want the normals to be equal to the world up vector through the whole spline, then you need to change the shape of your spline, by setting all the CPs Y coordinate to the same value.


2- The UVs

The meshes created via the Shape Extrusion module have their UVs orientated the same way as the surface is, which in turn depends on the path spline's normals. There are no options to rotate the UVs independently from the surface's shape. There are only options to offset, scale, swap, and change the aspect ratio of the UVs.
https://curvyeditor.com/documentation/ge...#materials

Did I answer all your question?
Have a nice day

Thank you for the detailed explanation. It made me realize that my terminologies are incorrect. Let me explain what I am looking for again:

Assuming in local coordinates of each point in the spline. Up/down/y is the point's normal, left/right/x is the spline's cross direction, and forward/backward/z is the direction in which the spline is going towards, I am looking to make sure that the local x value is 0 is all the spline's normals. Having a non-zero local x component makes the generated mesh "tilt"

Have a nice day too!
Reply
#9
Hi
My understanding of what you said is the following:
You want that the no point on the spline should have a tilt, thus leading to at no point we should be able to see the lateral faces of the mesh when looking from an orthogonal top view. In other words, the face surrounded with red in the bellow screenshot should not be visible
   
If am wrong, feel free to explain to me using visuals.

If my understanding is correct, the solution would be to set the spline's orientation to Dynamic, all its CPs to Orientation Anchor, and then all the rotations of the CPs to 0,0,0 (or different values if your prefer). Note that the first and last CP of a spline are by default Orientation Anchors, so that option is not settable through their inspector.
This gives the following result
   
Notice that there are still lateral faces visible on the right part of the image. What I found solved this, is to add more CPs to the spline. You can easily do that automatically by using the Subdivide tool. The newly created CP(s) need also to be an Orientation Anchor.
This is the result I got by adding one CP between the last two CPs.
   
Did this help?

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#10
(08-04-2022, 12:22 PM)_Aka_ Wrote: Hi
My understanding of what you said is the following:
You want that the no point on the spline should have a tilt, thus leading to at no point we should be able to see the lateral faces of the mesh when looking from an orthogonal top view. In other words, the face surrounded with red in the bellow screenshot should not be visible

If am wrong, feel free to explain to me using visuals.

If my understanding is correct, the solution would be to set the spline's orientation to Dynamic, all its CPs to Orientation Anchor, and then all the rotations of the CPs to 0,0,0 (or different values if your prefer). Note that the first and last CP of a spline are by default Orientation Anchors, so that option is not settable through their inspector.
This gives the following result

Notice that there are still lateral faces visible on the right part of the image. What I found solved this, is to add more CPs to the spline. You can easily do that automatically by using the Subdivide tool. The newly created CP(s) need also to be an Orientation Anchor.
This is the result I got by adding one CP between the last two CPs.

Did this help?

Have a nice day

This is perfect. Thank you very much for your help!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Odd behavior when drawing spline ricke 9 12 11-28-2022, 10:34 AM
Last Post: _Aka_
  Input Spline Shapes from Prefabs destroys graph tairoark 5 6 11-24-2022, 05:08 PM
Last Post: _Aka_
  Scale Deform Mesh Along Spline? / aligning colliders MamasToast 9 61 10-31-2022, 03:44 AM
Last Post: tairoark
  Gap between spline mesh segments Beaver_Boy 13 66 10-24-2022, 09:37 AM
Last Post: dromo

Forum Jump: