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
1
Question by Screenhog · Nov 29, 2012 at 12:24 AM · optimizationdraw callssubmesh

Submeshes increase draw calls... any way around this?

I'm doing a test, learning about how batching works. I have a simple script where, every time I press Space Bar, a cube is created. The cube is assigned a random material from a group of 5. Due to dynamic batching, even if I have 100 cubes on screen, my total draw calls never goes above 5. So far, so good!

However, if I break the cube into 6 submeshes (one for each face), assign each face with a random material of the 5, and start spawning cubes, I hit a maximum of 30 draw calls. If the cube is only divided into 2 submeshes, my maximum number of draw calls will be 10. The equation is pretty obvious:

 (# of draw calls) = (# of total materials showing) * (# of submeshes on each cube)

So, is it possible for the number of draw calls to get back down to 5, even with the cubes divided into submeshes? There's still only 5 materials showing on screen, and its obvious that some kind of batching is happening.

UPDATE: After more research, I've gotten no closer to solving this, so I'm just assuming that it's a limitation I have to work with. It's not a huge deal for me, but I'm leaving the question unanswered for now in case someone happens upon this in the future and can shed light on it.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by lil_billy · Dec 09, 2012 at 04:09 PM

sub meshes are different than actual meshes

batching works on the mesh level so if you have submeshes the object is treated as a completely different entity when rendering.

hmmm i should explain that differently

when it goes to render an object it looks at the material assigned to it, objects with the same material get batched. But its not objects in the sense of a GO its the mesh object that it is looking at so if you have sub meshes with different materials then the mesh itself is a different 'object' in the renderer. so having submeshes with different materials is not good for batching.

now what im curious about is there are two objects with the same difuse material but one has a normal. will they get batched and the normal map gets rendered later or does the object become unique.

unrelated (this is more rumor) but triangle count might affect batching as well i believe 300 triangles is the rough limit for an object to batch

Comment
Add comment · 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
0

Answer by chaifix · Apr 01, 2021 at 09:45 AM

Submeshes in the same mesh share one VBO and one IBO, but still invoke drawcall indivitually. The reason submeshes are better than separate gameobjects is that they counld be batched if sharing same material. It do call multiple drawcalls (glDrawElements in GL) compare to single big mesh. But the cost of a drawcall is kind small, we could ignore it. "Batching" reduces vertex data binding and model matrix uploading at CPU side, but not reduce number of drawcall( except dynamic batching).

Comment
Add comment · 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

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

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Does the draw call batching can be considered as rendering optimization technique in Unity3D? 0 Answers

Draw calls on PC and Console? 0 Answers

Is there a performance benefit to using Sorting Layers for 2D objects versus Z-axis positioning? 1 Answer

Optimizing large numbers of trail renderers 0 Answers

[Unity iOS] What's causing my draw call count to rise sharply? 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