Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Sondre-S · Jul 24, 2015 at 01:03 PM · optimizationcity

Huge city, how to split it up for best performance?

I'm building a huge city(about the size of most of manhattan), however there are only 65 townhouses, 53 skyscrapers, 27 industrial buildings and 17 unique "landmark" buildings. except the "landmarks", all the buildings are repeated over and over, but in a confusing pattern to make it harder to remember each building. The streets are pretty low poly too.

I'm have pro and I'm using occlusion culling.

how should I group the parts for best performance?

Edit: What I'm really asking for here is modelling help: how large should each group/part be and what should be grouped together. I'm still undecided whether to make each building as a separate mesh or make whole city blocks as one mesh:/

Here's an example: alt text

howtosplithugecity.png (373.7 kB)
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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Jordi-Bonastre · Jul 24, 2015 at 01:11 PM

Take a look to this part of the Manual. It could help you

http://docs.unity3d.com/Manual/OptimizingGraphicsPerformance.html

http://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html

Comment
Add comment · Show 6 · 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 Sondre-S · Jul 24, 2015 at 03:25 PM 0
Share

Thanks. Is it best to have each building as one object(with box collider) or entire blocks as one object?

avatar image Jordi-Bonastre · Jul 24, 2015 at 03:31 PM 2
Share

You should use the profiler to check the performance, but I think that it should be better entire blocks. If you prefer to assign a box/mesh collider to every building I think that a good idea would be enable/disable the box collider with a script similar to this pseudocode:

if(my distance to the camera > X) disable my collider else enable my collider

avatar image Sondre-S · Jul 24, 2015 at 03:53 PM 0
Share

thats a good idea for sure, I'm gonna try that. I but even if I have one collider for each block, should each house be an individual object or should the entire block be one mesh?

avatar image Jordi-Bonastre · Jul 24, 2015 at 03:57 PM 2
Share

You could have a root node for the mesh and multiple childs for the colliders. I send you attached a screenshot.

alt text

alt text

screen-shot-2015-07-24-at-165616.png (73.9 kB)
screen-shot-2015-07-24-at-165606.png (83.3 kB)
avatar image Torigas · Jul 24, 2015 at 04:08 PM 0
Share

I would actually argue against using whole blocks.

Just use the couple models you have and make sure all instances of that mesh are referencing the same mesh in the project window.

That way there should not be a need to load many different models onto the graphics card - ins$$anonymous$$d just all your variations. Then the GPU should be able to use references and avoid hogging too many resources.

Then again, CryEngine works like this, not sure about Unity in this case.

Show more comments
avatar image
0

Answer by reddead12 · Jul 24, 2015 at 07:49 PM

you can dowload a Combined mesh script asset from the asset store, Personally my favorite cause it automaticly makes it a shared material though its costs money: https://www.assetstore.unity3d.com/en/#!/content/8748

you can also try to make your own combine mesh and material script

Or you can use the default methods to optimize performance, Some Usefull Links: http://gamedev.stackexchange.com/questions/64492/how-to-opitimize-shadows-in-unity-3d OR http://answers.unity3d.com/questions/482381/what-are-causes-of-overhead-in-profiler.html OR http://answers.unity3d.com/questions/37293/general-ways-to-optimize-frame-rate.html

Comment
Add comment · Show 1 · 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 Sondre-S · Jul 24, 2015 at 10:13 PM 0
Share

Thank, many helpful links there, basically what I'm asking for is modelling guidelines. I need to know how to split up and/or group the model to make it run efficiently.

Edit: Occlusion culling+the setup with entire city blocks + a UnityCar gives me 4440 drawcalls and a s$$anonymous$$dy 89-90 fps.and thats without disabling colliders. However that is with all render textures disabld. I'm hoping diabling colliders will boost fps further so I can run real time reflections without too much lag:)

avatar image
0

Answer by Wolfdog · Jul 25, 2015 at 12:07 PM

A few tips:

Use textures to "fake" detail. From the images you provided, it's clear that you're going to paint in the windows and stuff. Instead of having a texture for a wall, and another texture for a window which is going to be painted over the wall, have 1 texture for the wall with the windows already on.

All vertices will count. Even cutting down on a few vertices on each model will improve performance dramatically. Also, keep it as low poly as possible (eg. avoid round edges).

Also, when it comes to colliders, I'm against the use of mesh colliders (unless they're convex). use box colliders for the general outline of the building and then smaller box colliders for the most important details.

I hope that what I said makes sense.

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 Sondre-S · Jul 25, 2015 at 12:34 PM 0
Share

No, no, no, you misunderstood, those buildings are already done and fully textured. I just turned them off for the screenshots ;) I also limited the texture size for all the textures in the import settings to 512 which I think improved the fps a little aswell.

When it comes to colliders, for this test I did'nt use box colliders (altough I prefer using them)I made an object containting separate simple,4-faced meshes/boxes(no top or bottom) representing each entire city block and not each building. And checked "generate colliders" in the import settings, giving each of those "city block objects" a mesh collider and of course no mesh renderers. I would guess those mesh colliders, as they only have a few polys each, are pretty much the same processing cost as box colliders? anyways thanks for your tips:)

Btw: When I disable colliders depending on the player position, should I do it in Update or Late Update?

alt text

screenshot-29.png (164.1 kB)
avatar image Wolfdog · Jul 25, 2015 at 02:02 PM 1
Share

oh, sorry about that.

I believe that disabling the colliders will use more CPU power than simply leaving them on.

Do not do it every frame.

If I had to do what you're trying to do, I would have a timer which checks and disables colliders every 5 seconds or so.

avatar image Sondre-S · Jul 25, 2015 at 03:25 PM 0
Share

Oh, thanks, well in that case I guess I'll leave them on, but if I choose to do it, should I do it in Update or Late Update?

avatar image Wolfdog · Jul 25, 2015 at 07:03 PM 0
Share

It doesn't really matter, because it happens every frame anyway. I personally would do it is Late Update, because it isn't too important to the gameplay. That's just my preference though.

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

22 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to not allow unity optimise my code? 1 Answer

A question of optimization: use a script with variables or use the object name? 1 Answer

Shaders - changing the vertex color via script 1 Answer

How to increase fps in my game? 2 Answers

Optimisation: fewer draw calls or smaller draws? 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