Search Unity

Dreamteck Splines - Powerful and Flexible Spline Solution

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

  1. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    244
    Thanks for the reply. I am using the method to get a SplineResult based on evaluating the spline, but the normal field returned is always (0,0,1). Which is probably correct for the way the spline is set up, but I need the normal of the mesh surface that was generated from the spline.

    To make things more clear, here is what the mesh looks like and how the spline mesh is configured. I added the red markup to show the normals I want to get.

    ramp.png
     
  2. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    I get what you're saying. Even in your case, the normal value of the spline shouldn't be that. Click the little curve with the arrow button and you'll be able to see what the normals are of your spline control points. Theoretically, the normal of the mesh should be pretty close to the normal of the spline since you are just using a cube for your extrusion. Here is a sample of the code I'd use for this situation, where 0.4 is just an arbitrary value along the spline you wish to evaluate.:
    Code (CSharp):
    1. SplineMesh splineMesh = GetComponent<SplineMesh>();
    2.  
    3.             SplineResult sr = follower.computer.Evaluate(0.4);
    4.             sr = splineMesh.computer.Evaluate(0.4);
    5.  
    6.             pointNormal = sr.normal;
    Does this make sense? If your mesh was more complicated, I'd say a ray casting approach would probably be in order.
     
  3. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    244
    Sure enough the normals are all pointing in the Forward direction (0,0,1). I can drag the normal around, but it distorts the mesh. What would be the correct "Set Normals" type for this situation (e.g., At Camera, Calculate, etc). I assume I need to come up with the right combination of that along with settings in the Spline Mesh script.
     
  4. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    Out of curiosity, what type of spline are you using? In my use cases, I start with my normals pointing in world up (0,1,0) and use a bezier spline and, in some cases, a linear. I really can't imagine that the spline type is the issue though. I suspect that the culprit is the starting orientation of your spline. You could just go into the spline you drew, select all points, set the normals to 0,1,0 and then it would likely be a matter of swapping the x and y values of the scale on the mesh you extruded (the values you put into the little red box in your image). Either that or just redraw the spline with normals up and then use that for your extrusion.
     
  5. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    244
    I'm using a B-Spline. I set the normals for all control points to (0,1,0) and swapped the x/y extrusion, and the ramp looks visually correct. But now I get (0,1,0) for the normal when I evaluate the spline at all points along the spline. Tried Bezier spline with same results.

    I would have expected the SplineResult normal values be based on the "curve" of the spline and not just interpolate between the control point normals, but it appears that is what is going on.
     
  6. EugeneJefferson

    EugeneJefferson

    Joined:
    Sep 5, 2016
    Posts:
    7
    i there) How I can easily create empty spaces between 2 points along the spline? For example I want empty space from second point to third and from 4th point to 5th)
     
  7. EugeneJefferson

    EugeneJefferson

    Joined:
    Sep 5, 2016
    Posts:
    7
    Okay) Just expanded DTS tools)
     
  8. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    You expect correctly. I can tell you that, for me, I am getting the normal of the spline at the point along the spline that I am evaluation, not the normal of the control point. If you were to insert a point on the spline between 2 points where there is an obvious curve, does that new point have the normals that you would expect it to have or are they pointing solidly in one specific direction (like up or forward)?
     
  9. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    244
    Inserting a point still gives me a (0,1,0) normal:
    ramp_normals.png ramp_inspector.png
     
  10. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    Okay. I may have figured this out. I created a new scene with only a Spline Computer in it at first. I then created a new spline (using B spline, as you did). I manually set the normals to 0,1,0 for all of the points in the inspector window (select all, set the values). I end up with a curve that looks like this:

    Screen Shot 2019-09-23 at 8.22.35 PM.png

    Next, I created an extrusion using a simple cube mesh. Like so:
    Screen Shot 2019-09-23 at 8.26.09 PM.png

    Finally, I select the spline, click the normals button, change the setting to "By Direction" and then click the "Set Normals" button (which I didn't realize was a button at first. I end up with this:

    Screen Shot 2019-09-23 at 8.28.37 PM.png

    I was afraid that this would wind up distorting the extruded mesh but it doesn't. Let me know if this works for you.
     
  11. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    244
    Clicking "Set Normals:" did the trick! Thank you very much for helping with this.

    It's confusing that the Set Normals is a button with the semi-colon there!

    Now the question is how I can compute the normal in script, as we allow in-game editing of the mesh control points. Basically find the function that corresponds to pressing "Set Normals:".

    Edit: Found the code in SplinePointNormalEditor.cs:

    double percent = (double)selected / (points.Length - 1);
    SplineResult result = computer.Evaluate(percent);
    points[selected].normal = Vector3.Cross(result.direction, result.right).normalized;
     
    Last edited: Sep 25, 2019
  12. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    That's awesome! I agree that the set normals button isn't obvious. Us Alan's gotta stick together. Now that their game is released on the Apple Arcade, hopefully we'll be getting the 2.0 update.
     
  13. Polymerse

    Polymerse

    Joined:
    Mar 6, 2017
    Posts:
    6
    Hey I need a little help with something

    I have a spline with 1 junction splitting the spline into 4 possible paths.

    I want to have a single particle system send particles down each route randomly at the same speed. Almost like cars choosing a lane after all being in the same lane.

    How do i go about that?
     
  14. Polymerse

    Polymerse

    Joined:
    Mar 6, 2017
    Posts:
    6
    Also is there anyway to scale splines with the Unity transform tools? Cause it doesn't seem to be doing anything.
     
  15. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    Scaling splines works fine for me. Can you share more info on what issues you are running into?
     
  16. Polymerse

    Polymerse

    Joined:
    Mar 6, 2017
    Posts:
    6
    figured that out, just needed it on local my bad!
     
  17. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    177
    I've been running into some issues using "CalculateLength" in my project. It works fine if the from point is prior to the to point on a spline, but not if the opposite case is true. I looked through your code and found what I believe is an issue, specifically in SplineComputer.cs at line 990 you have

    Code (CSharp):
    1. if (to < from) from = to
    Doing this without asking the to value to from will always return a length of zero. I've changed it in my code to the following:

    Code (CSharp):
    1. if (to < from)
    2.             {
    3.                 double fromTemp = to;
    4.                 to = from;
    5.                 from = fromTemp;
    6.             }
    This fixes the issue for me.
     
  18. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    481
    Hi. We We have bunch of nice Blender Bezier Curves and we search a solid solution to get them in 3D to Dreamtec Splines.
    2D over svg works fine.
    Does anyone knows a good solution to get them with high accuracy to Unity Dreamtec in 3D.
     
  19. Abended

    Abended

    Joined:
    Oct 9, 2018
    Posts:
    17
    Hey there! Longtime listener, first time caller!

    I've recently picked up the splines tool, and enjoying tinkering with it to learn. I have implemented a particle controller. my particle renderer is using meshes, so I am open to change this to get the desired effect. However I would like to know if I can change the cycle speed for the particle controller and have that effect all existing particles. It seems that changing the speed in the inspector only affects new particles that spawn the existing ones maintain their current speed. I also attempted to get my effect to work by using the object controller as well, which spawned and offset the meshes beautifully, but I didn't find any controls to then move the cluster down the mesh. I was also considering two joined splines with different speeds, but I think that would cause a bunch up at the point where the speeds change. So far 2 dead ends, the API doesn't really talk about the particle controller, hoping to get some suggestions here!

    A bit more background: I have some low poly clouds I would like to bring into the scene, I attempted to make a large ball shaped spiral that I would like to fire the clouds down at a speedy clip, then when the first cloud arrives at the end, slow the entire spline speed down to regular slow floaty cloud speed. So it kinda starts like a tornado to bring in the meshes, and then comes to a resting slow pace once the mesh is "loaded". Particle Controller does not have triggers that I could find. Any Ideas?
     
  20. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,346
    Hey,

    Your asset store plugin page says there's a 'version 2 coming soon'. Is there any more information about this? I'm wondering if I should bash away at customising #1 or if I should wait for dreamteck splines 2 before doing some serious customisation. I'm only just starting my project so I'll have a few months before I need to get some extra features implemented.
     
  21. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    299
    Hi there, I just wondering if you could please let me know why the splines plugin requires the compiler symbol: DREAMTECK_SPLINES, what will happen if this is excluded? we have a particular build system that manages our compiler symbols and I'm wondering about how to manage this. Thanks, Jason

    ps: I also emailed this question via your website support, sorry for the double up but was hoping for a quick answers, cheers =)
     
  22. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    Hey everyone!

    Apologies for being absent for so long. We are still in the midst of releasing our game, Lifeslide and updating it and our studio has been very, very busy this year.

    We have been following the forums but haven't had time to respond to inquiries for which I'm really sorry. Rest assured, our plugins will not be discontinued and the support for them will continue and new versions are on the way.

    During the work on Lifeslide (which utilizies both of our plugins - Dreamteck Splines and Forever) we have found lots of issues that we have patched and are coming your way!

    Dreamteck Splines 2 is waiting to be rolled out - we have finished work on it but are still gathering marketing materials. We need to make a couple videos and make screenshots but since this is quite time consuming and we want to do it right, we just haven't had the time to finish the materials and roll out the update.

    For all of our customers who already own version 1, you can all send us a request using this form: https://dreamteck.io/support/contact.php and providing your invoice ID - we will send you the package for version 2 which also contains a new documentation (but currently video tutorials are not available).

    We are finishing work on Lifeslide for this year this Friday (20th December 2019) and after that in the period between 23rd December and 4th of January we will roll out updates for all of our products and attend to support.

    Once again, our apologies for being so slow and not keeping our promises. You all have been amazing and very understanding customers and it has been a pleasure to work with you! We will get the quality of our support back on track very soon!

    Cheers,

    Mitko
     
    Freznosis, zKici and Antony-Blackett like this.
  23. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    230
    Eggcelent news,

    I've used the form Thank you.
     
    Dreamteck likes this.
  24. huub8

    huub8

    Joined:
    Dec 23, 2019
    Posts:
    1
    Hi, I bought the assert and I really like is so far. But there is one thing that I can't seem to be able to configure;

    Is it possible to have an object (with the spline follower) follow a spline, and while doing so transition from facing in the direction of the first node to the direction of the second node, without staying perpendicular to the spline?

    So the direction of the spline follower should not be a normal to the spline. I have added an example of what I mean (the perspective isn't perfect, but the red line and box are what I want the cube with the stretched cylinder to orient like)
     

    Attached Files:

  25. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    You need to disable Apply Rotation in the motion foldout and then handle rotation on your term. You can use Quaternion.LookRotation to calculate a rotation that looks from the cube towards the red sphere and apply this in every Update.
     
  26. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    151
    I've used the form too.

    Thank you and happy holidays!
     
  27. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    367
    So your DreamteckEditorGUI.LayermaskField() code is all buggy bugged bugged. Does not correctly handle my set of layers, at least... not sure what the issue is since the code you have there is pretty hard to follow. I ended up with a messed up list and the raycaster not hitting things on layers when it should.

    No worries, here is working code, that is simultaneously much simpler and easier to follow:


    Code (CSharp):
    1.         static List<int> layerNumbers = new List<int>();
    2.  
    3.         public static LayerMask LayermaskField(string label, LayerMask layerMask)
    4.         {
    5.             var layers = UnityEditorInternal.InternalEditorUtility.layers;
    6.  
    7.             layerNumbers.Clear();
    8.  
    9.             for (int i = 0; i < layers.Length; i++)
    10.                 layerNumbers.Add(LayerMask.NameToLayer(layers[i]));
    11.  
    12.             int maskWithoutEmpty = 0;
    13.             for (int i = 0; i < layerNumbers.Count; i++)
    14.             {
    15.                 if (((1 << layerNumbers[i]) & layerMask.value) > 0)
    16.                     maskWithoutEmpty |= (1 << i);
    17.             }
    18.  
    19.             maskWithoutEmpty = UnityEditor.EditorGUILayout.MaskField(label, maskWithoutEmpty, layers);
    20.  
    21.             int mask = 0;
    22.             for (int i = 0; i < layerNumbers.Count; i++)
    23.             {
    24.                 if ((maskWithoutEmpty & (1 << i)) > 0)
    25.                     mask |= (1 << layerNumbers[i]);
    26.             }
    27.             layerMask.value = mask;
    28.  
    29.             return layerMask;
    30.         }
     
    Dreamteck likes this.
  28. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    Appreciate your input! Will make sure to include your solution in the next update! <3
     
  29. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    367
    I also think that the dropdown for adding a point to the beginning or the end is working backwards from the documentation. I didn't spend much time with it, but was confused by it for a minute there.
     
  30. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    173
    Hi,

    I just updated dreamteck Splines to 2.0 !

    I had a script that could move spline points and now since the updates I'm getting errors that "SplineEditor" cannot be found.

    I attached my script to this post. It was used to move any selected object to the mouse position by doing CTRL+T. If the selected object was a spline computer, it was moving the selected point of a spline computer instead. It worked quite well, and I'd like to be able to use the new version, but it looks like there's something I need to do.

    Thanks in advance.

    EDIT:

    Here's the two problematic lines:
    1.png

    2.png

    And the errors: 3.png
     

    Attached Files:

  31. nife

    nife

    Joined:
    Jul 24, 2015
    Posts:
    2
    Hi,
    I want to generate road with 90 degree curves only. I want every curve to be the same but to have different distances between them. Is there a possibility to make it in fast and easy way (i.e. by generating points on grid?). I'm using Spline v1.

    Can you help me to achieve it?
     
  32. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    Yes! Look into the procedural primitives. We have an Ellipse primitive that should do the trick. Generate an ellipse and then remove two of the control points to leave only the 90-degrees arc.
     
  33. nife

    nife

    Joined:
    Jul 24, 2015
    Posts:
    2
    Yes, it works! Thank you.
    Do you have any tips how to setup or even procedurally generate road build of curves and straight road between? Maybe it is possible to build it using some kind of chunks that can be connected to one spline?
    There is the effect I want to achieve

     
  34. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    The easiest way to do that is to make your spline prefabs in such a way that the first spline point coincides with the spline object's transform (you can do that by selecting the first control point and using the "Move Transform To" operation).

    Then when you spawn a segment, you would evaluate the spline of the segment at 1.0 and position the next segment at the evaluated position and rotation.
     
  35. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,115
    So I just bought this plugin and immediately ran into problems. I have my own meshes which I want to extrude/place (whichever is better) along a curve using "Spline Mesh". Using the "Count" option I am trying to place them in equal distance to each other but can't seem to get that working. They are never equal distance from each other along the spline. Secondly, I can't seem to get the count past a certain number. The "Auto Count" doesn't seem to work either.

    In the video you can see how I try to raise the number of meshes without much luck. You will also see how I move a curve point and the mesh doesn't update (until I enter the number again).

    So how do I go about any of this?

     
  36. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    In order to have equal distances, you need to use Uniform sampling mode. Please, refer to page 28 of the manual (https://dreamteck.io/page/dreamteck_splines/user_manual.pdf) to better understand how spline samples work and what solutions we offer in order to fix this.

    For the second issue, refer to page 68. We have explained why mesh generation stops after a certain amount of vertices.
     
  37. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,115
    So I have to do a workaround by splitting and duplicating manually? That's not going to work for what I have to do. I am trying to create a fairly large Railroad section.... I wish I knew this beforehand and saved my money.

    I would expect for the plugin to handle mesh generation and splitting automatically if the mesh exceeds 64k. As it stands the plugin is completely useless to me.
     
    Last edited: Jan 16, 2020
    hippocoder likes this.
  38. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,095
    Unity no longer has 64k limitation so the author needs to just remove that limit. It is about 5 mins of code time. Would expect an update to be honest.

    Is there a place in the code to edit this? I also own this asset btw.
     
    Thomas-Pasieka likes this.
  39. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    Yes, you can find this code in the MeshGenerator class inside the WriteMesh method. We will roll out an update that will not have this limit for newer versions.
     
    hippocoder likes this.
  40. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,095
    Awesome! That should soothe future troubled minds :D
     
  41. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    We are also planning to add a tool/feature (still not sure how to go about that) which will make it very easy to split a single extruded mesh into multiple objects. This will be useful for using LOD groups for example.
     
    hippocoder likes this.
  42. barker_s

    barker_s

    Joined:
    Jul 17, 2012
    Posts:
    29
    Hey @Dreamteck , nice to see version 2 is up and running, looking forward to testing it.

    I am currently working on a top-down game where I'd like to render roads and rivers. Immediately I thought about Dreamteck Splines but I'm not sure it's a proper tool for the job. I know it's possible to create branching splines, but is it also possible to use those with Spline Renderer or Path Renderer to create branching spline meshes out of the box, or do I need to come up with my own solution?
     
  43. Thomas-Pasieka

    Thomas-Pasieka

    Moderator

    Joined:
    Sep 19, 2005
    Posts:
    2,115
    When can we expect this update? I am somewhat pressed for time.

    Thomas
     
  44. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
  45. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    Next update is coming in about a month.
     
  46. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    @Dreamteck Any answer to my question above please?
     
  47. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    We don't provide
    Ah, Sorry, I was about to answer this yesterday and then something happened.

    Dreamteck Splines is not integrated with this asset. You can make your own integration, however. For example, if you attach Nodes to your spline control points, I assume you will be able to move them through this asset and therefore edit the spline.
     
    derkoi likes this.
  48. barker_s

    barker_s

    Joined:
    Jul 17, 2012
    Posts:
    29
    @Dreamteck could you respond to my question as well :) ?
     
  49. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    244
    Yes, sorry!

    You can attach any component to any spline so if your splines are branching, you would attach a mesh generator to both splines and they will both get visualized regardless of whether or not they are branching.
     
unityunity