Search Unity

Pro Material Combiner, Combine Materials Quick and easy with just 2 clicks!

Discussion in 'Assets and Asset Store' started by jmunozar, Feb 12, 2015.

  1. jmunozar

    jmunozar

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

    ProMaterial Combiner And ProMaterial Combiner++ are editor extensions that just by selecting an object
    and clicking on combine it will compress all your materials to just one.

    This package will remap and combine automatically each of your UV maps on your
    meshes to a single atlas.

    With this you will get rid of the overhead of having several materials on each of your
    meshes and also reduce the number of draw calls each of your renderers consume.

    Have specific / custom shaders?, dont worry, the tool will automatically
    recognize any custom shader and work with it.

    Both tools do exactly the same, the differences are that ProMaterialCombiner++ includes:
    - Source code.
    - Reuse textures: Makes atlas smaller.
    - Batch mode: Combine several objects materials quickly.

    UNITY 5 supported.

    NOTES:
    - Easy, Just select your object and click combine.
    - No scripting required.
    - Meshes automatically set up and adjusted.
    - Support for any custom shader (detected automatically).
    - Full lightmapping support.
    - Your source assets will not be touched.
    - Works with colored and textured materials.
    - Supports tiled materials.
    - Generate prefabs from the combined object.
    - Supports skinned mesh renderers.
    - Malformed UVs on colored-only materials are organized automatically

    NOTE: In order to combine materials all shaders have to be the same type.

    ProMaterialCombiner can be found at:
    https://www.assetstore.unity3d.com/en/#!/content/29312


    And ProMaterial Combiner++ can be found at:
    https://www.assetstore.unity3d.com/en/#!/content/22860

    if you guys have any suggestion / question please let me know I'm eager and open for feedback! :)
     
  2. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Version History:
    1.0 Initial release
     
  3. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    What is the difference with your other asset Pro Draw Call Optimizer?
     
  4. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey @angel_m :)

    ProMaterialCombiner combines materials per game object and that's pretty much it, ProDrawCall combines materials per game object plus materials on all your game objects.

    thats pretty much, that's why ProMaterial's price is lesser.

    if you have ProDrawCallOptimizer you can do what ProMaterialCombiner does.

    ProMaterialCombiner is useful when you just need to combine materials in your game objects :).
     
    Last edited: Feb 13, 2015
  5. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @jmunozar, does this asset support combining material colors to vertex colors? It seems it only outputs textures with the colors as blocks.
     
  6. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hey @tonic :),

    Unfortunately no, what the tool does is that given the shader you are using if the shader doesn't have a texture then it takes the UVs of the mesh and centers (0.5f, 0.5f) it to the colored-generated texture.

    The tool doesn't generate a new shader with the colors (which is what it would needed to be done if you wanted to have vertex colors), instead it uses the shader the game object has and creates a texture from the colors.

    Hope this answers your question :)
     
  7. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Thanks @jmunozar for a good answer. I found another tool which did what I wanted (put colors of multiple materials to vertex colors and single mesh&material).

    (Except it was unable to optionally output two separate batches split by opaque and transparent. That is, optionally I'd like to have two output materials when there is both opaque&transparent stuff present... so that's a feature I'm still missing.)
     
  8. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    ah, could you point me to the tool you found?, I'm curious how it achieves this without changing the shader :)
     
  9. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
  10. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Ah I see, still thanks a lot for sharing the link I'm going to check it out :)
     
  11. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    Hello!

    What if I have a game object with two diferent kind of materials? for example I have 3 diffuse materials and other 4 toon materials in the same game object, can I use this tool to combine the 3 diffuse materials in one and the 4 toon materials in one so the game object will have only two materials? just one diffuse and one toon.

    Im very interested in buying this asset, thanks!
     
  12. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey @Dolzen, if you had one game object with multiple materials. BUT all the same shader, the tool will combine them for you automatically.

    Being said that, if you have different type of materials in your game object it will not work unfortunately.
     
  13. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    thank you!
     
  14. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    It works with multiple UV? I have a game object with multiple materials all the same shader but the shader use two different textures with two UV one for each texture, it is supported?

    Thanks!
     
  15. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey @dolzen,if the shader is the same and the UVs are in the [0,0-1,1] space then yes, it will merge it into one material =)
     
  16. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Is this asset still supported and get upgrades ? I really need asset like this.
    Thanks
     
  17. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey @MoribitoMT,

    Yes, if it's still selling it will get upgrades and be supported. The thing is that there's not much to add to this tool now besides stability and support =)
     
  18. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello,

    I am looking into buying the Material Combiner ++, because I need to create one texture atlas for several trees and bushes, the problem that I am finding is that the tree models uv, are using tiling vertically meaning that the leafs are uv are within the [0,0,1,1] but the tree trunks are using [0,0, 1, 1+]. Does your tool allows for me to make horizontal atlas? Say for example an atlas 3072 by 1024? so the tree trunks can tile vertically. In this example the individual texture map would be 1024 x 1024 repeated horizontally.

    And I don't want to combine the tree models into 1, so it must work with separate models

    Regards,
    Carlos
     
  19. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hey @strongbox3d,

    Unfortunately I cannot tell you accurately if it will work. This is because the packing algorithm doesn't normally pack your textures in certain order. It starts packing by area size(from bigger to smaller).

    So in your case te result will be unexpected and likely to not work. =(
     
  20. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Thanks for your quick response. What a shame, because I could really benefice from a texture packer that does that. Unfortunatelly I can't change the uvs of the tree since they were created with the Tree creator inside Unity.

    Regards,
    Carlos
     
  21. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello Carlos,

    Yes, I can totally understand. But is better to honest so you know where are your spending your money =).

    If you have any question, don't hesitate to ask. =)

    Juan
     
  22. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Thank you Juan.
     
  23. akerusoft

    akerusoft

    Joined:
    Dec 18, 2015
    Posts:
    5
    I bought this asset.
    I tried combine materials of diffuse shader.
    But it failed combine.
    Error are as follows.

    IndexOutOfRangeException: Array index is out of range.
    ProMaterialCombiner.MaterialCombiner.ExtractMesh (UnityEngine.Mesh masterMesh, Int32 subMeshToExtract) (at Assets/ProMaterialCombinerPlusPlus/Editor/Core/MaterialCombiner.cs:280)
    ProMaterialCombiner.MaterialCombiner.CombineMaterials (Boolean usesSkinnedMeshRenderer, System.String customAtlasName, Boolean reuseTextures, Boolean generatePrefabs) (at Assets/ProMaterialCombinerPlusPlus/Editor/Core/MaterialCombiner.cs:122)
    ProMaterialCombiner.CombinableObject.CombineObject (System.String customAtlasName, Boolean reuseTextures, Boolean generatePrefab) (at Assets/ProMaterialCombinerPlusPlus/Editor/Core/CombinableObject.cs:63)
    ProMaterialCombiner.ProMaterialCombinerMenu.OnGUI () (at Assets/ProMaterialCombinerPlusPlus/Editor/ProMaterialCombinerMenu.cs:234)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  24. jmunozar

    jmunozar

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

    Thats because the number of submerged you have mismatches the number of materials you have.

    Could you check the number of submerged are the same number as materials? =).

    Let me know if you struggle, I'm here to help ;-)
     
  25. akerusoft

    akerusoft

    Joined:
    Dec 18, 2015
    Posts:
    5
    Hello.
    I am not good at English.

    As in the attached image, I think that there is the same number.
    Where can I check the number of submerged?
     

    Attached Files:

  26. jmunozar

    jmunozar

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

    No worries. Can you send me your mesh to my email so I can check it?

    I'll give it a look and get back to you after work ;)
     
  27. JecksonLiu

    JecksonLiu

    Joined:
    Nov 25, 2016
    Posts:
    6
    Hello @jmunozar ,I am a Chinese.I bought your Pro Material Combiner++ in the morning,It is so good,But I don't know why this happens.Can you help me? ~`[0QM$}MW]@ISNL5ZAQ8UB.png V5M7I[%UKYLZN]E7E@A35PK.png (Y3[VT5$%~}8B[EE[PJP@1W.png YKHNZBQQ9I4R90RD}BCID(2.png
     
  28. jmunozar

    jmunozar

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

    Sorry for the late reply! I was actually sleeping :). The issue you are having there; if you checkout the console; is that you are having UV problems; That means your UVs are outside 0,0-1,1, hence some of your meshes are using textures that are from other meshes in the atlas (neighboor textures). Checkout this video so you can understand what the problem is:


    I also made this video to "fix" that issue more or less easy.


    If you want to have tiled textures; the best way to do it is by setting the tiling within the material instead from the UVs themselves.

    Do let me kow if you have any other question :)
     
  29. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    @jmunozar

    Can this be used to create atlases shared by more than 1 skinned mesh, or is it per-mesh only? And can the result be edited, or does it produce an .asset file?

    Thank you.
     
  30. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello lod3.

    If you create a prefab it generates an asset file. Yes you should be able to share the same material between skinned mesh renderers. Byou will need to duplicate the mesh objects.

    Now. If you want your original meshes to have the same Atlas then it will not be possible. As you will need to modify the UVs on those meshes to match the position in the Atlas. For that. Use Prodrawcall optimizer. Which will map different meshes to a same Atlas.

    Hope this answers your question :)
     
  31. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    Hi @jmunozar
    Actually what I'm trying to do is take a skinned mesh that has 2 texture variations (2 materials each), but combine all 4 materials into one atlas since the source mesh is the same. Is this possible?

    And it appears the evaluation version of PDC does not support skinned meshes. I tried everything I could think of, but it keeps reporting my skinned meshes as "Not optimizable", even using Legacy Diffuse as instructed. I even tried other skinned meshes as well.
     
  32. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Yes
    Hello Lod3.

    Yes it should work. I just private messaged you with some details ;-)
     
  33. eedok

    eedok

    Joined:
    Sep 21, 2009
    Posts:
    194
    Hey,

    So just tried this asset out on one of my models and I'm getting an IndexOutOfRangeException, at this line:


    What needs to be done so that the masterMesh.uv will have values?
     
  34. jmunozar

    jmunozar

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

    That can mean that your mesh has less UVs / more UVs or you are mising a material that the mesh has.

    how many materials does the original mesh has? and how many materials are you using in the inspector? :)
     
  35. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    @eedok; couple of quick questions. Do the examples that come with the package work?. if you cannot solve the issue, do send me your mesh and I can take a look into it and tell you more precisely what's going on ;)
     
  36. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello @eedok
    Thanks for sending the file that fast :). The problem that you are getting is because as your mesh contains more than 65535 vertices, by default unity splits it it in sub meshes and doesnt preserve the indexes of the UVs (corresponding to each mesh), hence you are getting that null ref exception.

    The only way to solve this is by either split your mesh from the 3D app or use meshes with less than 65535 vertices. Try that out and if the problem persists do let me know ;-)

    Screen Shot 2017-08-28 at 6.24.08 PM.png
     
  37. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi there!
    I'm interested in this asset as before I looked at your other asset: Pro Drawcall Optimizer.
    Would like to know the difference between this one and the PDO
    Seems this asset can also combine materials from different game objects if I got it right in the description.
    So can this one be used to combine multiple speedtree's materials together without meddling their meshes?
     
  38. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    hello @Harekelas
    ProMAterialCombiner works only on single game objects and combine their several materials into just one. if you have ProDrawCallOptimizer there is no need to have this as ProDrawCall already does what this tool does + combines several game objects.

    Being said that. for speed trees I'm not sure if it will work due to the vertex coloring property.

    Hope it answers your questions :)
     
  39. fabiohenriqueaf

    fabiohenriqueaf

    Joined:
    Feb 5, 2017
    Posts:
    1
    Hello!

    I'm trying to combine several materials of a single object (they all use common standard shader), but the tool is not allowing it, displaying the message "Different types of standard shader in the object, check textures".





    Am I doing something wrong?

    Thanks in advance.
     
  40. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello Fabio.

    The standard shader changes depending on the textures you have allocated. All those standard shaders should have textures in the same slots in order to be combinable.

    That should fix your problem ;)
     
  41. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello,

    Does this tool creates texture atlas for different independent object without the need to combine the objects? I have several stones, houses, furniture, that I DON'T want to combine into a single mesh, but I want them to use the same material with texture atlases for each type of texture(diffuse, normal, height, specular, etc). Please let me know because I am ready to buy right now if it does this.

    Regards,
    Carlos
     
  42. jmunozar

    jmunozar

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

    The tool you are looking for is Pro Draw Call optimizer.

    ProMaterialCombiner will combine one object if it has several materials; Pro Draw Call optimizer will combine several objects into one material.

    DO bare in mind that if you use promaterial or prodrawcall and your objects have several materials in one object; in order to combine them they need to have the same type of shader; and in the case is the standard shader, they need to have assigned the same texture slots accross the game objects.

    Checkout ProDrawCall optimizer light:
    https://assetstore.unity.com/packages/tools/utilities/pro-draw-call-optimizer-light-16888
    Its free and will work with diffuse objects; try it out and do some tests with diffuse objects and if it works; you can purchase ProDrawCall which you can find here:
    https://assetstore.unity.com/packages/tools/pro-draw-call-optimizer-54360

    Do let me know if you have any other question ;-)
     
  43. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    The shader I am using for my objects's material is the Tesselation/Standard Distance material, does ProDrawCall optimizer tool work with that shader?

    Regards,
    Carlos
     
  44. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    It should work. did you tried out your project with the light version and diffuse?. which shader are you trying to use specifically? any from the asset store?.

    If the shader you are trying to use uses textures, it should work. now if its a shader that came from the asset store and has the name "standard" in the shader itself; there could be some conflicts. if you want drop me an email to discuss more in deep.
     
  45. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    I am using Unity 2017.2 for Xbox One. The material works well I just need to create atlases for the different textures and that my models's UVs match the atlases's position. I didn't try the free, because it wouldn't make any difference if it works for diffuse, since the actual shader I need it to work with is the tesselation one

    Regards,
    Carlos
     
  46. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Are your UVs inside [0,0-1,1]? if they are they should work. Unfortunately I dont have access to xboxone builds. I'll contact you through email to discuss more in deep that specific shader.
     
  47. ivolga-indi

    ivolga-indi

    Joined:
    May 18, 2017
    Posts:
    22
    Can I clarify?
    ProMaterialCombiner++ includes:
    - Batch mode: Combine several objects materials.
     
  48. jmunozar

    jmunozar

    Joined:
    Jun 23, 2008
    Posts:
    1,091
    Hello ivolga.

    The batcher basically means that you can set up a set of objects with multiple materials for combining and the tool will queue and process them.

    hope it made it more clear :)
     
  49. ivolga-indi

    ivolga-indi

    Joined:
    May 18, 2017
    Posts:
    22
    Yes. Thank you.
     
  50. zecbmno1

    zecbmno1

    Joined:
    Jan 3, 2016
    Posts:
    6
    Can I use it in Runtime?