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. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Ah I understand; The culling depends a lot on the voxels you set up for doing occlusion culling, its not as simple and there is always a balance between voxel size vs combined objects. Thanks for the clarification
     
  2. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    err. I am simply talking about Frustrum /Camera Culling. Unity can automagically swap out sections of the mesh not being shown. To be honest I have no idea what you meant in the last post by voxel size.

    This isn't something complicated. it is Unity optimisation basics 101. Made models be logically split in world space so things that are behind you are NOT attached to things you can see?

    Allowing for higher total Vert counts without the penalty of constantly redrawing things you don't need to.
     
  3. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    I thought you where talking about occlusion culling; with regards to camera culling, then yes. again, there has to be a balance between what you combine and the span of the combined objects.
     
  4. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yeah, Occlusion Culling would be a bonus that could indeed benefit from this setup as well.
    But no, just making it so people don't say - in the future - "BUT I COMBINED IT??? WHY ISN'T IT MAGICALLY AWSOME!!!!"

    You can say - "Please set the NxN values to something sensible and try again", simple
     
  5. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    makes sense haha :)
     
  6. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    It would be very cheap to simply check the bounds of each object in world space before you combine them.
    Then group them as best you can. That wouldn't even need a mesh code rewrite - just some bound and grouping logic
     
    jmunozar likes this.
  7. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  8. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Yes, is there any possible way to make this system better support frustrum/occlusion culling, by either breaking up the single giant mesh as twobob is suggesting, or allowing for multiple texture atlases/baked meshes (like how Mesh Baker does)?

    I'm hesitant to bake everything in the scene, because that ofc means no culling for off-screen parts of the giant resulting mesh. Since I don't know enough about graphics to know how the loss of the culling compares to the draw call optimizations gained, but ideally we wouldn't have to worry about this trade off.

    An automatic division of the mesh would be ideal imo, like how twobob describes. But ofc keeping the same material/texture atlas shared among all the divisions.

    Take for example this level:



    This divison of 9 squares would at least providing some culling, but an even greater square division would be ideal. It is possible to do this division manually with Mesh Baker, but I like the single-button usage of Pro Draw Call Optimizer. Having automatic mesh division would give it a leg up on Mesh Baker.
     
    Last edited: Apr 23, 2017
  9. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hello @arlevi09
    It actually doesnt matter; it matters only if you are combining meshes which yes I plan to add it on a future release but not on the next one. I have to fix some critical bugs on a custom shader.

    if you atlas materials the occlusion culling would not affect anything (apart from loading just 1 large atlas), when you are combining meshes that's another story ;-)
     
  10. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    192
    @jmunozar Hi, I'm having a problem using prodrawcalloptimizer with skinned mesh renderer. I can combine the materials and it disables the original skinned mesh renderer and creates one with the new atlased materials but then the skinned mesh object doesn't animate - it just stays in t-pose. Is there an additional step I am missing to get the new atlased object to work with animations?

    Edit:
    I think it just doesn't work with this model for some reason cause it worked with standard unity character. I also make sure animator is checked to always animate and skinned mesh renderer is checked to update when offscreen. No change.

    I also wanted to ask if there is preferred workflow for using prodrawcall with probuilder. As you know, probuilder has its own uv editor. But I believe it is recommended by prodrawcall to adjust uvs using tiling in the shader editor. So would it make sense to stick to this method, and skip over the probuilder uv editor if we plan on optimizing the final product after we build it with probuilder?
     
    Last edited: Apr 27, 2017
  11. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Zrexa
    I was just going to reply but saw your update :). Yes. It should just work. Strange it doesn't with that model. If you want send me the model so I can give a look at it.

    With regards to the UVS yes. The only way is to adjust UVs in the material inspector. If you have UVs outside 0,0-1,1, when optimizing your atlases. Your mesh will occupy neighbor textures because the UVS are outside, hence. Your mesh will look bad.

    There is a slight lose of quality when baking tiled materials due to compression and modification of the texture to make it tiled so I would advise you to check that out before finishing all :)
     
  12. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    192
    is it possible to bake the atlas at max res like 8192 (i think this is the max that unity supports) - in order to preserve as much quality as possible. I didn't see any place to adjust max resolution on the atlas?

    I also e-mailed you at support for the model...thanks for taking the time to look at it.
     
    Last edited: Apr 27, 2017
  13. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Zrexa, got your model, I'll take a look to it in the afternoon after work ;-); regarding the max res; Open a file called "Constants.cs" in line 42 you sill see this:

    private static int maxSupportedUnityTexture = 4096;

    Change it to 8192; that should do the trick.
     
  14. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Oh, sorry! I got your tool confused with another that I'm also using that combines meshes. I've been jumping around three different optimizer tools :p. Thanks for clearing that up.
     
    jmunozar likes this.
  15. LlamaJuice

    LlamaJuice

    Joined:
    Apr 14, 2016
    Posts:
    2
    Hey! Super rad tool, but one problem I've been having is that it isn't making atlasses for my emission textures. I have a techy emissive room and a lot of assets have emission on them. It's correctly snagging the materials that have Albedo, Metallic, Normal, and Emission applied, and it's grouping all of those together, but then it's just not making an atlas for the Emission textures.
     
  16. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello LlamaJuice!, Thanks fot the kind words :), that's really strange, i thought I fixed that bug .. Do you have a small sample scene that has 2-3 objects that reproduces this issue so I can check it out ?:)
     
  17. LlamaJuice

    LlamaJuice

    Joined:
    Apr 14, 2016
    Posts:
    2
    So, I was struggling with it for a few hours this morning trying to troubleshoot and gave up, which is why I posted here. I just tried again with new assets and it worked perfectly, then tried again with my actual assets and it's working.

    I feel like a dummy, but it's working now, if I can find a repro for what broke it earlier I'll post in here. :)

    Again, thanks for this tool, well worth the cash. It's kinda nutty that clicking a few buttons can drop my batch count by over 1,000.
     
  18. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @LlamaJuice!, Well that's really good!, I knew I had solved that issue, that's why I was thinking it was strange :p.

    I'm glad the tool is working up to your needs :). Still, do let me know if you manage to get a repro case for that bug or if you have any other questions :).
     
  19. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    Hi,

    This tool looks like it's exactly what I need to reign in my # of batches (~5000-8000 right now) but I'm having a small issue and need some help.

    For example, if I take two of these objects:

    upload_2017-8-4_7-4-26.png
    upload_2017-8-4_7-4-42.png

    And I use the tool on them to bake atlas, it works but the texture messes up:

    upload_2017-8-4_7-5-59.png

    Is there a setting or anything I'm missing? Any help is appreciated. This happens across my level if I try to bake all of the objects. Very excited to make this work and improve my framerate. :)
     
  20. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Urishizu!,

    Seems to me you are having UV issues, your UVs are outside 0,0-1,1 hence, when you do the atlasing, that mesh will take parts of neighbor textures and you will see it like that.

    Checkout this video I made some time ago:


    it explains exactly why is that strange behavior happening :). To fix it you will need to open the mesh in your preferred 3D mesh editor and organize the UVs there

    Let me know if you have any other issue ;-)
     
  21. Urishizu

    Urishizu

    Joined:
    Sep 24, 2016
    Posts:
    158
    Thanks for the reply. Unfortunately I didn't make these models and everything looks like it has the same issue. :( Does clicking combine meshes only button have any performance boost, or must the textures be able to work properly to see any benefit come from this? Any help is appreciated, thanks!
     
  22. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Urishizu!,

    Sorry for the late reply! :S, I was traveling yesterday home.

    With regards to your question. The combine meshes will combine your meshes after combining atlases for the time being.

    Combining meshes is a double edge sword. its really good if you have lots of meshes together for static batching, but is really bad for your camera culling so it should be done depending on each case.

    The next update of ProDrawCall will let you combine meshes alone, but I dont have a release date as there are some bugs that need to be addressed with the new beta releases :).

    Finally, there is a simple way to "fix" these UVs (I say its simple because I manage to doit by myself ;-)). Checkout this video:


    you will still need a modeling app though.
     
  23. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, I'm very interested in this asset but I got a question to ask before I buy:
    I watched the tutorial video, it seems the asset will generate copies of objects in scene to use the baked atlas map.
    So can I pre process my models and save the copies as prefabs then use third party map generator (Such as MapMagic) to put those prefabs into my scene. Will the processed mesh be stored with the prefab or this asset can not be used on run-time located models?
     
  24. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hello @Harekelas

    When you generate the prefab, a .asset file containing the modified mesh is generated, hence yes, you would be able to use runtime located models as far as you save them as prefabs
     
  25. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great! And what about speed tree models? Can they be processed by the asset while preserving the wind animation(should be vertex color info on mesh) feature of speed tree?
     
  26. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    I'm afraid vertex colors are not supported right now but can be added to the mesh generation easily
     
  27. shrinebot

    shrinebot

    Joined:
    Sep 12, 2014
    Posts:
    16
    Cant seem to get this to work with skinned mesh renderer. It says missing MeshFilter and MeshRenderer, does the tool actually support SkinnedMeshRenderers? See attached image. Thx
     

    Attached Files:

  28. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @shrinebot ,

    Skinned mesh renderers are only supported on the Pro Version, you are using the light version which is made for testing purposes. that's the reason :).
     
  29. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great to know!
    Will this be added as a new feature in the future updates?
     
  30. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Harekelas
    it should be quite easy to add, if you could provide me with a mesh object and a sample texture / shader I should be able to implement it :)
     
  31. shrinebot

    shrinebot

    Joined:
    Sep 12, 2014
    Posts:
    16
    Thanks for the quick reply @jmunozar, that makes sense - i'll pick up the pro version. Little bit of constructive feedback, either im blind (totally possible), but that feature set wasnt apparent to me looking at the free vs pro asset. Might be a good shout to clarify whats offered in each description
     
  32. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @shrinebot!,

    Indeed, you are totally right, the differences need some more love; I will either create a blog post stating the differences and a link to it in the projects or somehow squeeze them in the description. Thanks for pointing that out! ;-)
     
  33. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, we are actually using speed tree, and the free samples from asset store: http://u3d.as/br9
    should be a good example of the models and textures. Speedtree already baked leaf and decoration's textures into an atlas but the bark texture which needs looped does not got baked into it. Also, speedtree always makes at least two textures for one tree, no options to bake several trees' textures into one atlas, that's what we hope from pro drawcall optimizer to reduce drawcalls in our massive planted forests.
    If the 3 sample trees are not enough, I can PM you and send you some other custom trees made by speedtree for you to test if you can bake them together. Just let me know :)
     
  34. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Harekelas,

    I will give it a try then over the next couple of days (else in the weekend for sure) when I get some free time. Thanks for sharing that package, I think that should be good enough. I will let you know how it goes ;)
     
  35. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
  36. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi there! How's your experiments with speedtree models?
    Any results?
     
  37. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hello @Harekelas

    Sorry for the late reply, I had to travel to my home country due to a family emergency. I do have a version that I worked for a couple of days before having this issue (but I havent tested out anything). If you want you could do some testing. please send me an email and I will send you the version.

    Again, sorry for the late reply, everything will go back to normal on the 1rst of oct hopefully! ;)
     
  38. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Ah, I see.
    Take your time and I'm actually not in a hurry. Just got curious how the things are since you said it could be easy to implement.
    I haven't bought pro drawcall optimizer so cannot ask for the test :)
    I can wait till the next version.
     
  39. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey guys!,
    Just a quick update: After 2 weeks I'm finally back!, I have been doing some tests with the speed tree and unfortunately it doesnt work how I thought it will, it will take me some more time to debug and understand why is not working :). Cheers! ;)
     
  40. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Good to hear that you are back!
     
    jmunozar likes this.
  41. Jandaia

    Jandaia

    Joined:
    Dec 8, 2012
    Posts:
    5
    Hello @jmunozar !

    I just bought Pro Draw Call Optimizer , I like it a lot, but I`m having some problems using it on my project.

    I used the tool to create an atlas for my objects with create prefabs mode. It create one prefab for each model I have and create a modified copy of each mesh assigned to it.
    Then I used those prefabs to create a level for my game.

    Now I need to add some objects to the level and I want to add it to the existing atlas, because it has a lot of free space. But when I rebake the atlas, it create new meshes instead of modifying the ones it created before that is being used in the level. Is there a way to make it modify the previously created atlased meshes instead of creating new ones?
    It is prohibitive for me to reasign all the new meshes to the scene because the level is huge!

    Thanks!
     
  42. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @Jandaia ! :),

    For your issue, there is a workaround; There is an option in the settings to not remove atlasses before bake. with this your previous atlassed materials/meshes/textures will not be removed when you atlas more objects.

    Other solution would be to move your meshes/materials/textures to another different folder and that would prevent the tool for deleting those generated assets :)

    Do bare in mind that once you bake a group of objects, the atlas remains baked. the tool can re-utilize it later but you will loose the unused space as the original UVs have been remapped. its impossible to keep track all the time of what objects are mapped to where to update the atlas all the time.

    Hopefully this will help you out ;-)
     
  43. Jandaia

    Jandaia

    Joined:
    Dec 8, 2012
    Posts:
    5
    Thanks for your fast answer! =D
    Is not that I want to prevent it to delete the generated meshes, I would like it to update the generated meshes to the new uvs , because the atlas layout would change.
    I think it should behave just like UI atlas, as you can anytime add new sprites to the existing atlas thus change its layout without any losses to current existing in game UI.

    The way it is working now, once I bake the atlas I can no longer edit it without having to re-assign all the scene meshes to the new ones. Unless I'm missing something.

    I guess the solution for now is not use create prefabs mode, and use in-scene meshes, and every time I need to rebake, I can just delete the generated gameobject in the scene and create a new ones The problem with that approach is that every level will have it`s own atlas, which is a waste of space on a mobile game size.
     
  44. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hello @Jandaia,

    I understand, yes you are right, once you bake the atlas you can no longer edit it without having to Re-UV all your meshes. This (among other things) happens because in order to optimally pack all your textures with the new one, they have to be repacked.

    Another solution that I can suggest you to use is to have blank a scene to pack all your objects and then use the meshes in the other scenes :)
     
  45. Jandaia

    Jandaia

    Joined:
    Dec 8, 2012
    Posts:
    5
    That is what I did, but I faced that problem of it creating new meshes instead of updating the existing ones.
     
  46. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    updating existing meshes will not happen as the tool (by asset store rules) cannot modify your project assets, even if they are generated by the tool and you are re-baking them :-(
     
  47. greengremline

    greengremline

    Joined:
    Sep 16, 2015
    Posts:
    183
    Hey @jmunozar , greetings! I'm interested in purchasing your asset to help optimize draw calls. However, I have a couple of questions:

    We currently load in everything procedurally using AssetBundles. Right now, we have a single Room prefab for each of our rooms that we stream in using an asset bundle. Will this work with your asset and if so, is it a simple configuration?

    Thanks!
     
  48. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @zornor90 ,

    It should work. But given the fact that you are loading an asset bundle. Make sure you Atlas all the objects within the asset bundle. Do bare in mind that if you bake a set of objects and you load them as separate asset bundles, I believe their materials will be loaded separately.

    Being said that. Try it out with the free version of pro draw call with some diffuse assets and check if it works (it should). At the end. What the tool does is generate materials and textures and remap UVs on your game objects.

    The work flow I would do would be to create a blank scene with all the objects you want to create as asset bundles.bake the scene. Generate the bundle and load it :).

    It should be pretty straight forward.

    Let me know if you run into problems even with the free version.

    Cheers ;)
     
  49. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    @gosolo2,

    Regarding your question on the feedback:

    For using normal maps, the tool will generate you an atlased normal map, you will have to set this generated texture as a normal map and activate "generate bumps from grayscale" then you will have to tweak the texture's bumpiness to your taste.

    Do remember that as the generated texture is an atlas of normal maps, if some normal maps have a lot of bumpiness and some other not, you will have to tweak the generated atlas as now all your materials share the same normal map. If its not clear just reply here so I can help you out faster ;-)
     
  50. ader42

    ader42

    Joined:
    Jan 5, 2015
    Posts:
    7
    Will you ever release a trial version that works with skinned mesh renderers? Am interested for my high poly count skinned-meshes but can't test it with the current trial version. Am much more interested in combining materials where models have the same material used on different parts of the mesh than atlas creation.