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
3
Question by Pilot · Oct 22, 2011 at 02:40 PM · meshprefabdrawcalls

Reducing drawcalls - Many Prefabs vs Combined Mesh

I am in the process of creating an urban environment, and would like some advice as to how to manage the potentially large number of assets, in this case buildings. If one building model with one material/texture, is used as a "starting block" to create multiple streets (and eventually a city like environment) which of the following techniques is best for minimizing draw calls:

  1. One Building prefab duplicated many times, positioned side by side etc

OR

  1. One City prefab, with all of the buildings already combined into one mesh in a modelling package

I am unsure if Unity renders a prefab and all of its instances only once (which would make sense), or if it treats every instance as if it were a separate mesh/object. Another obvious factor to consider is clipping planes and culling layers. If one mesh is used for an entire environment, clipping planes will no longer be useful for culling certain parts of this environment based on distance. Therefore the entire environment would be continuously rendered no matter where in it the player would be, which seems quite a waste of resources.

There may be a better approach than the two I have listed above, so please if anyone has advice on a better technique than what I propose please let me know. Thank you.

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
9
Best Answer

Answer by Hamesh81 · Nov 15, 2011 at 02:22 PM

This is quite simple really hey. Firstly, 3 prefabs in a scene will still have the same triangle count as the original 3 meshes (ie, one 12 triangle cube instanced 3 times will be 36 triangles in your scene), but they will only need one draw call irrespective of how many of them are in the scene. If the meshes have a larger amount of triangles (can't remember the limit exactly, but it's quite low) though they won't get "batched", meaning that each instance will create an extra drawcall. What u need to consider is whether u want 2 (a) keep meshes combined as much as possible, or (b) have them broken down into prefabbed "building blocks" (as u put it).

With many prefabs u'll able 2 take advantage of culling to reduce draw calls; with combined meshes u may be able to reduce the draw calls even more but imo will lose some flexibility and the memory needed to load your massive model. For example, if u're entire city (or even large parts of it) is one mesh, if u need 2 change/re position just one building u won't able 2 do that directly in Unity, u'll have 2 go back 2 the source and let it re-import (which personally kinda annoys me).

It's up 2 u how you go about it!

Comment
Add comment · Show 2 · 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 Pilot · Nov 15, 2011 at 03:20 PM 0
Share

I'd actually completely forgotten about this question since nobody gave any comments or suggestions. But thank you for your response, it's answered all of my questions.

avatar image EnigmaFactory · Oct 10, 2012 at 02:07 AM 0
Share

This was very helpful! thanks Hamesh81! Voted up!

avatar image
3

Answer by demonpants · Mar 07, 2013 at 10:56 PM

My solution is to keep the objects separate in the level editor and the Unity scene, then when the level is loading up for the player combine all the meshes. It's fast enough that it doesn't increase load times too much, and in some levels I saw a 500% FPS increase with doing this. Best of both worlds.

For stuff that needs to be separate for animations or whatnot, I simply tag those objects and they don't get combined.

Comment
Add comment · Show 3 · 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 Moix · Aug 24, 2013 at 05:00 AM 0
Share

How do you combine the meshes?

avatar image Linus · Aug 24, 2013 at 05:10 AM 0
Share

Thats another question. Do a web search, if you cant find the solution. Post a question.

avatar image Shinugami · Mar 23, 2014 at 12:19 PM 0
Share

@$$anonymous$$oix https://docs.unity3d.com/Documentation/ScriptReference/$$anonymous$$esh.Combine$$anonymous$$eshes.html

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

9 People are following this question.

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

Related Questions

Prefab Materials and Meshes being deleted, How can I stop this 1 Answer

Dynamic batching not working? 0 Answers

Graphics.DrawMeshNow ( Does it work on OSX Capitan ) 0 Answers

duplicate a prefab then change the model? 1 Answer

I can modify the GameObject transform using the inspector, how can I modify the mesh as well? 0 Answers


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