Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 mouseman919 · Aug 22, 2011 at 10:21 AM · terrainfpslagsetheights

Big FPS drop when using SetHeights on terrain

I'm using GetHeights and SetHeights to alter the terrain at run time. I only change 1 height at once, but i'm still getting a massive stutter when I use SetHeights.

I don't have any trees or grass on the terrain, it's purely terrain at this point.

My terrain is fairly large, so I assume it's because it's recalculating the collision mesh?

Is there any way of reducing the stutter or is this simply something I have to live with?

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 DGArtistsInc · Aug 23, 2011 at 01:36 AM

Go into Set Resolution which is under terrain and lower the the terrain width and length. This will cause the terrain to be smaller. This should help this problem. Or you could just make the graphic quality less so it will run faster.

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 mouseman919 · Sep 19, 2011 at 11:55 AM 0
Share

This does help some, although it's difficult to know how small to make the terrain to compensate for weaker computers, and if it gets too small then the world is too small.

If I had multiple small terrains somehow stitched together, would this be faster? I assume it doesn't recalculate all terrain collisions if you have multiple terrains and you only change the heights of one?

avatar image syclamoth · Sep 19, 2011 at 11:59 AM 0
Share

If you had multiple smaller terrains, you'd have a hard time making sure the edges stayed aligned. As far as I can tell, SetHeights is recalculating the entire terrain mesh- so no, there isn't really a way to speed it up, unfortunately. Could you do some crazy LOD thing where the terrain gets more detailed if your computers are faster, or am I talking out of my bum about things I don't really understand?

avatar image mouseman919 · Sep 19, 2011 at 01:43 PM 0
Share

Well, I'm only changing the height of 1 point per click, so I'd only need to alter more than 1 terrain if the player is editing a point along the very edge of a terrain, which is easy enough to detect.

Assu$$anonymous$$g all terrains are equal in size then I can simply tile them in a grid and basically make all ajoining edges share the same heights.

I could use a higher resolution for the terrain depending on the computer power but that would make balancing really hard. It would also mean I couldnt make it multiplayer (which I'm hoping to do).

avatar image syclamoth · Sep 19, 2011 at 02:58 PM 0
Share

Well from the looks of it, having multiple smaller terrains is the only practical solution here.

avatar image
0

Answer by Ponasity · Mar 28, 2017 at 04:44 PM

The Unity docs say "The area affected is defined by the array dimensions and starts at xBase and yBase. The heights array is indexed as [y,x]." This means you can directly address the nodes you are altering without accessing any others. Simply use the first 2 values in the setHeights function as the starting point for the area you want to alter, and then the size of the array defines the ending point. I saved 40 FPS when I changed my code to this.

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

6 People are following this question.

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

Related Questions

How to make lag free terrains 1 Answer

Large Colliders Hitting Terrain 0 Answers

3d model with lower poly count than another model causing tons of lag 0 Answers

Why _terrainData.SetHeights() resizes the terrain? 0 Answers

Low FPS any ideas ? 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