Search Unity

SplineBend - object deformation tool

Discussion in 'Assets and Asset Store' started by Wright, Feb 27, 2013.

  1. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    $Screen1.jpg

    Asset Store

    Have you ever tried to create an extensive fence or curvy hose in your Unity scene? Scabrous task: the best way to do this till now - open up your 3D editing program, load a straight object and deform it roughly to your scene. Bored from limitations on objects length due to inability to place it on hilly landscape? Now you got the solution!

    SplineBend allows you to deform your object, causing it to take the form of a spline. With the help of this script you can create create perfectly bended objects directly in your Unity scene.

    How it works:



    Add object you want to deform to your Unity scene, and add SplineScript component to it. On both sides of the object two primary markers will appear. Place the markers to the desired trajectory. In order to move the marker - highlight it by clicking and drag it the same way as an ordinary game object. To add a marker - Ctrl-right click on the line between the markers. To delete a marker - just select it and press Delete key.

    You can use different marker types:
    • smooth automatically creates a smooth curve between two adjacent markers;
    • transform sets the spline direction by transform rotation and smoothness by transform scale;
    • beizer or beizer corner allows to configure spline manually with handles;
    • corner always creates sharp corners without smoothing.
    This tool allows you to create object of almost any length by tiling an object - just like a texture - the object geometry will repeat itself the stated amount of times.

    And besides, SplineBend allows level-designer to bind object to terrain or any other mesh with collision. Binded object would follow all terrain curves and slopes. This is extremely useful for creating roads or decals.

    Advantages:
    • time economy and quality improvement as compared with deforming objects in 3D editor;
    • possibility to create roads or other long decals: see the video;
    • and you can place objects no one else has!
    Known issues:
    • bended object must have only 1 material;
    • and not more than 65k vertices.
     
    Last edited: May 18, 2013
  2. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    I missed totally the release of this tool ...just purchased.... and seem a great tool...very easy and very useful.
    I think that this tool needs(and merits) more visibility!

    My wishes:
    - Upgrade mesh supported: support of meshes with more then one material.
    - UV optimizing: option to mantain(o recreate) the UV mapping uniform .
    - Mesh optimizing: auto-removing of overlapped faces on tiling.
    - enhancements: Add two slot to insert a start and end mesh (not procedurally deformable...just as caps).
     
  3. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    422
    I purchased this Awesome tool when it's release! Just an Awesome tool!
     
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Thank you sjm tech and emergki for your reviews, it is good to hear that someone found this tool useful.

    And thanks for suggestions - the help of feedbacks could not be overestimated.

    Actually, markers are transforms. You can add cap objects as their children. If you add caps to first and final marker and set marker type to "transform" you will get exactly what is needed. But sure I will think about interface or something to create caps in a more convenient way.

    Do you need just to remove overlapping faces, or to cut (slice) your mesh nicely? The first case can be done easy - but do you really need such a function? Most probably the mesh with a removed faces will look wrong...

    I dont understand it clearly - is mapping lost after deforming (maybe some kind of bug - it should be maintained)? Or do you mean something like planar mapping casted from the top and verts uvs should change with vert position?

    Oh, I know its a considerable limitation. I will see what I can do with it, but its not an easy enhancement.

    If someone has more ideas - I would be glad to hear them. And and if you really like the tool (or maybe you dont:D) - do not forget to rate rate it in Asset Store.
     
  5. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi Wright,

    Yes alredy done but, as you said, is not very handy and the cap object mantains rotation (needs a manual rotation to be in the right position).
    example: simple wall extrusion plus 2 caps (before and after the deformation).

    i mean, for example, if i'm deforming a cube and I add 2 tiles, I obtain a mesh with 2 faces overlapping (between one cube and the next one). could be nice to have a function to remove overlapping faces at the end of tuning and recreate the mesh (in this case the caps would not be necessary).

    I Was thinking that deforming a mesh you deform also the uv.
    Could be usefull to have a function to recreate the uv (for ex. cubed) to mantain the texture uniform.

    Other little notes:
    - could be useful choose the axis (local x, y, z) of deformation. (now depends only by mesh data).
    - could be nice to deform more mesh together using the same marker paths.
    - add automatically a tile for each added marker.
    - find a way to preserve the original gameobject to come back at the begin of deformation process.
    - integrate a save(as obj) function to mantain the obtained mesh.
    - add some undo steps.
     
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Thank you for your interest to this tool, I try to to follow users needs, so I made some enhancements:
    You can choose an axis in a new version;

    Your original object will be restored now when you disable script;

    Bug with handles undo also fixed.

    Now new version (1.3) is waiting for Unity's approval and will be available soon...

    sjm tech, these little notes were very useful!
     
  7. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    You're welcome!
    This tool has a big potential ... i can't wait to test the new version.
     
  8. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Usually Unity are very efficient and make review the next day - and this time no news for 5 days. I fixed readme and re-send for review - maybe in vain...
     
  9. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    I just picked up this asset to use in a couple of projects.

    I'm very happy so far although it would be great if the "drop to" feature could work with meshes as well as terrain. It would be awesome to be able to have a road/fence etc above a mesh and then use this tool to conform the object over it's surface. Maybe with an option for resolution and/or smoothing over the mesh surface.
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Actually, it works. Note that your mesh must have a collider to receive raycasts.
     
  11. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Awesome, yes I have confirmed it works with meshes which includes the mesh output from T4M. Thanks!
     
  12. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Finally, new version is available in Asset Store
     
  13. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    My feature requests:

    - Scale at marker - allow scaling of the mesh at a marker point, for example to make a road wider at a certain point
    - Close spline - this would for example allow the creation of a complete race track
    - Random mesh - this would allow for example different rocks to be placed quickly following a spline, maybe with options for random rotation / position offset
    - Optimise mesh - after dropping to terrain optimise mesh, for example if a section of road is absolutely straight/flat then optimise geometry to be two triangles while retaining UV mapping
    - Allow editing of individual meshes (e.g. use SplineBend to quickly layout a row of barriers, then manually go in move the position/rotation of one of the meshes). Allow SplineBend to save these edits or reset.

    Edit: added another feature
     
    Last edited: Apr 29, 2013
  14. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    What trees grass are those in the video please?
     
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Thats a good idea. I'll mark it on a roadmap

    You can assign first marker in the array of markers as the last one, so it will be in the beginning and in the end at the same time. The track should be closed.

    Hm, SplineBend is not an appropriate tool for this. It does not deal with object transforms, only with meshes. But thats an idea to make a scatter plugin for unity.

    Trees are my own models, they are from a game I'm working at, but unfortunately they are nor for sale... Maybe one day I'll make a pack of trees to sell on asset store, but there will be no pines:) All rights for pones belong to my employer :)
     
  16. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi Wright,
    is there a way to use existing game objects (alphanumeric sort) as nodes for splinebend? Could be very useful!
    Regards
    Max
     
  17. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Just bought this. Excellent tool but is there a way to finalise the editing so the items become separate meshes? I'm building a mobile game with a fence around the playing area, the fence is tiled 200 times and it would be nice if I could use occlusion culling as the vert count is a bit high.
     
  18. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Very interesting.
    There's one thing that's not mentioned though: does it support lightmapping? (i.e. export the generated mesh)

    I need this function because I plan to use it for large objects like fortress' walls and similar.
    If you make this feature, the day after I'll buy immediately.

    There are several scripts to export objects from Unity, I have 3 of these scripts that I found in the wiki and around, but I don't know if your generated mesh is "visible" to these scripts.
    Anyway, it would be nice to have this function integrated with your editor.
     
  19. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    Unity is crashing on me when I add a Spline Bend script to the attached mesh, but only if it has a mesh collider applied. Can you please check this out, Wright?

    Steps:

    1) Import attached mesh
    2) Add Mesh Collider
    3) Add Spline Bend

    For me, it crashes right then. Just drops back to the desktop and wants to send a crash report. Any ideas?

    Thanks,
    Jeremy
     

    Attached Files:

  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Hi Jeremy, what am I doing wrong?:


    megmaltese, I'll try to add lightmap support this weekend (as well as scalable markers), but it will take a couple of days for Unity to review a new version.

    derkoi, I'll make it in scope of "export to obj", a bit later...
     
  21. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    No problem for me with your mesh!
    Max
     
  22. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    A big great update of SplineBend sent to Unity for review.

    new in 1.4:
    - added uv2 support.
    - new "Expand with Scale" Marker feature. Turn it on (on Marker objects) to change thickness of the bended object with Marker's transform scale. This feature allows to set width and height of your mesh directly to the needed one in particular place, and can add fine inhomogeneity to tiled objects.
    - ability to add and use scene objects as a markers. Add "Spline Bend Marker" component to scene object, select Spline Bend object and and simply drag-and-drop new marker to "Markers" array - as a new element or instead of already existing marker. And it is not necessary that your new marker should be Spline Bend's parent.
    - added "Export to .obj" option. From "Export" rollout you can export bended object to .obj file to edit it in 3d editor application or make object available for lighmapping. And "Export and Assign" button will automatically assign exported render and collision meshes to current Spline Bend object. (NB: it will turn Spline Bend component off. You can return to editing at any time just by turning it on again).
    - editor performance update. Now collision is re-calculated only on mouse button up.
     
  23. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    really a great news...I can't wait to try!
    Max
     
  24. Jerware

    Jerware

    Joined:
    May 15, 2012
    Posts:
    41
    Thank you Max Wright for testing my model. I had a chance to try it out again today and the software gods must be playing tricks on me. It works fine. When I posted, I tried rebooting Unity, my system, using a blank scene... nothing worked. Today it's fine. It may be a compatibility issue with another plugin, and if/when the problem resurfaces I'll try to do some more investigation. Thanks again.
     
  25. tbxturbo

    tbxturbo

    Joined:
    May 28, 2013
    Posts:
    6
    Is there a way of telling the spline objects to not deform over other colliders? I am using these as fences and roads in a scene with many other objects on top of them and they are deforming to those objects...I only want them to deform to the terrain.

    Thanks,
     
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    You can choose a layer your bended mesh will be dropped to. Just assign non-default layer to your terrain, and set its number in "Terrain Layer" field.
     
  27. tbxturbo

    tbxturbo

    Joined:
    May 28, 2013
    Posts:
    6
    Perfect. I'm a bit of a unity noob. I knew that it was probably something like that. Thanks for your quick reply!
     
  28. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    New version 1.42 is now in Asset Store

    Performance update, "Export to .obj" option, "Expand with Scale" Marker feature and other promised upgrades (see Release Notes for details)
     
  29. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi Wright,
    very good upgrade!
    I found a few little issues

    1)If you add a mesh collider after adding splinebend the collider mesh is calculated in a wrong way.
    Example:
    - add a plane gameobject
    - add a cube gameobject
    - add splinebend to the cube
    - add some nodes with some tile
    - no collider is generated becouse the box has "box collider"
    - add a mesh collider and replace the box collider and try to drag splinebend nodes
    - the mesh collider become crazy!


    2) export to obj don't store the actual transform position of the original object.
    Example:
    - add a cube
    - drag it some position
    - add splinebend..some nodes and tiles
    - export to obj
    - Drag the exported obj on the scene ...is placed to the origin 0,0,0.

    Some notes:
    - could you add a checkbox in the export for obj to export the collider mesh as separate mesh(now default ) if you don't need a different mesh collider.

    - could be very usefull to add the option to mantain tile distance constant instead number of tiles (now default). In this way you don't makes continuos tweaking of tile number of tiles in a long spline deformation with many nodes. Other benefit is that you can mantain constant the deformation of the single instance of object. (for ex. add a single tile of 2 meters fence and mantain this size for the entire spline deformation (path))

    - Another usefull added could be the ability to add a new node(with another key pression) after the last one node (now only between two existing nodes). In this way the nodes creation become super easy.

    regards
    Max
     
    Last edited: Jun 5, 2013
  30. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Hi Max,

    Once SplineBend is assigned to object, it replaces its filter mesh and collider mesh with it's own. So the right way to assign a new mesh - place it as the Initial Mesh in the Meshes foldout. This works both for filter and collider meshes.

    Obj file has no object transform coordinates - obj doesn't know your transform position, rotation and scale. Maybe I will add "Export in absolute coordinates" checkbox, but if you want to bake the mesh to obj and replace your SplineBend object with it it is better use "Export and Assign". It will do the job literally in a couple of clicks.
     
  31. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Oh god man I just had the bad surprise: it's for v4.
    I have Unity 3.5 and need it for it because I have the pro license.
    Will you make v3.5 version.
    It should be practically identical I think.
     
  32. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Just tested SplineBend for Unity 3.5.0f5 free to make sure that it will run on the ole Unity, and - yes, everything is ok. No errors, no warnings, everything works just fine. In fact there are no new features in Unity 4 that are used by SplineBend.
     
    Last edited: Jun 9, 2013
  33. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Ye I imagined that, but you never know if some command became obsolete or such.
    Thank you for testing, but the Asset Store won't let me buy it because I'm on Unity3.5.
    I may try to install Unity4 and make the transaction from there but it's maybe your interest to upload the thing from Unity3.5 so that other users will buy it without problems.
     
  34. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    New version 1.43 submitted from Unity 3.5 and is waiting for a review
     
  35. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Hey great thank you man :)
     
  36. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    New SplineBend on Asset Store is now available from Unity 3.5
     
  37. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you very much, man, I'll buy it this week!
     
  38. ParkerMan

    ParkerMan

    Joined:
    Mar 26, 2013
    Posts:
    11
    How can you close a loop?
     
  39. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    You need to enter... The Twilight Zone.
     
  40. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    With this tool is it possible to take a mesh and bend it at runtime, like from a script, to generate a procedural level like a racetrack or something? What's the scripting interface like?
     
  41. ParkerMan

    ParkerMan

    Joined:
    Mar 26, 2013
    Posts:
    11
    I got it to work and with a bit of coding changes, got my railroad system working with SplineBend. I have to make an object before it works, but it works and will save me time creating tracks.

    Closed Track
    $7-3-2013 11-32-28 AM.png

    Train Moving
    $7-3-2013 11-46-09 AM.png
     
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Ok, I see that this is the most popular request. Btw great work, ParkerMan!

    Right now you can link the last marker to the first one with hierarchy and reset its local transform. Marker positions will be the same, and if you set first and last markers type to "transform" you will get the closed loop without coding. Signed "close spline" feature as my next task.

    You can call function "(spline bend component).UpdateNow()" using your script, and this will make bended mesh updated. But it should only be done when your mesh should be changed, it is not recommended to use UpdateNow every frame due to performance reasons. So, if your mesh should not change constantly it is a good idea to use SplineBend, otherwise it is better to use animation somehow...
     
    Last edited: Jul 3, 2013
  43. tbxturbo

    tbxturbo

    Joined:
    May 28, 2013
    Posts:
    6
    I am having an issue with duplicating spline objects. It seems that by default it creates an instance when duplicated and if I edit the original the changes effect both versions (undesired). I have successfully duplicated without instancing in the past but I'm not sure how I did it. Any ideas?
     
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    Thanks for the feedback, you really found out a bug. I just fixed it, but it takes a couple of days for Unity to review a new version.

    To avoid instancing right now you can remove "render mesh" and "collision mesh" (if any) in the "Meshes" foldout in duplicated object. They will be auto-created immediately. It could be interim measures before the new version )
     
  45. tbxturbo

    tbxturbo

    Joined:
    May 28, 2013
    Posts:
    6
    Great, Thanks! I look forward to the update.
     
  46. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    Can I set parameters like max slope or height between two markers, so the spline follows a path but does not lead where it cannot be followed by characters?
     
  47. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Wright,

    I sent a you a PM asking if Spline Bend can support "Multiple Materials or Color Changes" in a future update. I was thinking that instead of making one mesh, SplineBend could generate a submesh for each "Tile". This way, each Tile can be assigned a separate material. The support for multiple materials would make SplineBend much more flexible to work with and can be used in many more situations. Supporting only 1 material severely limits what one can do with SplineBend.

    Thanks.
     
  48. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Great work
     
  49. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,272
    @CaptainChristian: I plan to make a selective "drop to" function that depends on marker setting. So you can set "drop to terrain" in one marker, and leave the other hanged. Mesh will be partly dropped, and you can decide what parts of it will be on a ground by placing markers.

    No, rocki, SplineBend is just a mesh tool, it does not deal with materials or colors...

    @tbxturbo Play_Edu: Thanks!
     
  50. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    Sounds good. I am creating content for my game mostly proceduraly on runtime, hence I'd like to know if SplineBend is capable of creating authentic objects using calculated points without further user input. Well, is it possible to use all functions on runtime anyway?