• 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 Greenie · Apr 01, 2015 at 10:46 PM · terrainproceduralgenerationperlin noise

3d Perlin Noise?

Hey everyone,

Been looking into procedural terrain generation for quite some time. Just looking at perlin noise now. However I want my terrain to have overhangs and caves etc (i'm going to create my own meshes instead of using unity's terrain). In researching this I've found I should use 3D Perlin noise, and use the noise value as density (= 0 = ground). Just wondering how in unity I can make 3D perlin noise? Should I still use mathf.perlinnoise in some way? Also how can I make the terrain more believable instead of just a block of holes and rocks?

Thanks in advance! Chris

Comment
Add comment · Show 3
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 AlucardJay · Apr 01, 2015 at 10:48 PM 0
Share

Search Simplex Noise, and Perlin Worms.

avatar image Greenie · Apr 02, 2015 at 09:48 PM 0
Share

Looked up perlin worms, cant find very much about how to use it?

avatar image AlucardJay · Apr 03, 2015 at 08:10 AM 0
Share

bigmisterb has written a good description here : http://forum.unity3d.com/threads/adding-detail-to-procedurally-generated-terrain.240756/#post-1603421

edit : and similar : http://www.roguebasin.com/index.php?title=Basic_directional_dungeon_generation

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by maccabbe · Apr 01, 2015 at 11:22 PM

http://answers.unity3d.com/questions/357710/c-implementing-3dperlinsimplex-noise.html http://answers.unity3d.com/questions/646054/perlin-noise-for-3d-voxel-terrain.html

http://forum.unity3d.com/threads/coherentnoise-procedural-generation-library-released.91784/

http://webstaff.itn.liu.se/~stegu/TNM022-2005/perlinnoiselinks/perlin-noise-math-faq.html

Comment
Add comment · Show 1 · 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 Cherno · Apr 01, 2015 at 11:39 PM 0
Share

Also:

After playing $$anonymous$$ecraft...

avatar image
0

Answer by FM-Productions · May 27, 2017 at 03:37 PM

Hi,

the Youtube channel Brackeys just released a video about this topic 2 days ago. Maybe you want to check it out:

https://www.youtube.com/watch?v=vFvwyu_ZKfU

Things like caves are not explained in the video, but maybe it will help.

Comment
Add comment · Show 1 · 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 danrayson · Sep 27, 2019 at 08:41 PM 1
Share

Yeah that's not 3D mate. It's 2D noise used as a heightmap.

avatar image
0

Answer by danrayson · Sep 27, 2019 at 09:12 PM

I was banging my head trying to get rid of the artefacts I kept seeing in the naive approach, which was found here https://www.youtube.com/watch?v=Aga0TBJkchM:

 public static float PerlinNoise3D(float x, float y, float z)
 {
     float xy = Mathf.PerlinNoise(x, y);
     float xz = Mathf.PerlinNoise(x, z);
     float yz = Mathf.PerlinNoise(y, z);
     float yx = Mathf.PerlinNoise(y, x);
     float zx = Mathf.PerlinNoise(z, x);
     float zy = Mathf.PerlinNoise(z, y);
 
     return (xy + xz + yz + yx + zx + zy) / 6;
 }

That approach may work in some cases, but for my work I kept seeing symmetrical lines throughout the data. It turns out that it was mirroring along all three axis! Terrible for a noise function to give you symmetry :)

Eventually I worked this out:

 public static float PerlinNoise3D(float x, float y, float z)
 {
     y += 1;
     z += 2;
     float xy = _perlin3DFixed(x, y);
     float xz = _perlin3DFixed(x, z);
     float yz = _perlin3DFixed(y, z);
     float yx = _perlin3DFixed(y, x);
     float zx = _perlin3DFixed(z, x);
     float zy = _perlin3DFixed(z, y);

     return xy * xz * yz * yx * zx * zy;
 }

 static float _perlin3DFixed(float a, float b)
 {
     return Mathf.Sin(Mathf.PI * Mathf.PerlinNoise(a, b));
 }

I haven't seen any artefacts in it yet.

Hope that helps you out!

EDIT: I've seen some case where there are lines again, but I'm sure someone cleverer than me an iron them out.

Comment
Add comment · Show 1 · 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 unity_vG3iPabUpDx7dg · Mar 05, 2020 at 02:02 AM 2
Share

Perlin noise is mirrored around zero. You have to offset the xyz input. This can be done by finding the greatest negative x, y and z values and adding them as absolute values to each xyz input.

Your temporary fix was done by adding a constant offset. This is also a valid solution if your offset is high enough to map all x, y and z values positive or negative.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

24 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

Related Questions

How can I get a Low Poly terrain to work in Unity? 2 Answers

How would I procedarally generate a terrain? 2 Answers

Procedural terrain generation ? 0 Answers

2D Procedural Terrain Generation + Pooling 2 Answers

Procedural terrain- of the 2D circular variety. 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