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 Breaking_Reality · Apr 19, 2019 at 11:30 PM · terrainmeshperformanceperlin noise

Creating a height value based on noise optimized

Hello! Im trying to create a procedural terrain with noise. I'm still not completely sure how 'infinite' terrain is done though. What I did was create a method that I could pass in the x and y cord of the vertice and the chunk position for the offset. This method returns a height value based on those values with perlin noise. This isn't simple perlin noise though. I have set it up with octaves, frequency, and amplitudes as well as scale and other values to make this terrain look amazing. But when the player moves (the chunks update around the player which means calculating a height value for each vertice again) it kills the fps. I have it set up to only update vertices when the player moves a chunk in a direction. This does work but not very well so I need help figuring out how to make this optimized. This is the third time re writing this code. The first time was just simple perlin noise which was not detailed enough. The second time I created a whole float[,] with the more complex perlin noise and it worked but I had trouble getting it to be infinite because I created the size of the map based on render distance so every time the player moved I had the same issue but worse. I tried making a bigger map so it wouldnt need to calculate it over and over and it worked but it wasnt letting me create a map big enough for the infinite illusion because of ran out of memory errors. And then now im here getting ONE noise value per vertex when the player moves and I guess now that I look at it we are still calculating the whole chunk. I'm stuck and I'm not sure what to do. Any help is appreciated 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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by KoenigX3 · Apr 20, 2019 at 09:18 AM

Runtime noise generations always need performance, but there are some things you can try. As you have mentioned, you have already tried reducing the update frequency by calculating only after the player has moved into another chunk. There are a number of things to get through:

  • Try another (less performance dependent) noise library

  • Minimize the octaves (with this option you are sacrificing the detail)

  • Use a coroutine for calculating, that way you can slow down the calculations but keep some framerate

  • If you are creating the chunks based on a render distance variable, do not move and recalculate every chunk when the player gets to a new chunk. Only move the chunks that are left behind, and recalculate their height. For example: if the player moves one chunk to the right, move a column of chunks from the left side to the right, and recalculate them.

  • You could use multiple threads but it's more error-prone.

That's all i can come up with. Hope it helps.

alt text


chunk.png (18.0 kB)
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 Breaking_Reality · Apr 20, 2019 at 10:52 PM 0
Share

I'll give this best answer because though I haven't tried anything you've suggested yet, I can see how there isn't much I could do other then these few things which should help with performance to at least be not as noticeable as it is right now. Thanks and I'll keep you updated!

avatar image Breaking_Reality · Apr 20, 2019 at 10:54 PM 0
Share

As for threading I think it's a great idea but I have no experience with threading. The last time I did threading it made cpu go up to 100% usage. Any good sources to learn how to properly thread safely? I mostly have trouble communicating with the thread to do something when the thread has finished its tasks.

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

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

Related Questions

Too many colliders? 0 Answers

To what extent can the tree system be used instead of the details system 0 Answers

Combining Objects for Performance 0 Answers

Creating a mesh over a terrain 0 Answers

Lighting Banding Artifact 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