Search Unity

Atlas3D Toolkit for NGUI [Released]

Discussion in 'Assets and Asset Store' started by tra, Aug 3, 2013.

  1. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    $header.jpg
    Atlas3D Toolkit for NGUI is now available on the Assets Store
    ver. 1.7

    Atlas3D Toolkit is a plugin for NGUI and lets you use NGUI Atlas to texture any mesh in Unity
    and have 1 drawcall with dynamic meshes.
    Additionally you can add and repair unity lightmapping to use 1 drawcall on Unity.


    In 1.7 version you can:
    - modify PIVOT point
    - change SCALE
    - add color TINT
    and keep 1 DRAWCALL without static batching!!!

    All features are scriptable.

    Atlas3D Toolkit on Assets Store
    Official support forum
    Tutorial and Video


    Limitations:
    - Unity will do dynamic batching on meshes that have not more than 300 vertices, scale of 1 and the same material.
    - Skinned meshes are not compatible with Atlas3D because they are not batching at all even with the same material as other objects.
    - Tilling is not supported. I am working on a solution in the next beta but it is not production ready.

    Components were tested on NGUI 3.0.8, Unity 3.5.7 4.3, PC, Mac, iOS (iphone4s&ipad2), Android (GalaxyS2)
    There is legacy version for NGUI 2.6.3 with basic features.

    With Atlas3D you can use NGUI ATLAS to texture imported meshes using the same workflow for both UI and 3D content.
    You can add LIGHTMAPPING with Unity Editor but normally it will break dynamic batching.
    With Atlas3D you can REPAIR lightmapping and still have 1 drawcall on dynamic objects.

    It simply converts original Unity atlas information and modifies uvs on source object. This way you can still use built in lightmapping engine and keep 1 drawcall without static batching on Unity. This method has its drawbacks. Every lightmapped object needs to be unique. So you trade mesh sharing to get low on drawcalls.

    Atlas3D Toolkit is good for low-poly dynamic meshes in MOBILE games where you need low number of drawcalls.
    It is useful for building world elements and putting lightmapping on them because they will batch even on indie version of Unity.
    When you use unlit or vertex-lit shader that needs only diffuse texture atlas texturing gives you 1 drawcall even with big number of dynamic meshes.


    Check the video tutorial on YouTube:



    If you have questions feel free to post on official support forum:
    Official support forum

    Regards, Piotr
     
    Last edited: Jan 9, 2014
  2. Rebel-Twins

    Rebel-Twins

    Joined:
    Jul 19, 2012
    Posts:
    40
    Absolutely must have for those using NGUI. I've just created NGUI atlas with all my textures for 3d models, lightmapping and I've got only one draw call. Great stuff!
     
  3. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Hi,

    nice work!!:p

    Dev
     
  4. Trithilon

    Trithilon

    Joined:
    Aug 2, 2012
    Posts:
    30
    Hello,
    I am interested in your plugin. However I need to know a few things :

    1: When you say you "Repair" Lightmapping - what exactly does it do? Is it sort of like a hack? Do you modify Mesh UVs/Lightmap textures or something to get the result?

    2: Does it REALLY need NGUI for Atlas? My 3D assets are already atlased by my Artist and share the same material. But, lightmapping as one would expect - breaks batching. Can your tool or an update to it help me fix it?

    3: Do I need to keep the 3D Atlas component over the mesh? What is the performance overhead during runtime?

    4: How can I change the material at runtime and retain the low drawcalls - do you have a runtime API?

    Thanks!
     
  5. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Hi Trithilon,
    I just send 1.2 version of Atlas3D to AssetStore for approval. The new version is more stable and compact and uses a little different method than 1 1.1 versions. I made modifications based on users comments. Now it is just one component with lightmapping repair as an option.
    In the previous version there was a problem with making prefab from GameObject with my component onboard and the original mesh was modified. It gave some problems and sometimes generated unexpected scaling of textures.
    Now in ver 1.2 the component uses original mesh as a source and creates dynamic copy of mesh for uvs modifications. Since the meshes needs to be less than 300 vertices it's not heavy for runtime.

    1. When you bake lightmapping in Unity editor create internal atlas with packed textures. Every mesh that is lightmapped uses this atlas but textures are applied based on tilling and offsetting. When you use tilling and offsetting on material texture you generally break dynamic batching. When i repair lightmapping i am converting the tilling&offsetting for modified uvs on every mesh. This way i simply cleas all the tile&offset on lightmap atlas texture because all involved mesh knows where to find lightmap region. And you keep 1 drawcall. But remember if you generate lightmapping with more than 1 texture as a result you get 1 + (atlas count) of drawcalls.

    2. In new version its actually one component and both atlas and lightmapping are integrated. But you can alvays test it with atlas as one big texture and add lightmapping repair.

    3. Component works only during startup and instantiation on the scene. All it does is make copy of mesh and modify uvs. Then its just sit silent.

    4. Atlasing is based on NGUI so you can change it dynamically. Componnent will rebuild the mesh every time you change texture.

    The new version should be in Store in 3 days if Unity accepts. The price will be lower.

    I can send you a test version to evaluate. Just register on support forum and leave me a message with request. If you like then you can buy.
    I can strip this new component to only do lightmapping repair for you but need some more time to do this.

    Check the new video to see how version 1.2 looks like.


    I will update the original post with new info after Unity accepts new package.

    regards,
    Piotr
     
    Last edited: Aug 26, 2013
  6. duncanx

    duncanx

    Joined:
    Feb 12, 2011
    Posts:
    45
    Would love to be able to one of these new atlas systems on shuriken particles. One of my projects is basically built around particle systems.
     
  7. Trithilon

    Trithilon

    Joined:
    Aug 2, 2012
    Posts:
    30
    Hello!
    This sounds great.
    Yes, indeed - a test version would be awesome. I have registered on your support forums.
    And if you could include a version of the component which doesn't need NGUI - just Repairs the Lightmaps - that would be great!

    This looks exciting. I can branch my existing project to see if this solves our Drawcall problem :)
     
  8. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    I have send you original component ver 1.2
    Need couple of days to finish my current task and I will prepare lightmapping component that will work without NGUI for you.
     
  9. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    297
    Hi,
    Can i Tile the sprites from atlas or is it limited only to non tiled textures !
     
  10. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Tiling will not work here. If you want to animate textures while keep 1 drawcall you probably need to use some more scripting.
    It is possible to change sprites dynamically. Just make an array with sprite names (that are in atlas) and change them every frame - NGUI will handle the rest. Nice idea for another tool in Atlas3D toolkit.

    If you know NGUI there is UISpriteAnimation component which will do this for you with NGUI sprites but it will not work with 3d meshes.
     
  11. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    297
    If tiling is not supported how you were able to tile the floor texture in screenshot image!. $Send1.PNG
     
  12. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Floor is made from several quads. Every quad has the same uv coordinates made by uv mapping in Blender.Hand made tilling...
     
  13. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    297
    So there is no way i can tile spites from atlas using Atlas3D Toolkit
     
  14. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    You are right.
     
  15. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    So, how does this compare to static batching in pro? You mentioned it's better to dynamic batching limiation of 300 verts, but we don't bake lightmap with dynamic objects usually.
     
  16. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    From what I know with static batching you turn off occlusion because you get one big mesh. If you use dynamic meshes you have the occlusion and many drawcalls. If you use Atlasing and dynamic meshes + lightmapping you get 1 drawcall and occlusion.
    But maybe this will change with next version of Unity when they will provide automatic atlasing ... we will see.
     
  17. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    And one more thing.
    Imagine environment with elements that you usually bake lightmap with static batching on. Now creative director wants some of them to react for player movement with physics based constraints. For example flowers, grass pieces ... but you want them still lightmapped cause they move only a little. Ok I know you can achieve this with vertex shaders and etc. but this is only an example with dynamic meshes with lightmapping.
    You can count more: moving doors, animated pieces that even if they are lightmapped and you move them - user will not see the difference between dynamic and static lighting.
     
  18. SnakeTBs

    SnakeTBs

    Joined:
    Sep 24, 2013
    Posts:
    2
    Version 1.2 incompatibility with NGUI 3.0.0.
     
    Last edited: Sep 24, 2013
  19. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Investigating the issue.
     
  20. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Fixed 1.3 version for NGUI 3.0 is ready for testing. Please join the support forum and leave request to get new version before it will appear in asset store.
     
  21. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Atlas3D 1.3 fix for NGUI 3.0.2 is ready on AssetStore.

    but

    Another fix for NGUI 3.0.3 is in betatesting phase.
    If You need it fast just go to support forum at:
    http://tracki.pl/forum
    and leave me a note.

    Atlas3D for NGUI 3.0.3 has additional feature: vertex color tint
    You can add tint just like in ngui sprites.
    You need to use a shader that uses vertex colors and lightmapping to see the effect.
    I included example shader in Atlas3D folder.
     
  22. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi, Does this kit works with unwrapped uv meshes like character and animal?
     
  23. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    This tool works with any mesh that has small vertex count enough to be batched by unity.
    You can unwrap uvs but remember that when you rig and use skeleton to animate mesh
    Unity will not batch this mesh. You can still use my plugin to texture it with unity Atlas sprites
    but you will loose the main benefit of getting 1 drawcall.
    If you want to test it just go to my forum at tracki.pl/forum and leave me a note. Then I will be able to send you
    the kit for evaluation. This Beta version comes with additional features like:
    - scaling meshes in Unity without loosing batching
    - moving the pivot
    - adding color tint

    Enjoy
     
  24. Gunhi

    Gunhi

    Joined:
    Apr 18, 2012
    Posts:
    300
    Please fix bugs. Just Bought it and imported then there are 3 errors occur

    Assets/Atlas3D/Editor/MeshAtlasEditor.cs(35,35): error CS1503: Argument `#1' cannot convert `UIAtlas' expression to type `T'

    Assets/Atlas3D/Editor/MeshAtlasEditor.cs(35,35): error CS1502: The best overloaded method match for `ComponentSelector.Draw<T>(T, ComponentSelector.OnSelectionCallback, bool, params UnityEngine.GUILayoutOption[])' has some invalid arguments

    Assets/Atlas3D/Editor/MeshAtlasEditor.cs(38,41): error CS0117: `NGUIEditorTools' does not contain a definition for `AdvancedSpriteField'

    I'm using Unity 4.2.0
    Ngui 3.0.6f6
    MACOS X 10.8.5
     
  25. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Package sent. Thank You for registering on support forum.
     
  26. isacan

    isacan

    Joined:
    Jul 18, 2013
    Posts:
    37
    Please help about this error

    Assets/Atlas3D/Editor/MeshAtlasEditor.cs(39,41): error CS0117: `NGUIEditorTools' does not contain a definition for `AdvancedSpriteField'

    Assets/Atlas3D/Editor/MeshAtlasEditor.cs(35,35): error CS1503: Argument `#1' cannot convert `UIAtlas' expression to type `T'

    Assets/Atlas3D/Editor/MeshAtlasEditor.cs(35,35): error CS1502: The best overloaded method match for `ComponentSelector.Draw<T>(T, ComponentSelector.OnSelectionCallback, bool, params UnityEngine.GUILayoutOption[])' has some invalid arguments
     
  27. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Please register to support forum.
    I will be able to send you the latest version.

    tracki.pl/forum

    Current AssetStore version is for ngui 3.0.2 and ngui is changing every week ;)
     
  28. isacan

    isacan

    Joined:
    Jul 18, 2013
    Posts:
    37
    What do we do with Unity? (5 letters):

    whats answer :D

    i can't find
     
  29. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    games

    its antispam question i thought it will be easy for us devs ;)
     
  30. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Package sent to hotmail.
     
  31. isacan

    isacan

    Joined:
    Jul 18, 2013
    Posts:
    37
    thanks for quick help :)

    this tool awesome for mobile performane

    keep it guyz :D
     
  32. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Thank you ;)
    If you like the little plugin let other know and give some stars on AssetStore - it will motivate me and help to keep up with NGUI rapid changes ;)
     
  33. jkcom

    jkcom

    Joined:
    Aug 31, 2013
    Posts:
    5
    Hi, I having a same problem. Please send me package, too. Thanks in advance.
     
  34. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Register on my support site, please. I need your mail to send package.
     
  35. isacan

    isacan

    Joined:
    Jul 18, 2013
    Posts:
    37
    Hello,

    Any update about for object have multiple material?
     
  36. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Nope. Sorry but I am busy optimising the basic features of scaling and tinting.
     
  37. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Hi,
    There is new 1.7 version in the AssetStore

    Now you can:
    - TEXTURE your meshes with NGUI* Sprite Atlas
    - modify PIVOT point
    - change SCALE
    - add color TINT
    - REPAIR Unity lightmapping
    and keep 1 DRAWCALL without static batching!!!

    All features are scriptable.
     
  38. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Working on 2dtoolkit version of Atlas3D.
     
  39. AlbertStr

    AlbertStr

    Joined:
    Feb 12, 2014
    Posts:
    13
    Hello all!

    It seems a great plugin, but I'm having problems on applying the Mesh Altas. It give me that error:

    Shader wants texture coordinates, but the mesh (object name) doesn't have them
    UnityEditor.DockArea:OnGUI()

    The mesh have texture coordinates exported from blender, and have a texture yet.
    How can I solve it?

    Thanks!
     
  40. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    Hi AlbertStr!
    I think the problem is in the import settings. Did you set it exactly like I show it in tutorial (video) ?
    I am using Blender too and it is working ok.
    If you check the import mesh settings and the problem will not dissapear you can share the project and I can test it on my computer.
    There is a support forum I made especially to handle problems like this so I welcome you to register on my forum.

    http://tracki.pl/forum/
     
  41. AlbertStr

    AlbertStr

    Joined:
    Feb 12, 2014
    Posts:
    13
    Thanks for the response!

    The unique difference I have seen in the video is that i was importing .blends and in the video uses .fbx. I tested with .fbx and works. It's a necessary condition?

    Edited: Ok, is not working, I don't know why...I don't import materials, because I assign them manually in Unity, is that maybe a problem?

    Thanks!!
     
    Last edited: Feb 14, 2014
  42. AlbertStr

    AlbertStr

    Joined:
    Feb 12, 2014
    Posts:
    13
    Ok, I've been trying hard and finally it works :).
    It's no so direct as in the video because the texture disappears since the atlas is created but it works fine!

    Thanks!
     
  43. tra

    tra

    Joined:
    Mar 21, 2013
    Posts:
    32
    So what was the problem?
    I think that using ".blend" is not the case because Unity generates fbx behind the scenes if you import Blender format.
    You need to include UV coordinates in the mesh and generate lightmap UV if you use shader with lightmapping.
    If you can write exactly what did you do to make it work it could be really cool for others.

    I am glad you finally enjoy the plugin.

    Don't forget to experiment with different shaders to use transparency with MeshAtlas.
     
  44. AlbertStr

    AlbertStr

    Joined:
    Feb 12, 2014
    Posts:
    13
    Hi!

    The problem finally wasn't with the file format or with the texture coordinates.
    The problem was that when I was applying the MeshAtlas in the scene object, the applied material was desappearing and showing me the error I wrote in the first post.
    Finally I ignored that and continued with the process, creating the atlas and applying to the the mesh. In that case it worked, but had to change the default material Transparent Unlit to another because I was causing problems.
    We are applying materials manually, not importing from blender, and we have a script that force to not import materials. I thought that would be the problem too, but i wasn't. I took a prefab that was done before, and applied MeshAtlas and Altas and works great.

    In few words, the problem was that the texture was desappearing when I applied the MeshAltas ans showed the error, but I works fine if you apply the Altas after.

    That's my experience, but the plugin works fine. Now I have to test the lightmapping, but it's a second phase :).

    Sorry for my english ^^' and thanks!
     
  45. AlbertStr

    AlbertStr

    Joined:
    Feb 12, 2014
    Posts:
    13
    Hi again!

    After using the plugin I've found some things that don't know if i'm doing wrong or if it's a bug ^^', here they come:

    - When I apply the meshAtlas component, sometimes the coordinats in the atlas crash and one sprite dissappears and others gets dupplicated. The atlas Maker crashes until i delete the duplicated sprites (if I select one, both are selected as they are the same). That forces me to delete the sprinte and add the image again, making me to update atlas in all the prefabs. This is the critical one.

    Sometimes is not so critical. Only changes the sprite coordinats when he wants and have to enter the atlas and change manuallly.

    - And the other is not so important but may be useful to be able to see the applied sprite in the object, when yo select the prefab and is shown in the preview.

    Thanks!
     
  46. grimmgames

    grimmgames

    Joined:
    Jan 11, 2011
    Posts:
    50
    Any way to send the selected sprite to a texture2d that I can manipulate further?
     
  47. pretender

    pretender

    Joined:
    Mar 6, 2010
    Posts:
    865
    does this work with latest ngui?
     
  48. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    with this asset can possible to Clipping 3d object With UI Panel?
     
  49. rosdi

    rosdi

    Joined:
    Sep 15, 2012
    Posts:
    18
    Does this work with procedurally generated meshes? Assuming all my objects are using 1 texture atlas, but they are all generated at runtime.. will it still work?