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
0
Question by ExtremePowers · Sep 28, 2014 at 03:05 PM · terrainmeshproceduralmountains

Procedural Mountain Generation

I would like to be able to generate mountains out of my terrain, but a problem I am having is that the only was I can make the mountains look like actual mountains is doing this:

 if (height > 175) {
     height *= height/175;
 }

Which include a threshold to check if the height is over, then it will generate a nice looking mountain, but I would like it to match my biome system. So if the biome is "Mountain" it will generate a mountain there even if its not over 175. I want to be able to have flat terrain someplaces while I have bumpy terrains other places.

Full generation code: http://pastebin.com/vvdDNCgK

Would I be able to do something like this?

 var terrainHeight = 250;
 
 if (Biome == "Mountain") {
    height += height / terrainHeight;     
 }

It would work fine if the terrain wasn't so rough, and high someplaces.

EDIT: I played a little with the perlin noise generation variables and got some fine results, now my question is how can I make the heigher spots (Mountains) more rough while the rest of the terrain is just normal :)

Result: alt text

screenshot 2014-10-05 14.03.00.png (163.1 kB)
Comment
Add comment · Show 6
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 drudiverse · Oct 01, 2014 at 08:52 PM 0
Share

sorry the question wasnt entirely clear to me. there's many maths options to do the kind of thing you say, however i couldnt be more precise at this stage. i dont know the biome system is. you can have some kinds of extra variable to govern zones, you can for example use perlin noise, say

if 2dnoise >0 terrainheight*= 1-2dnoise

(or 1-sqrt(2dnoise) for diff. gradient)

would make half the map gently flatter mountains.

for the 2d noise you can use mathf.perlinnoise(worldspaceX,worldspaceZ)

avatar image ExtremePowers · Oct 01, 2014 at 09:01 PM 0
Share

Do you mean something like this?¨

 if (Biome != "$$anonymous$$ountain") {
     noise = $$anonymous$$athf.Sqrt(noise);
 }

Because that gives weird looking mountains like the rest of the things I tried. alt text

skærmbillede 2014-10-01 22.57.55.png (217.0 kB)
avatar image drudiverse · Oct 02, 2014 at 01:28 PM 0
Share

Hey, sqrt only increases values towards 1 from zero, thus turning a sinewave more into a square wave. I have done alot of mountain maths but i don't actually understand your question, i dont know what a biome is, and what equations govern zones that are a biome and a mountain. Have a play at my mountains code if you like. you can see i made flat zones corresponding to perlin.noise(x,z)<0... press space to fly forwards: the code is on sale incidentally. it mixes 100 mountain zone formulas potentially, here is abotu 15 of them. https://dl.dropboxusercontent.com/u/114667999/landscape%20flying%20hd/landscape%20flying%20hd.html

avatar image ExtremePowers · Oct 02, 2014 at 09:44 PM 0
Share

I biome is a zone, which have some specific values. I want my mountain biome to be an actual mountain like in the webplayer you link is refering to. To have the basic flat land world and then if the biome is mountain a mountain would pop up. :)

avatar image drudiverse · Oct 03, 2014 at 07:56 AM 0
Share

mountain generation is of 2 kinds... one equation like sine cosine perlin, or loop many mountains and add them. we all use perlin and sometimes loop it. it's fast but it loses control of what you need, placing things at specific places. normally we make the biomes a result of the perlin and not the other way round... to make mountains in a particular zone here is a solution:

this will make round zones filled with mountain:

take a centre of the biome, tell the map...

go through all map points, if map point distance < than biome centre + biome edge distance, then multiply map height by (perlin noise) * (map point distance from biome centre ) that will give round biome zones. you can use 2-3 circles to avoid them being round.

i make my flat zones by using a second noise function, multiply it and clamp it by 2 so it roughly is like /''''\...../''''\.... waveshape ... and then i multiply the mountains size by this waveshape, so that there are flat areas, and high areas, and in between it lerped by slopes, from the perlin fct. i will have the infinite terrain on the asset store soon hopefully, im abit slow! cheers

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Cherno · Sep 28, 2014 at 04:03 PM

Take a look at the After Playing Minecraft thread, there are several duscussion spread throughout that deal with terrain map generation, one is here:

http://forum.unity3d.com/threads/after-playing-minecraft.63149/page-50#post-1732501

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 ExtremePowers · Sep 28, 2014 at 06:34 PM 0
Share

That didn't work, because I know how to create the biomes I just don't know how to make the mountains.

avatar image
0

Answer by revolute · Oct 02, 2014 at 06:36 AM

Try perlin noise. Unity has this in Mathf. This makes a soft and gradually changing values.

Comment
Add comment · Show 3 · 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 ExtremePowers · Oct 02, 2014 at 12:32 PM 0
Share

I use this to create the terrain heights:

         for (var oc = 0; oc < Octaves; oc++) {
             noise += $$anonymous$$athf.PerlinNoise((Seed + (startPosX + WorldPnt.x))*gain/(terrainSize * scale), (Seed + (startPosZ + WorldPnt.z))*gain/(terrainSize * scale)) / gain;
                gain *= 5;
         }

But that gives me some fine terrain, I just want to be able to have more control over the mountain generation. So some biomes are flat and others are bumpy

avatar image revolute · Oct 06, 2014 at 05:33 AM 0
Share

It is not hard to do so. You can combine 2 different perlin noises and make mountains twice as high.

avatar image ExtremePowers · Oct 06, 2014 at 05:53 AM 0
Share

I tried something like

 if (Biome == "$$anonymous$$ountain") {
     gain *= 8;
 } else {
     gain *= 4;
 }

But that just elevates the mountains

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Discrete divisions on terrain? 0 Answers

Looking for Grass asset that can procedurally generate grass on a mesh at runtime 0 Answers

How to generate a grid for procedurally generated platforms 1 Answer

Strange shading on procedural mesh 0 Answers

How do I go about texturing a flat-shaded generated mesh? 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