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 Sir-Spunky · Dec 10, 2014 at 02:22 AM · terrainperformanceprocedural-terrain

Why are multiple terrains slower?

In my attempt at procedural terrain generation, I'm forced to divide my world into many small terrains with 129x129 heightmap resolution each, because spawning larger terrains at runtime causes a noticable lag.

However, for some reason, having multiple small terrains seems to be a big hit on performance. In the example pictures below I compare a scene of 6x6 terrains with a scene of 12x12. Although the second gives only a slight increase in polygon count and draw calls, the fps is more than halved. Unless it's related to some kind of camera culling or similar, the reason must be that having multiple terrains causes an overhead by itself.

What's the reason for this overhead? Any ideas how I can improve the performance?

6x6 terrains: http://i.imgur.com/eKDMNv7.jpg

12x12 terrains: http://i.imgur.com/jan0JYn.jpg

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
1

Answer by BMayne · Dec 10, 2014 at 02:38 AM

Hey there,

(This might not be the prefect answer but it gives you a direction to look at)

It's not the amount of polygons that causes big performance issues it's the texture looks ups.

If your not fermiler with shaders a texture lookup is what it sounds like. Every time the shader has to look at a texture and read a pixel that has an over head (it has to do this for every pixel on screen).

Saying this I have a question. How many textures are you feeding your shader?

Regards,

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 Sir-Spunky · Dec 10, 2014 at 08:46 AM 0
Share

Hi! Ahh, I didn't think about that! Thanks! I'm currently only using one and the same texture for all terrains, no normal maps or anything. I kind of assumed that the texture was re-used, but because there's no "material" used, I guess it isn't.

I'm currently setting the texture by this code:

 SplatPrototype[] terrainSplats = new SplatPrototype[1];
 terrainSplats[0] = new SplatPrototype();
 terrainSplats[0].texture = terrainTexture;
 terrainSplats[0].tileSize = new Vector2(3, 3);
 terrainData.splatPrototypes = terrainSplats;

I'll look into improving this. $$anonymous$$aybe I can work with the "$$anonymous$$aterial" slot that's found in the terrain settings directly ins$$anonymous$$d, so that I can use the same $$anonymous$$aterial for all terrains and apply textures to the material ins$$anonymous$$d of the terrain.

But if I need more detailed texturing through splatmaps I guess there's no other way than to have unique textures for each terrain. I'm also planning to combine it with RTP terrain shaders from the Asset Store later, which will multiply the texture count by a lot.

Another solution would be to use fewer but bigger terrains, but then the main problem is that terrain.setHeights causes a lag and there's no way around that from what I've heard. Really hope Unity improves on that part.

avatar image Sir-Spunky · Jan 19, 2015 at 11:03 PM 0
Share

After experimenting some more, I'm afraid this might not be related to texture lookups either. Even after I disable the above texturing code, which makes the terrains completely white without any texturing, I get the same frame rate. Reducing poly count does nothing for the frame rate either.

There just seems to be some strange performance overhead on using multiple built-in terrains that I can't get rid of. This is very unfortunate as it means I'll either have to sacrifice a lot of viewing distance or suffer from lag when generating larger terrain chunks procedurally.

avatar image
0

Answer by CJGames · Dec 10, 2014 at 02:58 AM

Well, every type of generation is performed by your computer processor, if you generate 12x12 terrains, you'll have bigger terrains (but less), and if you generate 6x6 terrains, you'll have smaller terrains (and more). Maybe (for some reason) a single 12x12 terrain costs less memory than 2 6x6 terrains, so generating 12x12 terrains will make the game run "faster". However this depends on the USER processor, so if the player's processor is more powerfull than your's, the game will not lag (or will have less lag). I think there are some changes you can do to improve the performance, such as ajusting the shader and all shadows options (cuz they cause big performance impact) and making each terrain as big as possible.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Bizarre Terrain-Drawcalls inconsistency? 0 Answers

Terrain setdetaillayer performance 1 Answer

Overdraw problem, how to fix it? (Android) 0 Answers

Scripts on Terrain Trees 2 Answers

Performance - is raycasting for ground on Update() optimal? 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