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

Various Unity utility scripts available

Discussion in 'Assets and Asset Store' started by Eric5h5, Mar 11, 2010.

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I've mentioned these occasionally in relevant topics, but just to have a central location for your shopping convenience ;), here they are. They work with Unity free or Pro, Mac or Windows.

    stitchwindow.png

    Stitchscape stitches any number of terrains together seamlessly and nearly instantly, even if they don't match up closely. You can set the number of terrain pixels affected at the edges...use a small number for terrains that nearly match to begin with, and a larger number for terrains that don't really match at all. Supports undo.



    ObjReader loads arbitrary 3D models at runtime from a web page or hard drive, as long as they are in the .obj format. (Stand-alones only for hard drive files, web players and stand-alones can access web files.) Up to 4X faster than the Unity editor's built-in .obj parser. Various options including combining all groups per .obj file into one or using them as separate meshes (can load huge .obj files that choke Unity's importer because of having >65K vertices this way, as long as each group has <65K vertices), optionally generating tangents for use in bumpmap shaders, scaling and rotating meshes on import, etc. Works with Unity iPhone too.

    --Eric
     
  2. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Hey Eric, is StitchScape a script, plug in or standalone app?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's an editor script. Make a folder called Editor in your Assets folder (if you don't already have one), put the Stitchscape script in the Editor folder, and you get a new Terrain menu item called Stitch...

    --Eric
     
  4. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    And does StitchScape actually modify the terrains so they fit together seamlessly? As in, I get them stitched together in the editor but then in the game stream them in one at a time, will they be seamless still? If that makes any sense at all. :?
     
  5. KaelisAsur

    KaelisAsur

    Joined:
    Apr 9, 2009
    Posts:
    361
    I realize the answer will probably be negative, but i have to try:

    Is there any chance you could share any info on tangent generation or point me in the right direction? Every little bit of information would help.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I used this as a basis.

    Yep.

    Yep!

    --Eric
     
  7. KaelisAsur

    KaelisAsur

    Joined:
    Apr 9, 2009
    Posts:
    361
    Thank you!

    How did you handle seams and mirrored uvs, though?
     
  8. psychicparrot

    psychicparrot

    Joined:
    Dec 10, 2007
    Posts:
    884
    That's REALLY cool, Eric. Affordable, too :)
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Vertices are split on UV seams. I don't have anything specific for mirrored UVs; all the models I've tried so far seem to work fine though.

    Thanks!

    --Eric
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I just added UniFileBrowser, a cross-platform file browser (surprise!) written using OnGUI functions. Completely functional for loading and saving including keyboard navigation. This is the file browser I originally wrote for Fractscape, rewritten to be more betterer. You call it like this:

    Code (csharp):
    1. SendMessage("OpenFileWindow"); // or "SaveFileWindow"
    And you have a function in your script like this:

    Code (csharp):
    1. function OpenFile (pathToFile : string) { // Or SaveFile
    2.    // do stuff with pathToFile here, which is the path+file the user selected
    3. }
    Various options like filtering by file extension, resizable window, etc., can of course be re-skinned, and used with JS, C#, or Boo. Full commented source code so you can modify it as you like. Even if you don't have any particular need for a file browser, it can serve as a decent tutorial for using OnGUI and System.File.IO code to make something moderately complex.

     
  11. drazil austin

    drazil austin

    Joined:
    Dec 16, 2009
    Posts:
    236
    i have to say the stitch script is well worth it it would have taken forever for me to build this and stitch the terrains perfectly but with this script i was able to make it in about a week with school and my inability to focus for more than 10 mins at a time.

    with this i can stitch terrains together in like 2 seconds and spent more timme actualy building the game.

    (NOTE: my virtual world is still a work in progress)
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Cool, glad you like it.

    --Eric
     
  13. Kragh

    Kragh

    Joined:
    Jan 22, 2008
    Posts:
    657
    I would expect normal maps to come out wrong (inverted on one of the channels, maybe the green) on parts with mirrored UVs, because the tangents calculated wouldn't fit the once expected by the normalmap. But only if this is in tangent space, obviously.
    But great tools, Eric. The stiching tool I'm sure my company will buy in the future! I had already done it by hand when you uploaded it, sadly :?
     
  14. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    :eek: I hate dollar~~ :D :D
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can pay in your local currency. The dollar amount is to let you know how much it is; you can use xe.com or whatever to convert. And, in fact, the majority of my sales are non-US; Unity has a very world-wide user base.

    --Eric
     
  16. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
    StitchScape is brilliant! A real time saver.

    I'll be reaching for the credit card again!

    Best Regards,
    Matt.
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Very good. :) By the way, for those who've already bought Stitchscape and would have been interested in the bundle thing, just send me a PM.

    --Eric
     
  18. erune

    erune

    Joined:
    Nov 14, 2009
    Posts:
    63
    Hi Eric,

    Can I stitch terrains with different resolutions with Stitchscape?

    What is in my mind is creating a hi-res main terrain in the middle (#5 in the layout) and 8 low-res terrains surrounding it.

    Is it possible?

    Terrains layout:
    1 2 3
    4 5 6
    7 8 9
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, sorry, they all have to be the same resolution.

    --Eric
     
  20. erune

    erune

    Joined:
    Nov 14, 2009
    Posts:
    63
    Thats bad :(

    Thank you anyway
     
  21. Undead

    Undead

    Joined:
    Nov 13, 2009
    Posts:
    49
    Assets/Editor/Stitch.js(32,18 ): BCW0029: WARNING: Method 'Stitch.OnGUI()' hides inherited non virtual method 'UnityEditor.ScriptableWizard.OnGUI()'. Declare 'Stitch.OnGUI()' as a 'new' method.


    Any fix for this for Unity 3?
    or is it something simple i can change to stop getting this warning?

    This script still works and it was WELL worth the money as it's a HUGE time saver :D:D:D:D:D
     
  22. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Oops, didn't see this until now, sorry! I'll be able to do Unity 3 testing/fixing quite soon.

    --Eric
     
  23. Undead

    Undead

    Joined:
    Nov 13, 2009
    Posts:
    49
    I changed
    Code (csharp):
    1. function OnGUI ()
    to
    Code (csharp):
    1. new function OnGUI ()
    and that seems to have shut it up and stopped it complaining in the console, don't know if that is a real fix but I no longer get the warning error :)
     
  24. CrystalVisions

    CrystalVisions

    Joined:
    Sep 11, 2007
    Posts:
    61
    In Unity 3.0, If I have the FileBrowser script in my assets, but not in my scene (since I am trying to build a web player ) I get the following errors when trying to build:


    Assets/FileBrowser Assets/FileBrowser.js(414,37): BCE0019: 'GetFiles' is not a member of 'System.IO.DirectoryInfo'.
    Assets/FileBrowser Assets/FileBrowser.js(415,36): BCE0019: 'GetDirectories' is not a member of 'System.IO.DirectoryInfo'.

    Any ideas? I would really hate to have to remove assets before doing a build for a web player, then have to put them back to build a stand alone.
     
  25. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    in U3 the editor basically follows the restrictions of its build target.

    its a bit between bug and intend - intend for game mode, bug for editor scripts
     
  26. CrystalVisions

    CrystalVisions

    Joined:
    Sep 11, 2007
    Posts:
    61
    Ok, I really should read the documentation LOL - just discovered the Platform Dependent Compilation section of what's new..

    I modified the script to check for web player:

    Code (csharp):
    1.  
    2.     var fileInfo;
    3.     var dirInfo;
    4.     try {
    5.     #if !UNITY_WEBPLAYER
    6.         fileInfo = info.GetFiles();
    7.         dirInfo = info.GetDirectories();
    8.     #endif
    9.     }
    10.  
    And now it works.

    Eric5H5 : Maybe you can use this feature to merge the iPhone version with the regular one?
     
  27. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just a note that Stitchscape is fully compatible with Unity 3 now (actually it has been for a while, but I neglected to mention it here). If you've bought it in the past and are having difficulties with it in Unity 3, just send me a PM. And thanks for the head's-up about the platform-independent compilation...that's a good idea, although it wouldn't work in Unity 2.6.

    --Eric
     
  29. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    can stitchscape stitch NON-TERRAIN objects(meshes) with the same number of verts at each side of each face? IF not, does anyone know of a tool that can do this at runtime?
     
  30. Kaya

    Kaya

    Joined:
    Dec 21, 2010
    Posts:
    50
  31. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Stitchscape is only for Unity terrains.

    There's a video here for Stitchscape...the textures are kind of odd for a terrain, but it shows the process and results. There's an online demo of ObjReader here. It's an older version and not as good as the current version, but generally it works.

    --Eric
     
  32. Kaya

    Kaya

    Joined:
    Dec 21, 2010
    Posts:
    50
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There isn't any mtl support at this time. I tried that tanker file and it works without any problems with the current version of ObjReader:

    $obj.png

    It's very large and way off-origin, however, so that's probably why it can't be seen in the web demo. I'll see about improving it so that objects modeled like this can still be visible. There's not really any good way to have demo versions to test, since there isn't any significant functionality that I could leave out and still have anything to test. If you don't like them, I'll give you a refund.

    --Eric
     
  34. CoatlGames

    CoatlGames

    Joined:
    Apr 25, 2008
    Posts:
    773
    i bought the utility bundle and vectrosity some time ago, very cool products
     
  35. Adamo

    Adamo

    Joined:
    Dec 17, 2010
    Posts:
    55
    My understanding is that Unity has a limit of having 65K vertices in terrain.

    • Can we stitch multiple 65K terrains together using Stitchscape and still be able to use the resultant mega terrain in Unity?

    -Adamo
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Stitchscape is only for Unity terrains, not arbitrary meshes. Therefore the 65K vertices limit doesn't apply, since terrains aren't meshes and there are no vertices involved.

    --Eric
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just a note that updated versions of UniFileBrowser (1.4) and Stitchscape (1.5) are available. I've uploaded them to the Asset Store, and those who bought directly from my site have been sent update emails (well, they're still going out for Stitchscape, should be done fairly soon). If you haven't received an update notice and you think you should have, 1) check spam folder, 2) contact me. I've had a couple of bouncebacks from email addresses that are apparently no longer valid. Changes are:

    UniFileBrowser 1.4

    Additions:
    • An optional Delete button for deleting files using the file browser. (This should be used with some caution.)
    • An option to limit the file browser to the default path specified, so that navigation to other folders is not allowed and only files are shown.
    • A SetGameObject function for setting the GameObject that messages will be sent to, so your scripts that use UniFileBrowser don't have to be attached to the same object that the UniFileBrowser script is attached to.

    Changes:
    • Requires Unity 3.4 or later. (Side benefit: can use any stripping level on iOS now thanks to Unity bugfixes.)
    • The separate iPhone script is no more, replaced by conditional compilation, so there's only one script, which works on Mac/PC/iOS/Android (Android is not tested, but should work).
    • The fileWindowOpen variable is now private; instead a FileWindowOpen function returns the state of the file window.
    • The OpenFolderWindow function now needs a boolean parameter for showing files or not: true shows files (which was the previous behavior), false only shows folders.

    Fixes:
    • Better handling for whether the Open button is active or not.

    ------

    Stitchscape 1.5

    Additions:
    • "Autofill from scene" button, which will set up the terrain stitching grid without any drag'n'drop needed, based on the terrains existing in the current scene.

    Changes:
    • Requires Unity 3.4 or later.
    • Drag'n'drop to the terrain stitching grid works from the hierarchy instead of from the project.

    Fixes:
    • Fixed code warning when running Unity 3.4.
    • Stitch width is prevented from going below 2 (has no effect if it's 1).

    --Eric
     
  38. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Can stichscape work for runtime instead of editor?
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It doesn't do that out of the box, but since it uses the standard terrain APIs, I don't see any reason why you couldn't take the relevant functions and drop them into a runtime script. It looks like it should be mostly a straight copy/paste as long as you take out the calls to editor functions (RegisterUndo, etc.).

    --Eric
     
  40. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    UniFileBrowser is now 1.5:

    Additions:
    • Option to show volumes (OS X) and drive letters (Windows).
    • GetWindowRect function, which returns the rect of the browser window.
    • SetWindowTitle function, so you can set custom window titles, e.g. if you're loading/saving different types of files in the same app.
    • FileWindowClosed message sent when the file browser window is closed, in case your app needs to know this (but if not, then it's not necessary to include this function in your script, since DontRequireReceiver is used).

    Update notices have been sent to buyers from my website, and I've submitted the update to the Asset Store.

    I just realized that every Unity-related utility on my site except for ObjReader is currently version 1.5...maybe that means something, but if so I'm not sure what. ;)

    --Eric
     
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    UniFileBrowser is now 2.0. It breaks existing code (but is for the best, and this probably won't happen again), so there's an upgrade guide included too. It won't take much effort to change over to the new version in any case.

    Additions:
    • There is now an AllowMultiSelect option, so that multiple files can be selected when opening them, while holding down Command/Control (depending on OS) to add individual files, or Shift to add a range of files. If you use AllowMultiSelect when opening files, you must supply a function that will handle a String[] array rather than just a single String.
    • SetFileExtensions function, so you can set different filters at runtime. This takes a String[] array, where each entry is a different file extension.
    • Linux support. (I had difficulty with the mouse scrollwheel and double-clicking in Linux, which seem to be Unity bugs, however those are optional since you can use the scroll bar and the open button instead, so everything should be functional.)
    • Optionally prevent users from inputting characters that are typically illegal in file names when saving files.
    • The file browser script uses DontDestroyOnLoad to survive scene changes, and prevents more than one copy from existing at once.
    • Added a C# version of the example script.

    Changes:
    • SendMessage is no longer used; this has been replaced with delegates instead. That way, you don't need to use SetGameObject, and your functions can be named whatever you want (instead of OpenFile, SaveFile, etc.). So rather than this:

    var fileBrowserScript = FindObjectOfType (UniFileBrowser);
    fileBrowserScript.SendMessage ("SetGameObject", gameObject);
    fileBrowserScript.SendMessage ("OpenFileWindow");

    you can just do this, assuming the function that handles opening the file is called OpenFile:

    UniFileBrowser.use.OpenFileWindow (OpenFile);

    • Removed SetGameObject function, due to the above change.
    • Also, the FileWindowClosed message is no longer sent when the file browser window is closed. Instead, use the SendWindowCloseMessage function, which allows you to set up a delegate that's called when the file window is closed. e.g., "UniFileBrowser.use.SendWindowCloseMessage (MyFunctionThatsCalledWhenWindowIsClosed);". If you don't want the "file window closed" message sent anymore, use DontSendWindowCloseMessage.
    • Due to a change in the way the file list is drawn, the "listScrollView" style in the GUISkin should no longer contain any highlight styling in the Active and OnNormal entries. Instead, the highlight texture should be assigned to the HighlightTexture variable on the UniFileBrowser script, and likewise the highlight text color should be assigned to the HighightTextColor variable.
    • The "messageWindow" custom style in the GUISkin is no longer necessary. It's removed from the default GUISkin and can be removed from your own GUISkin if you've made one. Instead, the message window background texture should be assigned to the MessageWindowTexture variable on the UniFileBrowser script.
    • Double-clicking works on button up now instead of button down. Also the default GUIskin has been changed so that click behavior is shown correctly (highlight occurs on button up rather than button down).
    • The Popup.cs script is no longer needed, and the UniFileBrowser.js script should be in Standard Assets/Scripts now (so it can be used with C# scripts if necessary).

    --Eric
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OMG! Thread necro! Stitchscape 2.0 is out though (on my site, submitted to Unity asset store just now):

    Additions:
    • Blend strength slider, which controls how much detail is preserved when stitching.

    Changes:
    • Stitch width slider changed from absolute numbers to a percentage.
    • Found a way to have the newer undo system work with terrain data without freezing, so the Undo.RegisterUndo deprecation warning is removed in Unity 5.0 and later.
    • Improved documentation.

    --Eric
     
  43. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    New version of Stitchscape:

    Stitchscape 2.1

    Additions:
    • Terrain stitching can be done at runtime, using a new Stitch.TerrainStitch function.

    --Eric