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 Aldon0 · Nov 16, 2017 at 08:11 PM · terrainterrain generationterrain-editorterrain gen

Something wrong with how i handle terrain generation

I'm working on a procedural terrain generator. At it's core, my script goes through each point in the height map and assigns it a 1 or a 0 (50/50 chance) I then use this noise to generate an organic looking map, which based on the height, either does or doesn't peek over a "water" plane.

my problem is this: depending on the general direction the "coasts" are running, the height either appears as "smooth" (using 45 degree angles) or "stepped" (only traveling at a series of 90 degree angles.)

The image I provide is after a few iterations of my function that makes it look more organic. this issue shows up entirely at the random noise part, so i'm just providing this image to make the problem more clear.

alt text

"coasts" with a positive slope act like 2

"coasts" with a negative slope behave like 1.

I want the "coasts" to behave like example 2.

Anyone have any idea why the terrain is behaving like this?

The following code is how i generate my noise.

     void GenerateNoise()
     {
         for (int x = 1; x < Dx - 1; x++) {
             for (int y = 1; y < Dy - 1; y++)
             {
                 //give each point a 0 or 1
                 map1[x, y] = Random.Range(0, 2);
             }
         }
     }

     void ConvertMap(){
         //convert the int map in to a float map for heights
         for (int x = 0; x < Dx; x++)
         {
             for (int y = 0; y < Dy; y++)
             {
                 map3[x, y] = (float)map1[x, y] / 30.0f;
             }
         }
     }
 
     void PrintMap()
     {
         ConvertMap(); 
         ground.terrainData.SetHeights(0, 0, map3);
     }

sorry If this is confusing, trying to explain it as clearly as I can. Please let me know how I can clarify. THANKS!

terrainissue.jpg (162.9 kB)
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
1

Answer by Bunny83 · Nov 17, 2017 at 04:19 AM

Well you do "hard edges" in your terrain so you actually see the individual "Quads". Have a look at this figure:

 P0 ----- P1
  |      / |
  |    /   |
  |  /     |
  |/       |
 P2 ----- P3


Imagine all points are "high" except one. If P2 or P1 are low your quad becomes a concave mesh. So there will be a notch along the diagonal. However if you lower only P0 or P3 you get a convex mesh where the diagonal between P1 and P2 "stays" top. So in this case you actually get one triangle that is flat and one that is slanted downwards. However in the first case both triangles would be slanted.


Is this actually a 3d game? If not using the terrain seems a bit overkill.

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 Aldon0 · Nov 17, 2017 at 07:49 PM 0
Share

Thanks @Bunny83 , that makes sense, and yes, eventually it will be played first person (I'm going for a lo-fi feel) I'm guessing this will be a limitation of the unity terrain, i.e. maybe I should build my own?

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

87 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

Related Questions

I want to create a 3D World. 1 Answer

Terrain Brush for buildings instead for trees bushes etc. 1 Answer

What makes up the binary data of a 16-bit heightmap? 0 Answers

Random 2D Terrain Generating 2 Answers

How to export heightmap of a terrain during runtime. 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