Search Unity

Batching Tools

Discussion in 'Assets and Asset Store' started by Ippokratis, Nov 28, 2011.

  1. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi,

    PM'd you link.
    Meanwhile I had to upgrade to Unity 3.5.1f2 - now batching tools give 36 compile errors - cannot fix them.

    Cheers
     
  2. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    Thanks for the feedback, please read the PM I send you back.
    Try to upgrade to the last version of Batching Tools. If the problem persist, please specify the compile errors as well as the platform you are building against ( I.e. IOS, Android, Web, Desktop ). I currently work with 3.5.1f2 as well, I have not noticed any problems.
    Thanks,
    -Ippokratis
     
  3. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    I have made some little progress on the demo.
    It is going to be a very simple level with a female manga character that will collect some diamonds.
    I finished the static geometry of the level as well as the character - camera motion so far.
    Still need to create the dynamic geometry of the level ( =gems ) as well as many other things ( menu - win screen - end screen - sound - gem behavior - background - omg the list goes on ! )
    The demo will be available in three flavors :

    1. Free, without Toon shader or Batching Tools included, with two scenes, one unoptimized, another optimized using Batching Tools. Tutorial will cover how to use Batching Tools to optimize it. Besides the promotion, I think it will be valuable as an example of how to build a simple game.

    2. As part of Batching Tools ( not including Toon shader ), and Toon shader ( not including Batching Tools ) in the next update of those two products.

    3. As a bundle offer, including the demo, detailed tutorial, Batching Tools and Toon shader for 45$.

    Here are some screenshots :
    $Screen Shot 2012-05-01 at 11.03.44 AM.png
    $Screen Shot 2012-05-01 at 11.06.53 AM.png

    I try to release it in the next month, I will make a new thread as soon as I will have the first web player ready.

    Thanks for your support,
    -Ippokratis
     
  4. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Is the lightmapping still broken?
     
  5. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    I have found a workaround for this, as well as for the normal map problem highlighted from EvilNoodle.
    Those workarounds will be included in the following update.
    Currently users can do the following :

    1. Regarding Normal maps problem :
    -Please locate the script called BTHelper.js and change line 68 from textureImporterBump.normalmap = true; to textureImporterBump.normalmap = false;
    -When you combine the textures a window called Normal map settings will appear. Click ignore.
    -The normal maps should display correctly now.

    2. Regarding Lightmaps problem :
    -Please export the static mesh as an .obj file in the Asset folder. ( Select the gameObject with the static mesh, then select Menu -> Assets -> Export mesh from Game Object )
    -Select the created mesh in the Project pane ( if you do not see it, right click - Refresh ) and in the Inspector, check the Generate Lightmap UV's checkbox.
    -Click Apply in the Inspector.
    -The lightmaps should display correct now.

    Sorry for the inconvenience of performing all these steps, it will be sorted out in the next update.
    Thanks for your patience,
    -Ippokratis
     
    Last edited: May 1, 2012
  6. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Hey, Ippokratis!

    Just want to make sure that I understand the capabilities of this neat-sounding little invention of yours correctly:

    1. It goes beyond the Static and Dynamic batching already in Unity Pro, right?

    2. I don't have to do anything special (e.g. bake light maps) before hitting your magic Batch button, right?

    3. It works for objects that move and/or scale in the scene, right?

    4. It works with 3.5.2, right?


    Thanks in advance for your help!
     
    Last edited: May 5, 2012
  7. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi Marty,
    It is an alternative method that can be used in parallel with Static and Dynamic batching already in Unity Pro ( for extra gain ) or Dynamic batching already in Unity free. The principle is that it combines geometry - textures.

    You can read the post above regarding lightmaps, I try to fix it in the next release so those steps are not necessary.

    BTDynamic, yes. BTStatic no ( hence the static and dynamic differentiation ).

    I am not aware of 3.5.2 RC 2, last version I know of is 3.5.1. Perhaps you have Pro and signed for beta ?

    In the first post of this thread you can find the manual, I hope it can clear up things a little more. If you still have questions, I 'll be glad to help.
    -Ippokratis
     
  8. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Thanks for the fast reply, Ippokratis!

    So, just to make sure I understand correctly ...

    1. Unity Pro combines meshes, but Batching Tools combines textures into an atlas.

    2. Once the "must bake light maps first" issue is resolved, Batching Tools will literally be a one-click atlas-maker.

    3. Batch Tools lets me select Static or Dynamic to suit the mesh and its particular usage in order to optimize the batching.

    4. Oops, I meant Unity 3.5.1 - my mistake.
     
  9. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    (bookmarked)
     
  10. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    No, this is not the case.
    Batching Tools combine materials, as a first step. That is, it combines many materials that have one of the supported shaders into one. In this step you get 3 things : A texture atlas, modified uv meshes and modified shaders.
    After that, you are free to use this combined material in the following ways :
    - As is, with Unity Static or Dynamic batching.
    - Combine the meshes as BTStatic, for static geometry. As Unity Pro user, you can further use and Unity Static Batching.
    - Combine meshes with BTDynamic, for dynamic geometry. This is useful for shaders not supported from unity dynamic batching, as well for avoiding performance spikes that emerge from using Unity Dynamic Batching.

    Right, the idea is that if something moves - disappears should be considered dynamic, else static.

    If you need any other info, feel free to ask.
    -Ippokratis
     
  11. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    I finally read your manual and BatchTools does indeed sound awesome.

    Maybe more than awesome. ;-)

    Off to the Asset Store ...

    Thanks, Ippokratis!
     
  12. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Oh, here's another question ... ;-)

    I use overlapping UV's in my UVW maps a lot to economize and reuse parts of the texture. Will this eventually be supported in BatchTools or is it an inherent limitation of Unity, etc.?
     
  13. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi Marty,
    Thanks for your kind words :)



    Overlapping uv's are not supported and they will not be supported. They pretty much brake any kind of atlases, be it textures, lightmaps etc in any kind of program ( not unity or batching tools only ). I see it as a trade - off, different workflow -> more speed ( by using atlases ). I found recently a nice post that explains it a bit ( although it is about lightmaps, same principles do apply for all atlases ).

    In the first pages there are some videos that could help you in your first steps with batching tools. If you need more info - help, feel free to discuss about it here.
    -Ippokatis
     
  14. Essential

    Essential

    Joined:
    Sep 8, 2011
    Posts:
    265
    Hey ippokratis, I read the link but I'm still a little unsure on correct UV mapping...

    So for a simple cube, which has a repeating texture on every side (a crate), what would I need to do so it works in Batching tools correctly?
     
  15. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi Essential,

    Thanks for the question.
    It is quite simple actually, no special uv is needed. I detail the steps below, if you find something confusing, please let me know.

    1. Create a new Cube : In Hierarchy view select Create -> Cube.
    2. Create a new material and assign it to the Cube : In Project view select Create -> Material. Drag and drop the material over the Cube in the Hierarchy view.
    3. Assign the desired texture to the material : Select the material in the Project view and drag and drop the desired texture in the Inspector view.
    4. Create as many instances of the cube as you wish.
    5. Select Menu ->Window -> Batching Tools
    6. Select the cubes in Hierarchy view
    7. Click Combine on the Batching Tools floating window.
    8. A new object appears in the project view, called level part 1_Static. Select it.
    9. In the Inspector click the Bake button.

    That is all.
    In current version of Unity ( 3.5.1 ) I was able to follow all the steps above and combine 4 cubes in one draw call.
    Please let me know if you are having any troubles.

    -Update-
    I work on the next update of Batching Tools and I decided to support the latest version of unity only. If you need compatibility with older versions of unity, please save the current version of batching tools.
    Thanks,
    -Ippokratis.
     
    Last edited: May 8, 2012
  16. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    I completed lightmap support for batching tools in unity 3.5.1f2.

    Watch the two images below : The same visual results but a huge difference in the number of draw calls, tris and verts.
    In other words : More performance without sacrificing quality.

    $Screen Shot 2012-05-12 at 3.48.17 PM.png

    $Screen Shot 2012-05-12 at 3.49.27 PM.png

    The updated package is pending approval :)
    -Ippokratis
     
  17. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Can batching tools support, unity trees? perhaps with a new shader? Thanks
     
  18. Essential

    Essential

    Joined:
    Sep 8, 2011
    Posts:
    265
    Yay! Great work, can't wait to try the new version. :)
     
  19. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    Lars Steenhoff : Thanks for the interest, at the moment trees are not supported. I wait for a better - faster terrain solution before I support terrain at all. Have you noticed T4M ( Terrain for mobile ) ? Gives decent results and of course works on desktop too.

    Essential : The steps to use lightmaps are the following ( when new release gets accepted ) :

    1. Make your level.
    2. Select the static geometry ( what does not move ).
    3. Combine it with Batching tools
    4. "Bake" it as BTStatic
    5. Mark the resulting mesh as static in the inspector ( so you can create lightmaps )
    6. With the resulting mesh and the lights selected, open Lightmaps window and bake lightmaps.

    I'll be happy to further assist,
    -Ippokatis
     
  20. paul4tune

    paul4tune

    Joined:
    Oct 8, 2011
    Posts:
    38
    great news on the update thanks very much,any chance you can add more shaders to the compatibility list.i need some for batching trees and plants ive made,they need to use an alpha channel.
    batching doesnt support any mobile transparent vertex color



    thanks
     
  21. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,

    paul4tune : Please post ( or send via pm ) the shader you try to use. Btw thanks again ( you and everybody else ) for bringing the lightmap problem in my attention, the project you send me helped me a lot to spot and make the fixes.
    Kind regards,
    -Ippokratis
     
  22. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Yes if you can support unity mobile transparent vertex transparancy shader, and a alpha blend shader they could be used for the tree leaves.
     
  23. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    For the trees they dont need to be all put in one atlas, as long as one tree with transparent leaves duplicated 1000 x can be batched.
     
    Last edited: May 13, 2012
  24. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    Lars Steenhoff :
    Please send a project folder with an example setup and I will have a look at it,
    My email is ippobour at gmail dot com.
    Thanks,
    -Ippokratis.
     
  25. paul4tune

    paul4tune

    Joined:
    Oct 8, 2011
    Posts:
    38
    sorry my bad rtfq haha
     
    Last edited: May 13, 2012
  26. paul4tune

    paul4tune

    Joined:
    Oct 8, 2011
    Posts:
    38
    this is just the original mobile shader that comes in the standard assets mobile prefab

    Shader "Mobile/Transparent/Vertex Color" {
    Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _SpecColor ("Spec Color", Color) = (1,1,1,0)
    _Emission ("Emmisive Color", Color) = (0,0,0,0)
    _Shininess ("Shininess", Range (0.1, 1)) = 0.7
    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    }

    Category {
    Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    ZWrite Off
    Alphatest Greater 0
    Blend SrcAlpha OneMinusSrcAlpha
    SubShader {
    Material {
    Diffuse [_Color]
    Ambient [_Color]
    Shininess [_Shininess]
    Specular [_SpecColor]
    Emission [_Emission]
    }
    Pass {
    ColorMaterial AmbientAndDiffuse
    Fog { Mode Off }
    Lighting Off
    SeparateSpecular On
    SetTexture [_MainTex] {
    Combine texture * primary, texture * primary
    }
    SetTexture [_MainTex] {
    constantColor [_Color]
    Combine previous * constant DOUBLE, previous * constant
    }
    }
    }
    }
    }
     
    Last edited: May 13, 2012
  27. Tinus

    Tinus

    Joined:
    Apr 6, 2009
    Posts:
    437
    Hi Ippokratis! I just purchased this package and expect to use it on a lot of projects.

    I have a specific question for a project I'm working on right now. I have a character model consisting of a single skeleton, separate meshes for different parts of clothing (each with a skinned mesh renderer), and a bunch of animations. Is it possible to use Batching Tools to merge these into a single mesh and preserve the animation?
     
    Last edited: May 15, 2012
  28. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    paul4tune : It is not possible to use this shader, due to the high number ( 4 ) of non - texture properties. A modified shader that uses less properties ( 3 fixed, 1 adjustable ) could work, but I can develop it as a paid assignment, not as part of batching tools. PM me for details. Plus, it uses alphatest, so it will be slow on mobile. There are no alternatives though when it comes to z-sorting transparent submeshes that belong to the same mesh.

    Tinus : Welcome onboard :) No, it is not possible, plus such an approach would probably make the game slower. Each vertice and each bone added increases CPU load.

    -Ippokratis
     
  29. paul4tune

    paul4tune

    Joined:
    Oct 8, 2011
    Posts:
    38
    Any chance you could make a bunch of mobile shaders like the toon shaders with alpha that work with your batching tools,I'd buy them,i think with trees and plants there are always gona be lots of them so batching plants and trees would be great
     
  30. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    When's the new version going up? Has it been waiting for approval for many days?
     
  31. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    paul4tune : pm sent.

    wightwhale :
    It is indeed weird, the package is waiting for approval for almost one week.
    Anyone who wants the updated version, please pm me your voucher number (provided by asset store when you make a purchase) and I will be happy to send it over to you.
    Thanks,
    -Ippokratis.
     
  32. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    I just bought this and it's great. It'd be even greater if it supported substances. Of course I can export my maps from the substance and then load them into a regular material but it would certainly save time if it were automatic.
     
    Last edited: May 21, 2012
  33. paul4tune

    paul4tune

    Joined:
    Oct 8, 2011
    Posts:
    38
    i cant believe the update is still not on the asset store,what are they playing at
     
  34. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    Marble : Substances as textures are supported, but not as "substances". The tech behind substances is not accessible, so a native solution must come by the package providers ( i.e. they are the only ones who can provide it ). It would be nice though.

    paul4tune :
    It is strange indeed. Here is a screenshot :
    $Screen Shot 2012-05-24 at 11.48.34 PM.png
    I do not really understand why it takes so long, my guess is that I did something wrong during the submission, so I will try to re-submit in the weekend. By then, any customers who wish to use the new version can pm me. Please send me your voucher number, so I can verify that you bought the asset : it is in the email unity send you when you purchased the package.
    Thanks for your patience,
    -Ippokratis
     
  35. PizzaGuy213

    PizzaGuy213

    Joined:
    Nov 23, 2010
    Posts:
    305
  36. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    Last edited: Jun 5, 2012
  37. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Hi Ippokratis,

    have you tried using your tool (well, the batching functions) in a project that generates the scene? I'm currently generating the content of a level (rooms etc) in runtime at level start and I would like to batch it (AFAIK Unity cannot batch elements that have been generated in runtime).

    Metron
     
  38. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,

    ThomasQ : I will try, but chances are that folliage needs alphatesting to work, which is very slow on mobile. I would nnot expect to see huge gains this way.

    rockysam : I have downloaded your project, which consists of a wall made by cubes, some spheres that you throw against it and a floor. I really cannot think how Batching Tools could help in optimizing it. Perhaps you would like to try Batching Tools in a more complex scene where using it would make sense.

    Metron : If you wish, I could create a project specific solution. Please pm me for details.

    Kind regards,
    -Ippokratis
     
    Last edited: Jun 6, 2012
  39. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    Try alpha blending for iOS and alpha cut for Android
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi Ippokratis, hi thomasq,

    mesh combining might be a way to speed up performance on android using alpha testing shaders – but not on ios devices using alpha blending unless you do not want to have heavy problems as far as z-odering is concerned.
    in fact the tree models used with the alpha blending shader are even broken up to several meshes in order to get around the z-ordering problem but use static batching at the same time in order to reduce the number of draw calls, which works pretty well as far as all the tests done by other users have shown.

    in fact i do not know anything about your private batching function but in case it works with alpha blending shaders avoiding z-sorting problems like the way i went (broken up models using static batching) this might really speed up rendering even on ios devices.

    if you have any further questions just do not hesitate to ask,

    lars



    p.s. right now i am going to batch some tree creator trees.
     
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
  42. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    @Ippokratis: the no. of drawcalls is around 163. Batching tool cannot help because the cubes are not static or no texture?
     
  43. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Any idea why the update isn't on the asset store yet? I'm still showing 1.43 from march.
     
  44. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,
    larsbertram : Sorry for the delay, I have some serious time constrains. I wish to implement this but it will take more time.

    rockysam : pm sent, I am waiting for your new projects ( take your time, no rush ).

    wightwhale : If you already purchased Batching Tools, please pm me with the voucher number of your purchase and an email address so I can send the updated version. I have already send a few ( I should have reuploaded the asset, I postponed it to include more updates, then I had big time pressure from my day job, now we have elections - I can tell you the story of my life here, the bottom line is that the update is available if you need it ).

    Kind regards,
    -Ippokratis
     
  45. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I sent you a message but maybe you missed it. Please let me know as I would like to put batching tools in my game soon.
     
  46. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi,

    I have re - submitted Batching Tools, I will try to update a little more often now.
    Thanks all for your support :)

    whightwale : I have send the updated version, I hope you will find it useful.

    Kind regards,
    -Ippokratis
     
  47. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    The new version of Batching Tools, 1.45, is available now at the unity asset store.
     
    Last edited: Jul 5, 2012
  48. dondon

    dondon

    Joined:
    Jul 6, 2012
    Posts:
    35
    Hi Ippokratis

    I bought your Batching Tools and it works fine with some of my models.
    Now with some I get errors when I try to expand the submeshes:

    Mesh.tangents is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
    UnityEngine.Mesh:set_tangents(Vector4[])
    BTHelper:CopyMesh(Mesh) (at Assets/BatchingTools/Editor/Plugins/BTHelper.js:416)
    BTHelper:ExpandSubmeshes() (at Assets/BatchingTools/Editor/Plugins/BTHelper.js:116)
    BatchingTools:OnGUI() (at Assets/BatchingTools/Editor/BatchingTools.js:909)
    UnityEditor.HostView:OnGUI()

    IndexOutOfRangeException: Array index is out of range.
    BTHelper.ExpandSubmeshes () (at Assets/BatchingTools/Editor/Plugins/BTHelper.js:157)
    BatchingTools.OnGUI () (at Assets/BatchingTools/Editor/BatchingTools.js:909)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:228)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:221)
    UnityEditor.HostView.OnGUI () (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:121)

    I have made a little debbuging and I have seen that the error occurs after it has made this line of code:
    Line 394:
    Unwrapping.GenerateSecondaryUVSet (newMesh);

    Can you help me to solve this issue?

    Thanks and have a great day
    dondon
     
  49. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    Hi dondon,
    Thanks for the support :)
    I have tried to test the expand submeshes against several models without being able to trigger this output.
    Would you like to send me the model so I can try to fix this error at my email ? ippobour at gmail dot com
    Kind regards,
    -Ippokratis
     
  50. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Nice tool and look helpful I'm thinking to buy it, however I was reading the documnetation and found that you only support 16 shaders, however my game is using the Advance Surface Shaders (ASS) package from the unity store, and the author clearly mentioning that the shaders is working fine and fast on the mobile platfrom, so can your tool work with the (ASS)?