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
-1
Question by LucasMars · Jan 25, 2015 at 03:47 PM · perlin noisemap-generationimplementationperlinperlinnoise

Perlin Noise Implementation

This may sound like a noob question, but I have been looking for a solution for a few days now. I have written a randomized map generator (it generates a map in real time). I need to be able to give each point a y value (otherwise it is flat). So, here is my question; how do I generate a perlin noise heightmap, and get the height of one pixel at a time?

 var SomeSortOfPerlinNoise = Perlin noise (x_var in for loop, y_var in for loop);
 
 vertices[value_on] = Vector3(x_var, SomeSortOfPerlinNoise, 0.0f),y_var);

I just need set the value of SomeSortOfPerlinNoise, and my map generator will work. Any suggestions?

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 Cherno · Jan 25, 2015 at 05:49 PM

Unity has built-in Perlin Noise support: Mathf.PerlinNoise.

 for(x = 0; x <worldSizeX; x++) {
             for(z = 0; z < worldSizeZ; z++) {
                 float height;
                 
                     height = Mathf.PerlinNoise(x, z) * 10f;
      }
 }


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 LucasMars · Jan 25, 2015 at 05:51 PM 0
Share

It's still not working. It is still generating a flat terrain. (Just to clarify, I've got something working, so I know it's not the generator. I just want to use perlin noise, as it is what I want the map to look like).

avatar image Cherno · Jan 26, 2015 at 08:05 AM 0
Share

$$anonymous$$aybe the scale is too big? Try to follow the documentation, it includes a scale multiplier.

avatar image LucasMars · Jan 26, 2015 at 08:09 AM 0
Share

It's not the scale, as when I *100, it still is the same, but higher up.

I tried Random.Range(1,3) just to make sure the generator works (not the effect I'm looking for, but helpful for debugging), and it generated at different heights. So it's something to do with Perlin Noise, and not the scale, ect.

avatar image Cherno · Jan 26, 2015 at 08:16 AM 0
Share

$$anonymous$$aybe you could post your code again which implements the Perlin Noise, and we can see what needs to be changed.

avatar image Cherno · Jan 26, 2015 at 10:01 AM 1
Share

Have you tried inserting a Debug.Log line to check the values generated by the Perlin.Noise function?

Show more comments
avatar image
0

Answer by malkere · Feb 02, 2015 at 09:17 AM

Your scale is not too low it's too high. PerlinNoise doesn't use big numbers it works in low numbers... from what I can tell.

I had the same problem today and diving by 10 made it extra jagged. dividing by 1000 made it a big slow wave. Still not what I'm looking for, but the answer is PerlinNoise, you and I just don't fully understand it ;p

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 Chris333 · Feb 02, 2015 at 11:28 AM 0
Share

That helped me a lot with making a 2D top-down level with random spots of caves, gold and $$anonymous$$erals.

http://studentgamedev.blogspot.no/2013/09/unity-voxel-tutorial-part-3-perlin.html

avatar image malkere · Feb 02, 2015 at 01:16 PM 1
Share

ya that's a great tutorial for voxels. I used his method in my $$anonymous$$ing too.

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

22 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

Related Questions

improve generate tilemap with perlin noise 1 Answer

Adding rivers to procedural generated 2D map 1 Answer

Always same result from Mathf.PerlinNoise() 2 Answers

Perlin noise problem 0 Answers

2d Top-Down Perlin noise map using Mathf.PerlinNoise 3 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