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
0
Question by Mahamed9628 · Jun 06, 2012 at 09:28 PM · optimizationlow fpsvegetation

optimizing huge amount of objects

Hey, I'm still here, that's my question: why FPS falls down to 2, if I have about 3000 game objects? They are far away from a camera, they are culled (per-layer) and invisible, so it's just 50-60 draw calls. They are trees and various vegetation, but I don't want to make an one mesh from them: every of them will have some script and animation. But now they don't have anything except meshes and materials (same for all), they're culled, and it's only 2 fps. What should I do to optimize this? Note: without joining to one mesh!

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 rutter · Jun 06, 2012 at 09:30 PM

every of them will have some script and animation

If you have several thousand objects, but are pretty sure that rendering isn't your bottleneck, then it's most likely the scripts or other components attached to those objects.

If you have Unity Pro, the profiler is invaluable in diagnosing this sort of problem. If not, you can try removing components one-by-one to see if any of them are a performance hotspot.

Comment
Add comment · Show 7 · 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 Mahamed9628 · Jun 07, 2012 at 07:25 AM 0
Share

As I said, there are only rendering components on objects now. They have meshRenderer and $$anonymous$$eshFilter components. There is no to remove, I bet.

avatar image Mahamed9628 · Jun 07, 2012 at 07:41 AM 0
Share

I can't get this, how do people optimize big forests, where every tree is individual object? On my spheric planet I've got even less trees, than you can find in Arma2, for example, or Warcraft3. What's the secret of making arrays of trees?

avatar image rutter · Jun 07, 2012 at 07:42 AM 0
Share

Ah, I missed that. Sorry.

Advice still more or less holds true, I think. Even if you're down to just two or three components per object, it will still help to identify which one(s) are causing the problem.

$$anonymous$$ost obvious problem is if all of those components are trying to render at the same time. Sounds like you're pretty sure that's not the case, so the next thing I'd look for is CPU load. Even efficient components can take up quite a bit of computer time if you're running several thousand of them at once.

Even if you don't have Unity's profiler, you may be able to find CPU/GPU/RA$$anonymous$$ metrics for your machine while the program is running. Could be useful to see which are getting maxed out.

avatar image Mahamed9628 · Jun 07, 2012 at 07:48 AM 0
Share

I can just deactivate all of them. If I do this, FPS gets up to 40. But it's still not what I want: if there is no vegetation (if I remove them), fps is about 110-130. Why do even inactive objects take so much from machine..

avatar image Mahamed9628 · Jun 07, 2012 at 07:56 AM 0
Share

$$anonymous$$eshRenderer causes all this fps breaking. But I can't remove it, trees just will not be rendered. What then? Has anyone on this Earth made a forest in own game?..

Show more comments
avatar image
0

Answer by Mahamed9628 · Jun 07, 2012 at 10:48 AM

My experiments go well. For each tree I added script, which check distance between tree and camera every 2 seconds, and if distance is less than 100, it starts drawing cycle. Drawing cycle - function, which in cycle FOR calls method Graphics.DrawMesh, and then waits (yield WaitForSeconds(0.01). There is no update func. Drawing cycle goes on only if distance is less than 100. But here is some bug: with 0.01 trees flick. I'll try 0.001 or any other value. FPS is about 90-100. Good result.

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 Mahamed9628 · Jun 07, 2012 at 10:57 AM 0
Share

So, my note: if number of game objects equals thousands (4000,5000) even empty objects will break fps down. I tried to put a lot of non-grouped (not joined to one mesh) grass, which has no components except transform, and FPS got to 1. I don't know, how people make so dense grass in so dense forests. Joining to one mesh also limited: Combine$$anonymous$$eshes function will return error if I try to join 5000-6000 meshes... If you've ever made dense forest, help me please with this.

avatar image Mahamed9628 · Jun 07, 2012 at 03:25 PM 0
Share

Does anyone know how grass and trees get optimized in the Terrain class?

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity profiler Gfx.WaitForPresentOnGfxThread 2 Answers

Low FPS when launching the built apk first time 0 Answers

How to optimize custom grass? 1 Answer

Is UI ruining my fps on some of android devices? 2 Answers

Great FPS Dilemma Even With Low Tris & Low Batches 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