Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[WIP] Easy to use and simple spline tool

Discussion in 'Tools In Progress' started by Antony-Blackett, Feb 16, 2020.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    So true haha! Great looking util!
     
  2. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    Aggressively agree.
     
    angrypenguin and april_4_short like this.
  3. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    End caps on arbitrary extrude shapes.

    Screen Shot 2021-07-28 at 12.06.25 PM.png
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The obsession, the magnum opus.
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Reduce your workload, increase accuracy and make it easy to edit splines with the all new winding normals mode!

    Screen Shot 2021-07-29 at 10.16.02 AM.png
     
  6. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    Bringing tomorrow's splines today.
     
    hippocoder likes this.
  7. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Here's my current solution that allows you to deal with complex splines that loop upside down and twist a lot while still looping nicely.

    Screen Shot 2021-07-29 at 2.34.24 PM.png
     
    hippocoder and april_4_short like this.
  8. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Spline keyframes of all types now have tangents so you can either lerp linearly or smoothly between keys using slider control points

    Left side is smooth, right side is linear. Screen Shot 2021-07-29 at 5.53.26 PM.png
     
    hippocoder likes this.
  9. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Turns out tube generation is very complicated. After a couple weeks of work here's where i've ended up.

    It won't do everything but it's a good base to start with and can easily be modified and added to.

    Screen Shot 2021-07-30 at 3.03.06 PM.png
     
    april_4_short likes this.
  10. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Scale has been added. It applies to the extrude shape before other transformations.

    Here's a line extruded along a spline while scaling up and rotating using spline keyframes
    Screen Shot 2021-07-30 at 4.13.49 PM.png
     
  11. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I've been running into a wall on this project recently. There's a lot of baggage i need to resolve before i can move forward with it further. Unity Tools and Editors are cumbersome and difficult to use in the manner this tool has been designed so i need to rethink some things and redesign some code to get the tool workflow happening nicely.
     
  12. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Hi all,

    I don't think I'll ever get this to the point where it's good enough to sell on the Unity store so I decided to make it publicly available trough github.

    https://github.com/AntonyJBlackett/Spline

    It's setup as a package so you can install it through the unity package manager.... i think.

    If you want to contribute to the project, get in touch and I can help you get up to speed.
     
    Last edited: Aug 11, 2021
  13. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hopefully some sour git doesn't reskin it and try to flog it on asset store. Been a lot of that recently.
     
  15. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    I haven't seen any of that with my own eyes but sadly I'm sure it happens... so lame.
     
  16. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Oh, heck yeah! Thank you very much for sharing.

    I too started making my own spline solution a while ago after trying some others and being... less than satisfied. I got something that 99% works and is super performant, but I have yet to iron out the last few kinks. It looks like you've already done that and you specifically set out to address the same issues I had with other solutions. So first up, well done!

    Second, thanks again for sharing!

    And third, I look forward to giving this a go some time soon!
     
    Antony-Blackett likes this.
  17. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I checked out unity splines 1.0.1 today and was greatly disappointed.

    Again we'll be saddled with an undercut tool that is all but useless in its default state.

    Unity splines have all the same issues other other splines

    • There's no easy dealing with splines in world space coordinates and distances. You have to get things with t values and guesstimate how much percent to move along to get to the next point you want.
    • You have to get each spline variable one by one, i imagine that's a time sync but i haven't profiled it. In my spline tool you get get all the spline parameters from a single call to reduce the expensive spline computation/lookup calls. This makes it easier to use as you can get position, tangent, segment etc etc... all with a single call.
    • Their spline editing tools are pretty basic. And like all other spline tools there's no good representation of the spline in 3D space so once you move off the ground plane it's hard to get an understanding of where each knot (node) is.
    • They have minimal tanget controls. you can't 'break' a tangent on a knot except for the loop knot in a looped spline which for some reason is not mirrored like all the other ones. so if you want a nice smooth look you have to do that manually.
    • Their extrude tool is very basic, it only does tubes and it doesn't optimise geometry along straight lines etc.
    The only thing they've done right so far is to not use game objects as control points which makes it more robust that other spline tools.

    Unity, just use my splines please.
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah I took a look at Unity's effort and I don't see any use for it in game development. Unity's may be ideal for the purposes of modelling or something.
     
  19. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I've started a new project that might need the use of splines so development of fantastic splines might get kick started again. I'll keep this thread updated if it does.
     
  20. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    I think I read that they did a terrain thing that uses splines? So yeah, that makes sense in a way.
     
  21. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    Just wanted to say thanks for all the work, and for sharing the project @Antony-Blackett - this looks great! Downloading now to have a play.
     
  22. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I've been making a few fixes here and there. I'll upload an update to git hub sometime soon. in the meantime email me and i can fire a zip your way
     
  23. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I've been doing some more work on splines.

    They now have tool bars and greater usability after getting thrashed in a project i'm working on.

     
    greg-harding likes this.
  24. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    Nice! Is this in the repo?
     
  25. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    This looks so good. The tooling seems like it's been made to be used by actual humans, not programmers xD
     
  26. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    Hadn't seen this until now. Really enjoyed reading through your posts and seeing it develop! Making tools is such a beautiful time suck! Appreciate you sharing your work, the tool looks Fantastic.
     
  27. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Not yet. I'll try get it updated next week.
     
  28. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I'll also look into unity splines and see if it's worth changing the spline implementation to use their splines under the hood. not sure it'll be worth it though, but it'd be nice to have one spline tool set to rule them all.
     
    gasppol likes this.
  29. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Nice toolbar icons.

    Spline Editor Tool
    Spline Normal Tool
    Spline Scale Tool
    Spline Float Tool
    Spline Color Tool

    Screen Shot 2022-08-17 at 2.15.36 PM.png
     
  30. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    adslitw, bobadi and angrypenguin like this.
  31. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Is anyone using this tool? Does anyone have any feedback?
     
  32. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    I plan to be using it in a week or two. Looked it up a couple of weeks back but have been sidetracked.
     
    Antony-Blackett likes this.
  33. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Alright, some quick feedback from a quick play today.

    Editing splines is immediately easier / faster / less fiddly than with the last spline editing tool I used (which happened to be the first party solution in another engine). Big thumbs up there!

    Having each point draw a line up/down to a reference plane makes things far easier to interpret than most other spline tools I've used, where I just have to keep moving the camera, to have any real idea of where points were in relation to each other.

    Whenever I hold right-mouse and press A, I'm back in spline edit mode. Suggest a different shortcut? Anyone who uses right-mouse scene movement will run into that a lot. On a related note, when using the spline tool Q and E to move vertically didn't seem to do anything.

    Would love to see the SplineComponent have an icon so we can select it in the scene by default. Can always add a marker ourselves in the Editor though.

    Spline lines looked super jaggy / stepped at first. This was due to dynamic clipping distances on the Editor camera (and likely the largeness of some objects in our scene). Manually setting a not-silly near clip addressed it.

    I was confused for a while because I couldn't figure out how to change the normal of a node, or any property other than the position. It turned out that the gizmos were only partially displaying - after restarting Unity I could see more parts of the gizmos which let me change the other properties.

    I quite like the idea of adding multiple components to add the extra properties we need to a basic spline. A combined Inspector which shows all relevant controls in one place would be sweet, primarily because it would save scrolling as you move between different features, but I definitely hear you about how fiddly that kind of thing is.

    I did manage to get the generated geometry and the actual spline to diverge from each other pretty radically in a couple of cases. Can try to replicate if you care. I don't think they'll impact my typical use cases, though (camera tracks, and cables connecting different interactive objects in levels).

    This was just from a quick go at hand-making some stuff. I plan to use this in earnest in the not-too-distant future (automatically creating geo for all of the cables in all of our levels) and will let you know how that goes.

    But more importantly than any of the above, thanks for making and sharing!
     
  34. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Great feedback.

    I'm not one to use keyboard nav in unity so yeah, that's an oversight. I'll think about how to rectify those issues.

    The tube generator is kind of an add on 'example' of how you could use splines, I got carried away with it i guess. it's pretty powerful now but is not really something i intend to maintain or update regularly.

    As for spline rendering, i'm just using the built in unity bezier drawing code.

    As for spline tools all being in one place. Be a combined inspector showing all controls, do you mean the short cut key tool tips in the inspectors? for additional data tracks the controls are all the same, it wouldn't be too hard to add those to the spline component tool tip if there is one present.
     
    angrypenguin likes this.
  35. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    I don't know if this is simple, but I've seen other tools use hotkeys which can be bound in the Editor preferences. I should find out and use it for my own tools, because it's pretty hard to find a key which isn't already used for something...

    All good. I think it pretty much addresses my key use case as it is. I was just writing down whatever I observed as I was trying it out.

    I mean the option / mode toggles and buttons in the Inspector. However, I wrote that feedback item before restarting Unity and finding that there were a lot more gizmos than I was previously seeing, so it could be a non-issue. Also now that I don't have it open I can't remember what they do, so I don't know if you'd commonly have to move between them anyway. Certainly it's not stopping the tool from being used.
     
    Antony-Blackett likes this.
  36. Alex_Galvez

    Alex_Galvez

    Joined:
    Apr 30, 2018
    Posts:
    1
    Great work! Thank you so much for sharing.

    By the way. I wonder if you ever explored this idea and came to a conclusion as to whether it was worth it or not:

    I'm working on a game prototype that uses Unity Splines (2.1.0) for the movement system and could adapt some of the functionality you developed, especially the GUI (yours is so good!). So, did you make progress on this topic?
     
  37. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I had a look at unity splines and was pretty disappointed with the API and functionality so at this time decided it wasn't worth the effort.
     
  38. YanniH

    YanniH

    Joined:
    Mar 1, 2023
    Posts:
    1
    Hi
    Thanks for the amazing tool, how can I access the nodes at runtime and grab them and change their position (I'm using MRTK2)?
     
  39. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Should all be acessable through SplineComponent.GetNode SplineComponent.SetNode

    I haven't looked at the code for a while so forgive me if that's not totally accurate.
     
  40. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    So I'm finally integrating it into a project. First pass is looking great, and I foresee no issues getting it integrated with our custom tools.

    A question, though, @Antony-Blackett - what license are you sharing this with?
     
  41. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Free to use for whatever you like. go nuts

    In fact this game just came out and it uses Simple Splines. It uses splines for AI path following. The track generation is in Houdini

    https://monsterracingleague.com/
     
    Last edited: Mar 31, 2023
    angrypenguin and Alex_Galvez like this.
  42. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    @angrypenguin Please share how you use the tool and any feedback you have. I'd love to know. One day I'll get the motivation to make some more improvements.
     
    angrypenguin likes this.
  43. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Sure thing, I'll pop in and do that at some point.
     
  44. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Ok, so the thing I'm using it for at the moment is pretty simple. In our game there's various control objects, such as switches, which influence various other objects in the world. To show what does what, we've got cables connecting controls to the objects which they interact with, e.g. a button to a door it opens.

    In the level design process we lay out those cables as a GameObject with child GameObjects at each node. The positions of their Transforms are fed to a spline component. I originally used a 3rd party one, then wrote my own, and have currently dropped yours in its place.

    Feedback:
    • I've only used it a little, but the spline editing tool itself seems great. I particularly love the plotted display of the nodes along a ground plane, because it saves a lot of camera movement by giving that consistent point of reference.

    • For those of us who use keyboard nav in our scenes, a couple of things would be neat:
      • For the SplineComponent have a non-editing mode so that pressing A while you happen to have a spline selected doesn't lock your movement by trying to add a node.
      • For the hotkeys to be re-assignable in the Editor general.
    • In rare but fairly consistent cases, screen-space spline node handle size becomes dependent on camera orientation, and they can get huge. Switching to world space size makes it a non-issue, of course. This happens on some really long (kilometers) splines I have in a scene. Aside from the length there is nothing different about them to the many dozens of other splines where this doesn't happen.

    • I'm using the Tube Generator script, which is only included as a demo, but have some related feedback anyway.
      • I've noticed a bit of awkwardness around corners with doubled-up or crumpled geometry, and that "Round" corners often use far more segments than specified in the Inspector. (Possibly a similar issue to my own? But in a far less conspicuous location.) (Also, your pictures from earlier suggest there are ways I can control this, which I just haven't investigated yet.)
      • I noticed that it has an Update() method, which I just commented out as we don't need runtime updates, and my own Editor code calls Regenerate when needed.
    • This shouldn't be a thing, but considering one of the other spline tools I used, it's worth mention that this one didn't cripple my game's performance. :)
     
    Last edited: Apr 3, 2023
    Antony-Blackett likes this.
  45. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,366
    Dang, I just finished doing a Spline thingy with a paid asset which I am underwhelmed by. (I wonder if it's the one that @angrypenguin used which crippled their performance.) I had to fix some null refs in their Editor code, and figure out how to identify the "next" tagged/landmark point along the loop, which they didn't do out of the box.

    And that was to replace an earlier paid asset which was abandoned.

    Now you guys got me tempted to try a third. At least this one, from all gushy accounts above, outperforms and outfeatures the upcoming Unity spline stuff.
     
  46. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Thanks for the feedback. Hope you find it useful moving forward
     
    angrypenguin likes this.
  47. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Anyone using the latest and greatest Unity splines? I haven't had a look at the latest updates yet. I'm wondering if there's a market for me to make easy to use extensions for Unity Splines in a similar vein to my spline tool.
     
  48. paulygons

    paulygons

    Joined:
    May 6, 2010
    Posts:
    164
    I just discovered that Unity has built-in splines with Unity's pre-release versions. I want to draw with splines in my game, not attach lamp posts along them, or animate a path, as the Unity Splines Package comes with animate/extrude/instantiate those needs are somewhat covered already. I also just discovered this thread and I'll have to research your tools, I haven't stumbled upon a link to your asset store page yet (can someone throw a link to the dumb old guy?). At the moment I use a Line or Trail Renderer solution for now. I've been hunting for a tool that lets me plug the Line Renderer into the Splines. Seemed like it would be "easy enough" to sample any given point on a spline and put the next step of a line (or trail?) on it. Any pointers about how to draw with splines in-game would be cool.
     
  49. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    523
    Naa - they weren't ready at all a while ago but haven't looked at the latest releases. We're still happily using Fantastic Splines + a few custom hax in MRL :)
     
    Antony-Blackett and joshcamas like this.
  50. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    I've also taken a look at Unity splines, very very far behind most splines you can find on the asset store, at least when I tried them. Hopefully over time they'll develop it more