Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by brad_ict · Jan 29, 2011 at 01:25 AM · meshoptimizationmaterials

Why combine meshes that share the same material?

The documentation indicates that combining meshes provides performance benefits. However, after doing some tests, it seems like meshes with the same material are auto-batched and result in 1 draw call.

Questions:

  1. So why combine meshes that share a single material?

  2. Is there a frame rate performance benefit to combining the meshes even though it's the same number of draw calls for combined or uncombined meshes with the same material? (is that what this post is essentially indicating?)

  3. Are any of my conclusions incorrect?

Test Results:

  1. 1 Mesh with 1 Material = 1 Draw Call, Batched 1

  2. 2 Meshes, Uncombined, with the same material = 1 Draw Call, Batched 2

  3. 2 Meshes, Combined, with the same material = 1 Draw Call, Batched 0

  4. 2 Meshes, Uncombined, with separate materials each = 2 Draw Calls, Batched 0

  5. 2 Meshes, Combined, with separate materials for each mesh = 2 Draw Calls, Batched 0

Conclusions:

  1. Mesh draw calls are directly related to the number of materials applied to the meshes being drawn.

  2. If two meshes share the same material, whether they are combined or are separate, will be batched and result in a single draw call.

  3. Combining two objects with separate materials doesnt give you any performance benefit, so dont do it because you can then apply the two materials inside Unity to either mesh instead of having to apply the materials in Maya, combining and then exporting (i.e. you can't separate a mesh in Unity to apply materials to each mesh and then combine the mesh again).

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lakehaze · Jun 30, 2011 at 10:52 AM 0
Share

I think your conclusions are premature; I'd recommend a wider sample of meshes. You're meshes seem to be very batch friendly, but not all meshes are so. We certainly have meshes sharing the same material that do not draw-call-batch until after they are combined.

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by Jessy · Jan 29, 2011 at 04:22 AM

Conclusions 1 and 3 are good. A material equates to at least one draw call. (Shader passes and pixel lights in forward rendering result in a draw call each.)

Conclusion 2 is a bit incomplete. Meshes may be batched dynamically in non-Pro Unity, if they have fewer than 300 vertices and share the same material (I say may be because the actual requirements for batching have never been disclosed, and those guidelines alone do not always result in a dynamic batch). Dynamic batching is inferior to static batching, and static batching is superior to combining meshes. However, static batching requires a Unity Pro license.

When you have a choice between dynamic batching and combining meshes, that's a pickle, and I suggest you don't combine meshes, and instead, suffer a performance cost until you can afford Unity Pro. Seriously. Combining meshes is a boring and tedious operation best left to Unity, who does not experience ennui.

This video offers relevant details.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image brad_ict · Jan 31, 2011 at 12:39 AM 0
Share

I'm targeting PC Standalone. Does that change any of your advice, Jessy? Your advice to not combine meshes is in stark contrast to the Unity docs, but maybe the docs are poorly worded?: "If you care about performance, combine meshes." (http://unity3d.com/support/documentation/$$anonymous$$anual/Optimizing%20Graphics%20Performance.html)

Thanks, Brad

avatar image brad_ict · Jan 31, 2011 at 01:37 AM 0
Share

Does the Auto-Batching in Unity 3 (was previously only on iPhone) basically mean you don't need to combine meshes manually and the docs just haven't been updated?

avatar image Jessy · Jan 31, 2011 at 03:13 AM 0
Share

That documentation is several years old, and batching only became available on the desktop in 3.0. I think an update is in order. Combining static meshes might make sense, but not for a Pro user.

avatar image brad_ict · Jan 31, 2011 at 06:48 PM 0
Share

Sorry, I think I get it now. Seems dynamic geometry batching was a feature rolled from iOS into all platforms but never documented for other platforms. $$anonymous$$y tests on PC show the max number of verts for auto-batching two or more meshes to be around 225 verts, even lower than iOS!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

The best way to have multiple models with only one material 2 Answers

Mobile Material Optimization 0 Answers

Multiple materials on one mesh 1 Answer

Sharing vertex buffer between mesh objects 1 Answer

How To Create and Set Mesh Dynamically Using Script (C# or Javascript) On Sphere 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges