Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changes in splines' sampling parameters
In Curvy 2.2.3, some values related to splines sampling will be marked as obsolete, and will be remove in a future release. I post here to explain why those changes were done, and how they will impact you.

Why changing
If you wonder what splines sampling is, I will explain it in this paragraph. Otherwise just skip to the next one.
Spline sampling is the process of selecting a finite number of points to represent the spline's shape, which is made of an infinite number of points. The more points are in your sample, the closest it can get to the original shape of the spline.
Curvy uses sampling to put in cache a set of points for performance reasons. Sampling is also used in mesh extrusion for example.

The issues with how sampling was done until now are:
  • Confusing: I often get messages from users struggling with modifying the sampling parameters, because there is too many parameters scattered in too many places:
    - "Max Cache PPU" in curvy preferences
    - "Cache Density" in the spline's inspector
    - "Min Distance" in the Curvy Generator's inspector.
    Plus some of those parameters where ignored in some cases, with nothing in the UI explaining this to you:
    - "Max Cache PPU" was ignored for UI Splines. A value of 1 was always used.
    - "Min Distance" was used only when a spline was used by a Rasterize Path module, or a Shape Extrusion module, having Optimize set to true.
  • Bugged: whatever the value of "Max Cache PPU" you set in the editor, your build game/application will always use the default value of 8.
  • Changes are global: "Max Cache PPU" was the same for all splines. So if its default value was too high or too low for a specific need (like modeling a small wire), modifying "Max Cache PPU" to meet that specific need would impact all your already existing splines, that didn't need to be modified.
    The same is true, to some extent, with "Min Distance"
What are the changes
  • "Max Cache PPU" is now obsolete. It is replaced with a per spline "Max Points Per Unit", beneath the "Cache Density" in the inspector.
  • "Min Distance" is now obsolete.
How do they impact you
  • If you never changed the default values of the obsolete parameters, then you have nothing to do. The default value of Max Cache PPU was 8, and the default value of Min Distance was 0.1
  • If you have a non default value of Max Cache PPU, then the Max Points Per Unit for your splines need to be set to that value. To make things easy, each time Unity will load a spline with no value set to Max Points Per Unit (whether when you load a scene or a prefab), the value of Max Cache PPU will be set to Max Points Per Unit. But you will still have to save your scene or prefab to persist this value on disk.
    Know that when I tried to save all my scenes through Unity Editor, some scenarios (like saving with ctrl+s) failed to save the scene, since Unity didn't get that something changed in the scene. The reliable way I found through the editor is to: load a new scene -> drag all scenes in the hierarchy window -> select all the scenes -> right click -> click on "Save scene".
    You don't have to do this manually though, since you can use a script that opens and resaves all your scenes. Here are two such scripts:
  • If you have a non default value of Min Distance, and it's value is bigger than 1/Max Points Per Unit, and you use a Rasterize Path module, or a Shape Extrusion module, having Optimize set to true, then you will have to define the minimum distance between sampling points by modifying Max Points Per Unit accordingly. For a Min Distance of x, your Max Points Per Unit should have a value lower than 1/x
Until the obsolete values are removed in an upcoming Curvy update, you can keep using them by setting in the code the CurvyGlobalManager.UseObsoleteSplineSampling to true.

Let me know if you meet any issue, 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.

Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Unity Splines _Aka_ 0 0 Yesterday, 08:34 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 15 02-26-2024, 09:49 AM
Last Post: _Aka_

Forum Jump: