Search Unity

ProDrawcallOptimizer, reduce the number of drawcalls drastically on your project

Discussion in 'Assets and Asset Store' started by jmunozar, Mar 27, 2014.

  1. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Are you sure that's a texture issue? Looks like a lighting issue to me. Like the light is coming from a different angle.
     
  2. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Seems a normal issue... :/, I'm working with it on stand alone and bakes perfectly, and when I bake on iOS settings it shows that issue, I'm checking it right now what can it be and solve that problem ;)

    [UPDATE]: Its a problem with normal map textures not marked as normal maps, I'm working on fixing this.
     
    Last edited: Jul 11, 2014
  3. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Guys, I've sent to review a new version that hopefully supports any kind of texture format as you guys where asking. Right now is pending review, but if you want the version earlier please mail me with the purchase ID number and I'll get back to you with a link to download it.

    [UPDATE] Since version 1.9 any texture format is supported with the exception of multiple materials with textures with formats ARGB32, RGB24 or Alpha8
     
    Last edited: Jul 18, 2014
  4. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    Hello,

    If sent you a email.
    I have a mesh with 4 textures, and when I want to bake it, I have this message :
    Not optimizing as there needs to be at east 2 textures to atlas.

    And can you use other font or bigger font ? it's difficult to read the message on my 24" screen.

    Thank you.
     
  5. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hi Menfou, replied to your email, if you have more problems let me know :)
     
  6. DragonSix

    DragonSix

    Joined:
    Jul 2, 2013
    Posts:
    37
    I have the same issue, I'm using a combined mesh with multiple materials, and it tells me there's no more than 2 textures. What to do?
     
  7. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey DragonSix, for the time being, just create a dummy object with the same shader of the material you want to optimize and optimize both.

    An update is pending review right now by the asset store guys that addresses this issue. OR just mail me so you can have the update sooner :)
     
    Last edited: Aug 4, 2014
  8. DragonSix

    DragonSix

    Joined:
    Jul 2, 2013
    Posts:
    37
    Nice, that's good to know. I can wait for the update to go live.

    I also encountered the 8k*8k limit on atlases, will there be any solution to that? Like an automatic repartition of the textures between multiple atlases?
     
  9. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Excellent, it will come on 1.9.4, regarding the limit, the solution for now is to create atlases manually that are less than 8kx8k, I have it on my todo list, but I'm making a revamp of the UI for 2.x plus some performance improvements on the core.
     
  10. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Guys, I plan to rebuild the UI on Pro Draw call + including a specific tab for advanced search on the game objects. If you have any suggestion just let me know on what's missing / would make more comfortable to use the tool.
     
  11. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Hey @jmunozar, I just wanted to say thanks for being so proactive in supporting this great asset and making it even better.
     
  12. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Thanks a lot!:)
     
  13. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Hi, quick question ... can this be used to reduce draw calls of Skinned Mesh Renderers? Can they also have their textures made into an atlas. At the moment, my games have backgrounds that are already using textured atlases but the moving characters all use individual textures and I would love to be able to atlas those and reduce draw calls. Would that be possible?
     
  14. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Rajmahal,

    Unfortunately, for the time being skinned mesh renderers are not supported. I plan to add this on later versions (after the UI revamp).
     
  15. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Guys, I've been working on the UI Revamp and I think it looks waaay more better now.
    I've added search of objects by layer and by tag, moved away the checkboxes from the Objects menu to the Advanced Menu, I'm solving some small issues but hopefully the new 2.0 version should be ready for review :). checkout some screenshots.



    I still have to make the new videos; tutorials with the new UI and everything.
     
  16. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Nice!

    I've been playing around with Editor scripts to automate some of my work and it's not an easy process.

    Lots of trial and error. I got frustrated and had to take a break from it many times. :D
     
  17. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hehe indeed, but its something that someone needs to do it.
     
  18. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hi Guys!, Pro Draw call 2.0 is now out!, make sure to update it and try it out ;). if you find any problems or any issue workflow-wise let me know.
     
  19. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
  20. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    did anyone did a comparision between this asset and mesh baker
    What are the advantages of both and also the negatives
     
  21. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Unfortunately no one has made it.

    Advantages of mesh baker (as far as I can see) is that it supports skinned mesh renderers (which my tool doesnt support... yet ;)).

    Advantages of pro draw call is the easy of use, literally after 2 clicks you have your objects atlassed.

    But if anyone knows another difference it would be nice :to know about it :)
     
  22. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    575
    I only have mesh baker, and from the screenshots your interface seems more user friendly.
     
  23. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Yes, I havent tried mesh baker tho, I've only seen the vids
     
  24. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    I just tried the lite version and it does not support our game because we use Unity's LOD a lot. Can support for LOD be added?
     
    Last edited: Sep 8, 2014
    schmosef likes this.
  25. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Mike,

    I was a little concerned regarding the LOD groups, so I started to check them out with Pro Draw call. Good news :) They work out of the box.

    Please checkout this video I created that shows how to work with LOD groups and Pro Draw call.


    still, if you have another issue / is not working please write to me I'll try to figure out a workaround or something to make it work for you ;)
     
    Arkade and schmosef like this.
  26. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    I was lazy and wanted a script to fix a scene automatically :p
    This is what I ment:

    Code (CSharp):
    1.     [MenuItem("FixLODRendeer")]
    2.     static void LODRendeer()
    3.     {  
    4.  
    5.         LODGroup[] lodgroups = (LODGroup[])GameObject.FindObjectsOfType(typeof(LODGroup));
    6.         //For every LOD group: get the current groups and get the renderer names..
    7.         foreach (LODGroup lodgroup in lodgroups)
    8.         {
    9.             SerializedObject obj = new SerializedObject(lodgroup);
    10.  
    11.             LOD[] newLods = new LOD[lodgroup.lodCount];
    12.  
    13.             //For every LOD level in this lodgroup..
    14.             for(int groupNR=0; groupNR < lodgroup.lodCount; groupNR++){  
    15.            
    16.                 List<Renderer> newRens = new List<Renderer>();
    17.                 //For every renderer in this lodgroup...
    18.                 for(int i=0; i< obj.FindProperty("m_LODs.Array.data["+groupNR+"].renderers").arraySize;i++){  
    19.                     SerializedProperty prop = (SerializedProperty)obj.FindProperty("m_LODs.Array.data["+groupNR+"].renderers").GetArrayElementAtIndex(i);
    20.                     SerializedProperty propRenderer = prop.FindPropertyRelative("renderer");
    21.                     Renderer ren = propRenderer.objectReferenceValue as System.Object as Renderer;
    22.  
    23.                     if(ren!=null){
    24.                         string targetName = ren.name+".ODCObj";
    25.                         Transform target = ren.transform.parent.FindChild(targetName);
    26.                         if(target==null){
    27.                             Debug.LogWarning("No coversion found for "+targetName+  " has "+ren.sharedMaterial.shader);
    28.                             newRens.Add (ren);
    29.                             if(!ren.enabled)
    30.                                 Debug.LogError("Renderer disabled: "+ren.name);
    31.                         }else{
    32.                             newRens.Add (target.renderer);
    33.                             if(!target.renderer.enabled){
    34.                                 Debug.LogError("Renderer disabled: "+target.renderer.name);
    35.                             }
    36.                             if(ren.enabled)
    37.                                 Debug.LogError("Renderer ENAbled but not added to LOD! "+ren.name);
    38.                         }
    39.  
    40.                         Debug.Log (lodgroup.name+" ["+groupNR+"] - "+ren.name);
    41.                     }
    42.  
    43.                 }
    44.                 SerializedProperty screenHei = obj.FindProperty("m_LODs.Array.data["+groupNR+"].screenRelativeHeight");                      
    45.                 newLods[groupNR] = new LOD(screenHei.floatValue,  newRens.ToArray() );
    46.  
    47.             }
    48.             if(newLods.Length>0){
    49.                 Debug.Log ("Setting: "+lodgroup.name);
    50.                 lodgroup.SetLODS(newLods);
    51.             }
    52.         }
    53.     }
     
    jmunozar likes this.
  27. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Wishlist/changes:
    -Minor: the atlas should be transparant per default (prevents render errors on the edges for transparant materials when the atlas isn't fully used)
    -Minor: would be nice if all unity default shaders were added per default. (Isn't it possible to automatically read out the texture2D's per shader? SerializedProperty or so?)
    -Major: Option to save the generated meshes in the project. Right now they are saved in the scene only. Applying a prefab and reusing that same prefab in a different scene doesnt work: "Mesh missing"
     
  28. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Mike,

    Thanks for the ideas, regarding the major one,Its already done! ;) there is an option that you can check when you go to the advanced tab and says "Generate prefabs" and generates prefabs for each of the generated objects, saving the prefabs and the meshes in the project view. NOTE that this is _slow_.

    And thanks for sharing the code! :). I will re-check the default shaders; all of them are added by default by now..
     
  29. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Thanks for the quick replies! Perfect support :).

    Ah, actually the only shader one i was missing was a specific one, so very minor:
    Hidden/Nature/Tree Creator Bark Optimized

    I did see the save option before, stupid that I didn't try it yet. Will report back how it worked out ;).
     
    jmunozar likes this.
  30. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hehe thanks! ;), please __please__ bare in mind that is SLOW for lots of objects, also it says on the progress bar "Get some coffee..." if you click on generate prefabs hehe, so give it some time to process everything :p ;)
     
  31. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    It's working, looks like we're going to get quite a performance boost.
    I fixed the transperancy issue BTW:

    Atlasser.cs line 135
    Code (CSharp):
    1.  Texture2D canvas = new Texture2D(atlasWidth, atlasHeight, TextureFormat.ARGB32, false);
    2. //The next lines are added:
    3.             Color[] baseCol = new Color[atlasWidth*atlasHeight];
    4.             for(int i=0;i<baseCol.Length;i++)
    5.                 baseCol[i]= new Color(0,0,0,0);
    6.             canvas.SetPixels(0,0, atlasWidth, atlasHeight, baseCol);          
    7.  
     
    jmunozar likes this.
  32. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Sweet!,I'll be adding this fix to the next version when I get home, thanks a lot Mike! :)
     
    Last edited: Sep 10, 2014
  33. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    any way to generate normal map texture too
     
  34. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Kilik128! :)

    Well, normal map textures are generated if your materials contain normal map textures as well.

    NOW, if you just want to generate a normal map texture for certain objects and you dont have them, just get the objects, duplicate their original textures and mark them as normal maps, then add them to the materials and you got *unoptimized* objects with normal textures.

    After this you just can select the objects and combine them! :).

    Hope this helps you out ;)
     
  35. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Heads up: don't forget that when you're not baking to prefabs, every object uses it's own mesh. Causing a huge memory overhead. I hope I can find a workaround to re-use mesh references from the scene models.
     
  36. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Indeed, every object uses its own mesh the same as the original ones, I was thinking in combining a whole mesh with multiple materials but it turned out to be more complex than what I thought plus I couldnt find a specific case where this could help :(.

    Out of curiosity, how did you checked out the memory overhead?, by checking the vram?
     
  37. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Hey, can I ask for a clarification on what exactly this means, please?

    (what scenario should one be wary of? E.g. Make model in Blender, and drag prefab = ok vs. create empty game object, add mesh renderer, etc that reference the model, bake = potential problem?)

    Does this mean there's best practise to baking? (obvious jokes aside ;-) ) (e.g. Baking best when target platform is *both* (a) high draw call overhead and (b) high memory?)

    Thanks in advance!
     
  38. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Arkade!, :)

    I dont think the overhead will be that bad (as its the same overhead as having the average meshes (@Mike please correct me if I'm wrong)).

    The process its pretty straight forward, just bake them and create prefabs.

    The thing is that the tool creates a remapped mesh for each object you want to optimize (which at the end is the same mesh you would use), the only difference is that the meshes only are different in the UV coordinates (as they are pointing to specific places in the atlases.

    I'll be doing some testing and If I find a bottleneck or something will write in here :).
     
  39. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    I was thinking about this and wonder if the following is what @MikeHergaarden means: by baking, each instance of a mesh or prefab ends up with its own mesh instance (not shared). (hence his content "baking to prefab" looks to remove the duplication.)

    Is that possible?
     
  40. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hey Arkade,

    Currently it doesnt batch the generated meshes. if you bake prefabs it generates a different prefab for each mesh.
    I'm looking into this but cant promise anything on the short term as I'm working on some freelance job right now and also working on the 5.x version for ProDrawCall :(.

    You can still manually change prefabs then. (even tho this is cumbersome and boring :S)
     
  41. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  42. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey Kilik,

    Seems an UV problem :(, are your UVs correctly placed?

    checkout this:


    Cheers
    Juan
     
  43. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Yes it's must be that's
     
  44. DavidCH

    DavidCH

    Joined:
    Dec 30, 2013
    Posts:
    10
    Hi, I'm evaluating your product with your free version and I'm not sure to understand how it (should) work(s) :

    - If I create a scene with let's say 4 different (or even the same) static objects using the same material (using a pre-existing texture atlas), with Unity Free (no static batching available), I will get 4 drawcalls.

    - I use your tool to batch these 4 objets, if I understand correctly it should work as in your bombs video example and I should get 1 drawcall...

    ...but here is what I don't understand, It creates again 4 new and different objects... so no improvement in drawcalls count without static batching, but in your tutorial video it seems you're using the free version of Unity too. Did I missed something or is your tool just usefull when you want to create an atlas from different textures (but again without Static Batching I can't get how it will reduce drawcalls for static objects).

    Thanks and nice work on your plugin, really nice GUI and it seems very easy to use (except my little comprehension problem ;-) ).
     
  45. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey David,

    If I understand correctly if you use the same material (and same textures) it would not do anything :).

    Now here's the thing, if you use the same type of shader in the material, but the textures are different, you should be able to get the optimization. (if you have different textures you have to have different materials)

    the tool also works with objects that are not marked as static. but reduces les drawcalls..

    BTW in the tutorial vid I use my pro version, I just dont like the black skin hehe ;)

    Try it out with different textures (and ofc different materials (but the same type of material)) and let me know if you have any other issue ;)
     
  46. DavidCH

    DavidCH

    Joined:
    Dec 30, 2013
    Posts:
    10
    Thank you for your quick answer. Ok so your pro licence explains why you can reduce your drawcall to 1 with static object :) Thanks !

    I was looking at your product to optimize the draw calls for a scene where I have many static objects all using the same atlas. I have a Unity Pro licence at work and get around 50 drawcalls here thanks to static batching compared to the 500+ I have at home on my free version. I was hoping your tool would help me to use my Free licence with the same performance I get on the pro here. So it seems your tool can't do anything for me in that case :( it would require your tool to be able to merge some models into one big mesh, as some of your "competitors" offers (but with a less user friendly GUI), maybe a hint for future functionality ;).
     
  47. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Ah I see!, yeah the big issue is that you have already done what the tool does for you which is atlassing all the similar textures and grouping materials :(.

    Yeah I have tought of combining objects (and actually is not difficult to do) but I'm not sure if it serves the main purpose of the tool, after I finish the 5.x branch port I'll give it a look :).

    Thanks tho :)
    Juan
     
  48. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Guys,

    On Version 4.55 they changed the BuildTarget from iOS to iPhone; I'm updating it now to use 4.5.5 (iPhone).
     
  49. DragonSix

    DragonSix

    Joined:
    Jul 2, 2013
    Posts:
    37
    I have an issue on Unity 4.3.7f, it fails recognize the default Unity Shaders as compatible (Diffuse, Bumped and so on).
     
  50. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey DragonSix,

    That's really odd, it should just work, how does it fails to recognize the shaders?, do they show in red?, or do you get an error?, could you please mail me? I'll try to sort this thing out for you ;)