Search Unity

Dreamteck Splines - Powerful and Flexible Spline Solution

Discussion in 'Assets and Asset Store' started by Dreamteck, May 11, 2016.

  1. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Hi,

    1. Linear splines consist only of samples at the positions of the control points. If you use Uniform samples, the spline will try to give you the same number of samples but positioned at even distances. Your only solution to have a uniform linear spline is to use the Distribute Evenly operation.

    2. What is your Unity version and can you tell me the steps that you are exactly taking to reproduce this issue?

    3. This is a known issue and we have been trying to collect information from people who have reported it. However, up to this point nobody has reported back what they are doing when this is happening and when customers have sent us scene files with their setup, the values are stable when we open it.

    4. Noted. We will think of improving the UX in future. I'm also not a big fan of this design decision currently.
     
  2. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    @Dreamteck Sorry for the super late reply. Here are my answers for #1 - #3:

    It should be possible to have Linear splines with uniform sampling while ensuring the spline goes through all control points. The fact that this is not the default behavior is incredibly odd. In fact you can create a Linear spline, convert it to a Bezier spline with uniform sampling and it works exactly how a linear spline with uniform sampling should behave. So I at least know that this type of spline should be possible to create without having to go through that roundabout procedure. The Distribute Evenly operation you mentioned does not have the same result.

    Again, the fact that this is not the default behavior (it should be), and not even an option in the current version is very strange.

    Using version 2018.4.13 and this seems to just always be an issue, especially when re-positioning Bezier control points and tangents multiple times.

    I am currently on Unity 2018.4.13 and this seems to occur for every spline when it is in "Local" space.
     
    Last edited: Feb 16, 2020
  3. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Can you draw an image of how you imagine Uniform Linear would work in terms of where the spline points would be and where the actual samples are? I feel like I'm not able to imagine the thing you are talking about.

    Have you tried installing Dreamteck Splines in an empty project? Does that continue to happen there (the point values changing)?
     
  4. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    40
    And thanks for nice asset! Used it in our VR project:
    Zooma VR
     
  5. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    LinearSplineIllustration.jpg
    Please refer to the original image I linked earlier: https://forum.unity.com/attachments/uniformdefault-jpg.550674/

    On the left is Default sampling, and on the right is Uniform sampling. What I am looking for is to have Uniform sampling look like the image on the left, with constant speed throughout all control points. As I mentioned in my last post, my current roundabout solution is to convert the linear spline into a Bezier one and it works exactly as expected. But I want to keep it Linear, not Bezier. I don't know exactly where the samples would be in this illustration but they should be evenly distributed to ensure uniform speed.

    The reason why I can't use Distribute Evenly is because it changes the positions of the control points. I want to keep the original positions of each control point (exactly where I set them up) while having a linear spline that connects to every one with constant (uniform) speed.

    Edit: I've attached a new illustration. Hopefully this clarifies what I am trying to do.
     
    Last edited: Feb 18, 2020
  6. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    I think I understand what you are after. However, in this case, if you use Uniform samples, the samples will still not go through the control points. I will illustrate why:

    The default sampling mode defines the number of samples between each two control points. So if your sample count is 10, you will have 10 samples between each two control point, the first sample being placed at the first control point and the last - at the second control point. Using this method, we ensure that there is a sample at each control point:

    default1.png
    This also means that if points are closer together, the samples will be denser and vice versa.

    Now, to counter that, we introduce the uniform mode. The way it works is - it places samples at even distances from each other. The samples are the same count which is sampleRate * (points.Length - 1) - (points.Length-1) + 1; But they are distributed evenly along the spline which results in this:

    uniform1.png
    So if we are to add in-between samples for linear splines, you will still not be able to get them at inner control points - only at the first and the last one.

    This is the reason why we decided to opt out of additional spline samples for linear splines and just leave one sample per point in order to make the solution lightweight.

    We can implement in-between samples for you but keep in mind that you will not get guaranteed samples at the inner control points. You could crank up the sample count in order to approximate this, however.
     
  7. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    Instead of using samples for Linear splines, couldn't you simply use the control points to determine the position along the spline, which would remove the need to have samples in the first place? (i.e, you know the distance between each control point so evaluating positions along the spline is a simple matter of interpolation).
     
  8. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Yes, this is exactly how it works right now. I was illustrating the potential issue if we went ahead and added in-between samples.
     
  9. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    I'm not sure I understand. If you are interpolating between control points, then you should be able to hit every point with uniform speed.

    (in other words, each "sample" is a control point and you are using distance to evaluate speed)
     
    Last edited: Feb 19, 2020
  10. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Correct, and our Spline Follower component (unless set to Follow Mode - Time) does exactly that.
     
  11. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    Ok, I think the problem is that I'm not using the Spline Follower component - I'm updating the position manually using the Evaluate function and updating the percentage by dividing by the total length of the spline. If I understand this correctly, the reason why this works for all other spline types except Linear is because Linear doesn't have samples between the control points? I think my confusion comes from the fact that Linear splines work differently than the other spline types do.
     
  12. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    All splines work the same way it is just a matter of how spline samples are handled. If you use your method on a Hermite or Bezier spline, you will still get variable movement speed.

    In order to move with uniform speed, you need to use the Travel method. So if you want to move with a speed of 5 units per seconds, you would do:
    SplineSample sample = new SplineSample(); // <- define this at beginning

    Code (CSharp):
    1. double newPercent = spline.Travel(sample.percent, 5 * Time.deltaTime, Spline.Direction.Forward);
    2. spline.Evaluate(newPercent, sample);
     
  13. EstudioVR

    EstudioVR

    Joined:
    Jul 26, 2013
    Posts:
    127
    I just purchased Dreamteck Splines and when installing Playmaker support several compilation errors prevent me from using it. Latest version of Playmaker and Unity 2019.2.19f1. Thanks

    "The SplineResult namespace can not be found"
     
  14. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Please, send a message to https://dreamteck.io/support/contact.php we'll hook you up with the latest update.
     
  15. EstudioVR

    EstudioVR

    Joined:
    Jul 26, 2013
    Posts:
    127
    I sent yesterday. I only post here because of no answer overthere, and i need it to completa a work
     
  16. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    We'll get back to you shortly! We respond within 24 to 48 hours because we are in a busy period.
     
  17. EstudioVR

    EstudioVR

    Joined:
    Jul 26, 2013
    Posts:
    127
    Thank you very much. Works well now. In a couple of days, i will buy Forever too, I think it is a nice partner for Splines 2.0
     
    Dreamteck likes this.
  18. Matkins

    Matkins

    Joined:
    Aug 24, 2009
    Posts:
    152
    Hello Dreamteck,

    I'm using spline triggers and I've got them basically working. But I need to know which of the spline followers it was that crossed the trigger. So either the callback needs a reference to the spline follower which triggered it, or the follower should be able to register an exclusive callback that is invoked only when that particular follower crosses the trigger.

    Is there support for this? How do I accomplish it?

    Thanks for your help.
     
  19. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Hi Matkins,

    Currently no support for this but it is an important feature so I'll make sure we include it in the next 2.01 update which is almost ready! Hit us up through the support form just to let us know you're waiting for this feature and we'll send an update to you as soon as the feature is in so you won't have to wait for it to go live on the Asset Store.
    https://dreamteck.io/support/contact.php
     
    Matkins likes this.
  20. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    Great asset.

    I'm trying to work out how to smoothly draw splines at runtime using finger swipes (think air traffic controller games). I 'kind' of have it working but the follower is very jumpy as it's trying to keep the correct percent along the ever changing path. Now, I'm sure I can work this out the hard way, manually updating the percent according to the new path length, but it seems as if this would be something you would have thought of... so before I jump in I figured I'd ask. It'd be handy if there was a sample scene of runtime line drawing.

    What I mean:




    EDIT: With a smoother line it shows the problem better. The follower goes super speed trying to keep up with the percent/time depending on the follow mode. (I'm clipping the line depending on percent)




    EDIT 2: I just found the spline positioner which has a distance parameter. Maybe this is what I'm looking for...
     
    Last edited: Feb 22, 2020
  21. EstudioVR

    EstudioVR

    Joined:
    Jul 26, 2013
    Posts:
    127
    Hello, I know you are very busy, but people who buy an asset do so because they need to resolve an issue in their development and when support doesn't come, it delays people's development. I would like, if possible, to pay more attention to emails, because the asset is good. Please verify your email
     
    Last edited: Feb 22, 2020
  22. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    You can take the follower's transform position before adding the spline points, then after adding them, you can call RebuildImmediate on the spline to make it update immediately and then with the position that you have recorded, call the Project method - this way you will get the new percent that your follower has to be at and you can call SetPercent on the follower, passing this new percent.

    Alternatively, if you spline is in Default sampling mode, it would be better to simply calculate the percent for the follower based on the difference in the spline points count.
     
    arpan018 likes this.
  23. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Our support e-mail is not checked during the weekends. We are responding Monday to Friday
     
  24. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Hi,

    I've picked up the Dreamteck Splines last week, great product! I was looking for a spline solution that supports different segment-sizes and junctions, Dreamteck Splines is the best solution I found.

    There are a few things that I noticed while testing though. The most annoying one an editor freeze for a few seconds every time I select a Spline Computer.

    I've tested this with Unity 2018.4.4f1 and Unity 2019.1.0f2 and Dreamteck Splines 2.0.0. Any idea why selecting a Spline Computer causes Unity to become unresponsive for a few seconds every single time?

    upload_2020-2-24_13-35-29.png

    upload_2020-2-24_13-35-57.png
     
  25. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    We got a few other reports about editor freezing when selecting a Spine Computer but so far we haven't been able to identify the culprit. Is your spline a prefab or does this happen for any spline at all? Could you enable "Deep Profile" as well and show us the stack trace?
     
  26. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Thanks for your reply!

    No, it's not a prefab. I've created it via "GameObject > 3D Object > Spline Computer" directly in the scene and edited the spline with a few points.

    It seems to happen for all splines. I've also tested it in two different projects, same problem.

    upload_2020-2-24_15-55-46.png

    upload_2020-2-24_15-58-53.png

    Maybe it's related to the number of assets/folder in the project? That would explain why it can't be reproduced in a new/empty project.
     
  27. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    I think I see where the problem comes from. We are trying to load the editor images from the project folder but we are listing directories and iterating through them. If your project has tons of directories, then it allocates a lot of memory in order to list them. This Profiler screenshot is very useful. We'll get on this problem right away and I hope we can fix it shortly.
     
  28. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    My approach to load editor images is to use the image assetGUID rather than searching for it on disk. Then use GUIDToAssetPath to convert the assetGUID to the actual path and that's it. Very fast, no searching required and works like a charm in all tools I wrote.
     
    Dreamteck likes this.
  29. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    This is perfect. Thank you.
     
  30. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    Hello guys! We want to invite you our new teaser of The End of the Sun game announcing Kickstarter campaign where we use Dreamteck Splines :)
    If you are interested in, add your email here. https://www.endofsun.com/crowdfunding/
     
    marcrem and Dreamteck like this.
  31. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    After leaving EasyRoads3D because it didn't fit our needs in huge streamed worlds, we moved to dreamteck splines.

    Today, I did a little editor tool for my level designer to be able to terraform and texture the terrains around the roads automatically. The regular terrain tool that comes with dreamteck doesn't support multiple terrains, so I had to create mine.

    Thankfully, the Dreamteck Splines API si so well made that I was able to do it quite easily!

    It works seamlessly with multiple terrains :)



    EDIT: Seeing the post above mine and can't help but also tell you guys we're in our kickstarter right now. Check it out :D
    https://www.kickstarter.com/projects/outbrkgame/outbrk-the-multiplayer-storm-chasing-experience Screen Shot 2020-03-05 at 1.03.57 PM.png
     
    Last edited: Mar 5, 2020
    Freznosis, Dreamteck and MOARNial like this.
  32. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Tool looks great!
    And congrats on reaching your Kickstarter goal!
     
  33. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Here are the first two tutorials for version 2:



    More are coming by the end of the week.
     
    sjm-tech likes this.
  34. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    Version 2.01 is out on the Asset Store!

    ----- 2.01 -----
    FIX: Fixed the annoying NullReferenceException issue in the Welcome Screen
    FIX: Implemented nsxdavid's fix (Unity Forum) for the Layermask field
    FIX: Fixed the "Create Node" option adding nodes to the wrong point
    FIX: Deleting sample modifiers now properly updates the Spline Users
    FIX: The spline editor now preserves the selected tool when selecting another object and selecting the spline back
    FIX: Fixed issues with mirroring tangents of Bezier splines using the Mirror Tool
    FIX: Sample Modifiers' blending value now multiplies the entire region
    FIX: The SplineProjector now invokes the onNode event properly
    FIX: Updated Playmaker actions
    FIX: Removed legacy editor code which made the Spline Editor slower

    FEATURE: Improved the UX of the Spline Edit mode - Ctrl + E now enters and exits edit mode
    FEATURE: Added a Z component to the Mesh offset in the SplineMesh component
    FEATURE: Added custom scaling regions to the channels of the Spline Mesh component - now meshes can be scaled in certain regions
    FEATURE: Small UI improvements
    FEATURE: Improved how the Object Controller scaling works and added a checkbox for toggling between two modes of scaling
    FEATURE: Added the "Mark Dynamic" property to all mesh generators which optimizes performance for meshes that are frequently updated

    API: Moved the Spline Computer drawing logic from the SplineDrawer to DSSplineDrawer
    API: Removed the need of the DREAMTECK_SPLINES scripting define

    SUPPORT: Minimum supported Unity version is now 2017.2
     
    Peter77 likes this.
  35. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    For everyone who is getting errors with Forever after installing Dreamteck Splines 2.01, drop us a line at: https://dreamteck.io/support/contact.php and we will send you a patch to fix this issue. Version 1.08 of Forever will be out shortly!
     
  36. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    40
    Anyway to dont save mesh data in scene for object bender and tube generator? Because i rebuild it when scene runs, But scene saves with Mesh inside and size of my scene file is about 100 mb! without splines - 38 kb.

    And also is that any way to DONT store spline samples inside Spline Users? Because scene without mesh manipulation and just with spline positioners (around 50) has size about 50 mb...

    My splines version is 2.01
     
  37. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336
    We currently don't have an option to do that unfortunately. Everything is generated and stored automatically. You can set the Update mode to None but this will not clear the samples and also, it will not remove the meshes and every time you select / deselect the spline during edit mode, they will be rebuilt. We will add a way to clear samples and data in the next update so that you can keep your splines lightweight until the scene loads and you manually rebuild them.

    Also, Zooma VR looks amazing, very happy to see our tool used in such project!
     
  38. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    Hello dreamteck, is the new version of spline is fully compatible with forever? i remember facing some error last time i import spline with the actual version of unity.
    cheers!
     
  39. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    40
    Same as your splines asset guys!
     
  40. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    360
    Hi @Dreamteck

    I need to detect if a point is inside a closed spline. Does this functionality exist in the API?
     
  41. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    I've tested version 2.01, unfortunately the performance issue is still there. Selecting a GameObject with a "Spline Computer" causes a 3sec freeze.

    Reproduce
    • Use projects with hundrets of folders and thousands of assets
    • Store DreamteckSplines in "Assets/Plugins/Dreamteck"
    • Select GameObject with SplineComputer
    Actual
    Unity freezes for several seconds.

    Expected
    No freeze.

    DreamteckSplines still seems to crawl the project to find the editor images/icons. Please take another look at this post, because there is no need for crawling. This can be reduced to almost 0ms cost.

    If you really want to crawl the Assets directory content, don't use the File IO but AssetDatabase.GetAllAssetPaths instead.

    Here is a Deep Profile capture. Please let me know if you need additional information to solve this issue.
    upload_2020-3-23_9-22-51.png
     
    Last edited: Mar 27, 2020
    Dreamteck likes this.
  42. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Creating a spline by adding multiple points creates the spline/path in reversed order.

    If I create spline with 3 points from left to right, I would expect the points being "1, 2, 3". However, points are reversed, they appear from left to right as "3 2 1" instead.

    This causes a SplineFollower to move along the path in the wrong direction, or in the opposite direction how the Spline was designed.

    I know there is a "Reverse" button or that I can switch the Follower to "Backwards". However, the current behavior is counter intuitive. I would appreciate if you can change the default behavior to add points in the order they're added, so I don't have to click Reverse after creating the spline.

    Here is a video where I show what I mean:

    I'm using DreamteckSplines 2.01 and Unity 2018.4.18f1.
     
    Last edited: Mar 27, 2020
  43. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Is there a shortcut to disable the current spline editing tool?

    For example, when I select the "Add Points" tool, it would be very useful/intuitive if I could deactivate it using ESC for example.

    However, pressing ESC while the "Add Points" tool is active, turns off spline editing entirely. If would be more useful if the SplineComputer stays in "edit mode" and pressing ESC a second time, while no spline tool is active, would leave edit mode like it's now.

    This would improve the workflow quite a bit.
     
  44. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    I have a deactivated SplineFollower on an object. While the SplineFollower is deactivated, the object is moved by another script.

    However, every time I select the object in the Hierarchy, to view its properties in the Inspector, Dreamteck Splines resets the object to a position on the spline. Changing the "Editor Set Position" also doesn't change this behavior.

    Can you please fix that this won't happen if the SplineFollower is turned off (via isActiveAndEnabled).

    Here is a video that shows the problem.

    You find the scene and script shown in the video attached to this post, so you can reproduce and fix the issue using that.
     

    Attached Files:

    Last edited: Mar 27, 2020
  45. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    The Dreamteck Splines Node Component does not support Undo/Redo, please see video below.

    I'm using DreamteckSplines 2.01 and Unity 2018.4.18f1.
     
    Last edited: Mar 27, 2020
  46. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    According to the Dreamteck Splines Asset Store page, Unity version is 2017.4.35 or higher is supported.
    upload_2020-3-26_14-3-30.png

    Unfortunately, the examples don't work in Unity 2018.4.18f1 and I assume they also don't work in 2017.4. It seems the examples have been created using Unity 2019, making them unusable in earlier versions.

    Please see video below.
     
    Last edited: Mar 27, 2020
  47. ayomidegidigbi61

    ayomidegidigbi61

    Joined:
    Sep 28, 2017
    Posts:
    4
    Hi Guys, I'm having trouble with amending the "Start Positon" on the Spline Follower Component. The slider doesn't work and I've tried typing a number into the field next to it and it doesn't work also.

    Is there a fix for this??
     
  48. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    360
    Bump on this.
     
  49. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    I'm trying to wrap my head around the Length Calculator Component.

    According to the documentation, a Clip Range of 0 to 1 corresponds to the entire spline. Therefore my assumption is that the length of Clip Range 0 to 1 must be the longest length the Length Calculator could ever calculate, because it covers the entire spline.

    If I restrict the Clip Range to 0 - 0.6, my assumption was that the length must become shorter. It must become shorter, because it only represents 60% of the spline. 60% of the spline must be shorter than 100% of the spline in my understanding.

    However, the computed distance actually gets larger as I reduce the clip range from 0-1 to 0-0.6. Why is that?

    I recorded a video that shows this behavior and attached the scene I used in the video to this post. Notice in the video how the computed length gets larger as I limit the clip range.

    I'm using DreamteckSplines 2.01 and Unity 2018.4.18f1.
     

    Attached Files:

  50. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    336