• 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
2
Question by GamezAtWork · Nov 04, 2010 at 05:27 PM · lagtrees

Forest of Trees?

Well... The thing is that my game requires a forest, of sorts, which means loads of trees...

However, the problem is that the Unity3D trees appear to lag when we use them en masse, and it also lags even with our own trees.

So the question is, does anyone know how to make a convincing forest of trees? Either that, or is having alot of trees supposed to lag badly? Because perhaps the problem isn't the trees, but my code...

Thanks!

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
3

Answer by DocSWAB · Nov 04, 2010 at 10:58 PM

Using terrain trees gets you so much more than any other method that it's worth it to figure out how to optimize them.

  1. Billboard distance rarely needs to be more than 50-75 m away, even at very high quality settings.

  2. Fade distance of 10 m or so will help with the snapping.

  3. Depending on how close the trees are together and how dense they are, something like 30-50 mesh trees max is plenty.

  4. Make sure most of your tree models are well under 2,000 polys. 1,000 - 1500 is adequate with clever panels for transparent groups of leaves and branches as textures on planes, of course depending on their shape.

  5. Remember that shadows on anything cost a lot, so don't judge overall performance with realtime shadows on.

Billboarded and lightmapped terrain trees can look great and have relatively low draw calls and high frame rates.

Also, you can't lightmap the AO tree shaders if they are placed as standalones, or with the combine children script. So you lose lightmapping if you go that route (3.0)

Edit about lightmapping hand-placed trees: You can set a hand-placed AO tree to static and lightmap it in order to get its shadows on the ground. But the model itself won't be lightmapped, and will always use real-time lighting.

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
1

Answer by Adam Rademacher · Nov 04, 2010 at 05:55 PM

Reducing the sliders on the terrain generally helps reduce the taxation of drawing so many trees. You'll sometimes run into 'snapping' from trees that are coming into billboard distance though, which is unfortunate. I've seen some people have success with low-poly tree meshes added to the game then combined with the mesh combine utility. If you do this, avoid having too many mesh-colliders as your performance will then be caused by physics (making prefabs of the trees with a capsule collider is usually sufficient).

Run the profiler and get some data on whether it's the graphics (draw calls) of so many trees or the physics of the tree colliders that is your biggest bottleneck (or possibly both), then take steps to reduce the draw as you would any other mesh or collider.

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 MountDoomTeam · Feb 14, 2013 at 10:16 AM

I don't know if unity has implemented this, but the game shouldn't be instantiating trees, it should be making 20 groups of say 100 trees at start-up, and when they need to be in view, move them from somewhere in outer space onto the scene and recalculate all their positions in one loop, that way the trees are all in memory they just have to be repositioned and adjusted to the terrain contour. and trees in a group that shouldn't be visible just stay a couple of miles under the group, at the same time as its calculating the contour.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

MACOS Unity Editor uses over 90% CPU and is Laggy 0 Answers

Lag with trees that use colliders? 0 Answers

Unity lags with high Tree count 1 Answer

Reducing Lag due to Large Particle Systems and Trees 1 Answer

How to make lag free terrains 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