Search Unity

Atlas Editor

Discussion in 'Assets and Asset Store' started by nicloay, Nov 24, 2012.

  1. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    $Screen Shot 2012-11-24 at 4.44.27 PM.png
    This package is just simple atlas editor.
    You can create new, modify existing atlases. The output of this tool will be new Texture2D with all source images and metadata object with new image uv coordinates.
    Also this utility can do alpha trimming - cut empty stipres(alpha=0) on an image border
    To create new atlas Just drag'n'drop images from inspector, align and save.



    package released under BSD license.
    asset store art by gekatarina

    p.s. And yes, you can use it for making atlases for 3d objects also (2d planes on all of screenshots is a 3d objects as well (with 4 vertexes and 2 triangles) )
     
    Last edited: Feb 8, 2016
  2. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    I'm far from a fan of atlases and all their associated complications (at least for most sprite managers out there), but I have to admit this is very cool and handy, Nicloay. Congratulations :)
     
  3. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    thanks MaDDoX

    package has approved at asset store.
     
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I somewhat agree. Although Unity does have draw-call issues that come into effect when you want lots of smaller objects, e.g. sprites/tiles etc, which makes it a problem for 2D mainly (but also 3D sometimes), the user shouldn't really have to mess with assembling or building the sprite sheet nor making it work ie using it to create objects. Unfortunately no tool has nailed this yet. Still it looks as good as any existing solution for dealing with this.
     
  5. bandingyue

    bandingyue

    Joined:
    Nov 25, 2011
    Posts:
    131
    It looks great.

    Is it open source?
     
  6. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Last edited: Dec 19, 2012
  7. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Ca you make it compatible with unity 3.5? Can't download with that one, perhaps you can upload the asset with this unity version to the store and it will work on 3.5.
     
  8. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Hi Lars, before i'll do that could you try to import this plugin from source.
    1. Go to git home page here http://git.nicloay.com/atlaseditor
    2. In the right column you will find widget and zip link to latest source
      $Screen Shot 2013-01-15 at 7.40.22 AM.png
    3. extrac this archive
    4. create new project
    5. copy part of extracted files to your project assets folder (this code for MacOS terminal, in windows you can do that through windows navigator, drag and drop Assets/UFTAtlasEditor from archive to your project assets folder)
      Code (csharp):
      1.  
      2. cp -R $EXTRACTED_ARCHIVE/Assets/UFTAtlasEditor $YOUR_UNITY_PROJECT_HOME/Assets/
      3.  

    after this steps you will se "UFT Atlas Editor" in "Window" menu.
    If you will get any errors in unity console, post it here and I will try to help.
     
  9. Jinman-Chang

    Jinman-Chang

    Joined:
    Jan 17, 2013
    Posts:
    1
    Works great on unity 3.5, although I failed to open demos. (I get error when I import graffiti.asset file...)

    However, when I made an atlas from the scratch, it worked perfect.

    Thanks for such a great job!
     
  10. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Jinman Chang Thanks for sharing info about 3.5,

    Probably demo scenes from source in 3.5 doesn't work because metadata is scriptable objects built on 4 version so probably it's not compatible with 3.5
     
  11. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Any chance to make it 3.5 compatible? :)
     
  12. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I am da bawss , You can take this package from sources, as i described in this message. Just one issue that demo scene doesn't work.


    and AtlasMigrationTool (starting from version 1.1) is not compatible with 3.* version as well. because it use ShaderUtil class.
     
    Last edited: Apr 11, 2013
  13. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    I've just updated package on my git repository

    You can download it here atlasEditor.v1.1_alfa.unitypackage

    changeList:
    • AtlasMigration tool
    • atlas texture background color in unity4 changed to transparent

    With atlasMigration you can update atlas, save it with different name and then update all objects on scene.
    This utility will find properties in your object, and if it has type UFTAtlasMetadata or UFTAtlasEntryMetadata and their pointed to old atlas it will change links to new one (by source texture path), and also update materials.

    here is how it looks like
    $Screen Shot 2013-04-04 at 1.04.13 PM.png
     
  14. Malandro

    Malandro

    Joined:
    Jul 22, 2012
    Posts:
    3
    Hello,

    Maybe have you forgotten to include ShaderUtils.cs?

    Oh, I see is a unity class, I don't know why it fail.
     
    Last edited: Apr 11, 2013
  15. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    ShaderUtil is an unity3d class, as WhyDoIdoIt mentioned in this topic it has been opened only in 4.1 version of unity, before this version this class was available only through reflection.

    Please let me know if problem is not in a unity version and describe the steps, how to reproduce this error, I'll try to help you.
     
    Last edited: Apr 11, 2013
  16. Malandro

    Malandro

    Joined:
    Jul 22, 2012
    Posts:
    3
    Thanks for your answer. Yes, it's a version problem, I am using 4.01 version.
     
  17. yaosheng22

    yaosheng22

    Joined:
    Apr 25, 2013
    Posts:
    18
    dear all:
    Is the Altas textures can called by ONGUI() ?
    if it can be,please tell me how to do this.

    And, is the type of normal bump can editor to altas textures?

    sorry, my English is not good.
    thx very mouch.
    :p
     
    Last edited: Jul 26, 2013
  18. reptilebeats

    reptilebeats

    Joined:
    Apr 28, 2012
    Posts:
    272
    hi great tool, i asked for something like NGUI but for atlases last year. great to see someone have a go at it as my coding abilities aren't the best.

    anyway a couple things i noticed when playing with it on the mac version.

    the auto tile option seems to be a bit buggy and sometimes places images on top of each other or to far away but not really an issue.

    one thing i would love to see in this is a zoom tool for the atlas as like i said the auto tile isnt working very well for me so could be nice to zoom out to see larger images.

    next thing to do is make it work with tillable textures haha, no complaints though awsome addition to unity
     
  19. kolchaud

    kolchaud

    Joined:
    Apr 25, 2012
    Posts:
    28
    Hi, thanks for your work !

    Is your asset able to give uv values of specific sub textures ? I would like to set it to specific face (I know mesh.uv indexes) of a big mesh.

    K
     
  20. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    yaosheng22 Yes, it's possible, but i'm not sure why do you want to do that, anyway you will receive 2 drawcalls for 2 calls of GUI.DrawTextureWithTexCoords methods.
    $Screen Shot 2013-08-06 at 6.31.29 PM.png

    here is c# code which i used (attach this script to any object on your scene and assign atlasMetadata to atlasMeta property)
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class GUIShowSprite : MonoBehaviour {
    4.     public UFTAtlasMetadata atlasMeta;
    5.    
    6.     public float timeoutInSec = 1.0f;
    7.     public int offset = 50;
    8.     UFTAtlasEntryMetadata spriteMeta1;
    9.     UFTAtlasEntryMetadata spriteMeta2;
    10.     Rect positionRect1;
    11.     Rect positionRect2;
    12.     float counter;
    13.    
    14.     void Start(){
    15.         initNewSprites();
    16.     }
    17.    
    18.     void FixedUpdate(){
    19.         counter+=Time.deltaTime;
    20.         if (counter>timeoutInSec)
    21.             initNewSprites();
    22.     }
    23.  
    24.  
    25.     void initNewSprites()
    26.     {
    27.         counter = 0;       
    28.         initRandomSpriteAndPosition(ref spriteMeta1,ref positionRect1);
    29.         initRandomSpriteAndPosition(ref spriteMeta2,ref positionRect2, false);
    30.     }
    31.    
    32.     void initRandomSpriteAndPosition(ref UFTAtlasEntryMetadata spriteMeta, ref Rect positionRect, bool alignToplef=true){
    33.         int id=Random.Range(0,atlasMeta.entries.Length-1);
    34.         spriteMeta = atlasMeta.entries[id];
    35.         if (alignToplef){
    36.             positionRect = new Rect(offset,
    37.                                     offset,
    38.                                     spriteMeta.pixelRect.width,
    39.                                     spriteMeta.pixelRect.height);
    40.         }  else {
    41.             positionRect = new Rect(Screen.width  - spriteMeta.pixelRect.width - offset,
    42.                                     Screen.height - spriteMeta.pixelRect.height - offset,
    43.                                     spriteMeta.pixelRect.width,
    44.                                     spriteMeta.pixelRect.height);
    45.         }
    46.     }
    47.    
    48.    
    49.     // Update is called once per frame
    50.     void OnGUI () {
    51.         GUI.DrawTextureWithTexCoords(positionRect1,atlasMeta.texture,spriteMeta1.uvRect);
    52.         GUI.DrawTextureWithTexCoords(positionRect2,atlasMeta.texture,spriteMeta2.uvRect);
    53.        
    54.     }
    55. }
    56.  
     
  21. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    reptilebeats Auto tile is this function Texture2D.PackTextures i didn't invented new bicycle, yes, i know that there are enough another algorithms, and another solution on c#, but this approach was fastest. And if you see the mess after arranging, that means that PackTextures can't find enough space for all sprites.
    About zooming, i'm totally agree with you, as well as with sticky border feature, i've already tried to implement this things, spent about 3days, but result was not so good, so i gave up this thing, because i'm very bussy last time with my project (coloring book). and while im doing it, i'm polishing atlas migration functionality, and sometime,very seldom, commit new code to my git repo.
     
  22. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    kolchaud Yes, it is. With each atlas textures generates metadata scriptable object, where you can find uv coordinates, pixel coordinates, texture name and maybe something else, just have a look at UFTAtlasEntryMetadata class.
     
  23. Corestacks

    Corestacks

    Joined:
    Jun 7, 2013
    Posts:
    5
    Hi,

    I have used your atlas maker to generate an atlas with 3 textures with alpha. I would like to place all 3 textures into 1 single cube mesh as layers. Is this possible? Also what kind of shaders would you suggest I use? Its some kind of alpha blending/lerping i assume... thanks in advance!



     
  24. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
  25. Corestacks

    Corestacks

    Joined:
    Jun 7, 2013
    Posts:
    5
    My project is using a 2D orthographic front view and mapping a the 3 layers all into the front block face, on top of each other (with alpha) like this:

    http://seongs.com/Example.png

    I dont think that other project would help me because that is to map a different texture on each of the sides of a cube correct?
     
  26. yaosheng22

    yaosheng22

    Joined:
    Apr 25, 2013
    Posts:
    18
    dear nicloay :eek:
    Thx a lots, I really appreciate your answers, but as far as i know , if two different objects use the different textures, and the textures are from the same Altas textrue, then I can get 1 draw calls, right? Of course they are must have the same Shader, Material , and the verts of object are not too much, that called Dynamic Batching, I think that also can used OnGUI, so what's wrong with my understanding?
     
    Last edited: Aug 28, 2013
  27. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    You are right. And it works do 3d objects as you described above. But unity GUI is different and it doesn't support dynamic batching.
     
  28. yaosheng22

    yaosheng22

    Joined:
    Apr 25, 2013
    Posts:
    18
    So.......the best Proposal is using NGUI :-| ?
     
  29. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    as you wish, if you have something complex on your HUD, then probably ngui is good, especially if you're working with mobile devices.
    But if you have just any menues, and simple HUD, so standard GUI should be fine, it's much easy for understanding and for support.
    For my self, i developed own sprite manager, but currently it's very complex to share it as is. you can google about pros and cons - sprite menues like ngui vs native gui.
    And don't forget that in 4th version unity optimised native gui, so it works faster than before.
     
  30. yaosheng22

    yaosheng22

    Joined:
    Apr 25, 2013
    Posts:
    18
    Dear nicloay~
    Thx again:eek:, Yes, I knew the GUI'version will be renewed in the future, The final question........the particle textures alse can not be used by Altas textrues?
     
  31. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Sorry I havn't worked with particles. i don't know how is going on there.
     
  32. yaosheng22

    yaosheng22

    Joined:
    Apr 25, 2013
    Posts:
    18
    ok, still thx ,you are nice guy:eek:
     
  33. yaosheng22

    yaosheng22

    Joined:
    Apr 25, 2013
    Posts:
    18
  34. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    107
    Hi,

    i using Atlas Editor and it's looks great, at least on the editor because when i play my game all texture on object are off.
    it's seems that the UVs are wrong. any idea why it happen?
    i'm apply the texture on prefabs.

    thanks,

    Haim.
     
  35. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    first of all check your shaders, maybe problem somwhere there. also, after you changed original uv, make sure that you save this changes to mesh assets.

    You can debug your uv positions by writing OnDrawGizmos code, to check which values do you have.
    An
     
  36. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    107
    Hi,

    thanks for replay... actually, this is not happen with the alpha build (V1.1 ).
    but with the alpha build i can't build to android because of "Using UnityEditor" errors.

    any work around for this?

    $Untitled-1.jpg
     
    Last edited: Sep 26, 2013
  37. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    you can exclude this code from compilation using directives, just add
    #if UNITY_EDITOR
    ...
    #end if
    for blocks of codes which you don't need on specific platform more details here
    or, you can try to use another version (this version from my another project where, probably, i made some changes) and I've checked it on iOs, so it should work for android as well. But before using it make full backup of your project (i use git for this cases with meta files enabled).

    View attachment $atlasEditor.colorus.version.unitypackage

    sorry, for this bugs, i'm not support this package, because i'm not sure that it will be interesting for someone else, after 4.3 release where unity will have new 2D tools, and automatic atlas creation.

    upd1:
    I've checked my version system, i didn't change anything in UFTSelectTextureFromAtlas, so no need to try another package from this post.
    In your case, please try this steps. - change uv -> save scene -> close unity-> open unity, if you will have correct textures, that's mean that uv's stored to mesh correctly, if not, that's mean this is my bug, and i forgot to add EditorUtility.SetDirty for mesh object, in this case in UFTSelectTextureFromAtlas class add following comand EditorUtility.SetDirty(mesh) at the edn of updateUV method.
     
    Last edited: Sep 26, 2013
  38. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    107
    i will try this...

    about "#if UNITY_EDITOR" if i will add this, i will need to mark the same way all the code
    that related to UnityEditor. right?
     
  39. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    yes, (usually i comment all body of methods which works with editor classes.
     
  40. espartaco

    espartaco

    Joined:
    Jul 1, 2013
    Posts:
    16
    Hi,
    I'm testing AtlasEditor but it's not working, even with your own example graffit . When saving it generates the metafile but not the texture.
    Is still working with last unity versions ? I want to know if it's my problem or the utility is obsolete
    (i'm an artist, not a programmer)
     
  41. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    could you check where your source images has enabled read/write flag in importer settings.

    upd1: problem was that package doesn't work in webplayer mode (i'm not sure, but in this case console should show warning or error i think)
     
    Last edited: Feb 1, 2014
  42. espartaco

    espartaco

    Joined:
    Jul 1, 2013
    Posts:
    16
    thanks!

    effectively there's a warning message (sorry, i'm an artist :)
     
  43. mitya123

    mitya123

    Joined:
    Apr 8, 2014
    Posts:
    4
    Last edited: Apr 8, 2014
  44. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Atlas is just an image with set of picure.
    with atlas generated metadata with the same name where you can find your source picture.
    I don't really remember where do i use camera script, but for any kind of job with atlas it's not required.
     
  45. mitya123

    mitya123

    Joined:
    Apr 8, 2014
    Posts:
    4
    So i need every tile from generated atlas as a single image?

    My goal is to create a tiled quads map editor for 3d game with sprites and i'm thinking that your Atlas Editor (With something like PROGRIDS) can help me with this thing. Thanks for replying.
     
  46. saunam

    saunam

    Joined:
    Jan 14, 2015
    Posts:
    1
    Hi nicloay,

    I'm quite noob to Unity. I just installed your script but I couldn't do anything intuitively. I want to make an atlas but when I put the images into the UFT Editor they all stack up and overlap on the top left corner. I move them around but when I press the align button they all go back to the top left corner.

    I tried to look at the documentation I discovered you changed your web or something.

    Could you post anywhere the documentation please?
    Or could anyone write a little explanation on how this works?

    Cheers
     
  47. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Hi, There is just one documentation for this plugin. you can find it in plugin root wolder with README.pdf name.

    Sorry, but this plugin is no longer supported. so if it doesn't work. just use any another tool. Right now it's not really needed in unity. You can just use standard sprites. and unity will pack them on build phases to the atlas.
     
  48. MaxFr77

    MaxFr77

    Joined:
    Nov 9, 2015
    Posts:
    7
    Hello, pretty cool stuff thanks for sharing !
    Found a bug on the asset store version (at least on unity 5.3.2), it seems the atlas size was not resized in the editor when the texture2D.PackTextures was called (the function actually defines the atlas size by itself). That is why the allign button behaves strangely if you had set another texture size in the editor interface than what the unity packing function decides.
    Unfortunately I can't submit the fix on your git since it seems it has disappeard ^^ so please find it attached (demos stripped out so it fits forum limits).

    Cheers and keep on the good work :)
     

    Attached Files:

  49. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    MaxFr77 Thanks for your feedback and update. Actually i don't support this package anymore. I even tried to run it on unity 5.3 with no luck =).
    You right, old git links doesn't work anymore. I reuploaded repository to the github, you can find it here https://github.com/nicloay/unity3d-atlasEditor If you wish you can push changes there.
     
  50. TBruce

    TBruce

    Joined:
    Jan 18, 2015
    Posts:
    86
    Hi Nicloay,

    Nice piece of work. I realize that you no longer support this package but I do have a question. One of the things that I dislike about all the atlas creators that I have ever tried is that they do not sort properly. Whether I add one image at a time or if I add several images in sequence. The images always seem to get added in random order. I am currently looking into trying to fix that with your editor and was wondering if you could point me in the right direction.

    Thanks!
     
    Last edited: Mar 9, 2016