Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changes in splines' sampling parameters
#1
Hi,
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:
    https://gist.github.com/mwegner/e44ab074279625e3f84a
    https://gist.github.com/benblo/10732800
  • 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.
Reply


Messages In This Thread
Changes in splines' sampling parameters - by _Aka_ - 02-24-2018, 06:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 1 2 Yesterday, 10:23 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_
  Distance travelled across multiple splines jh092 1 7 02-23-2024, 09:44 AM
Last Post: _Aka_

Forum Jump: