Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
5
Question by Varine · May 29, 2011 at 09:07 AM · terrainrandomproceduralheightmapautomatic

Procedural Terrain?

Is it possible to generate terrain semi-procedurally or automatically? Not really sure what the proper terminology is...

Basically, I have a massive heightmap that outlines the general landmass. As opposed to carving out details totally by hand or adding a lot of random noise to it or something, would it be possible to draw out things like mountains and generate them procedurally, and save that data? I read about random generation of essentially infinite terrain at runtime, but is it possible to do it just to aid the development process as opposed to doing it at runtime?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
6

Answer by Kos-Dvornik · Nov 22, 2013 at 10:27 AM

This 3 tutorials cover all procedural terrain generation aspects in Unity:

http://kostiantyn-dvornik.blogspot.com/2013/01/unity-4-cool-sweet-terrain-tutorial.html

http://kostiantyn-dvornik.blogspot.com/2013/11/awesome-unity-texturing-terrain-tutorial.html

http://kostiantyn-dvornik.blogspot.com/2014/02/huge-amazing-unity-terrain-tutorial.html

Additional split terrain script:

http://kostiantyn-dvornik.blogspot.com/2013/12/unity-split-terrain-script.html

Automatic grass placement: https://doctrina-kharkov.blogspot.com/2019/08/unity-automatic-grass-terrain.html

Comment
Add comment · 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
2

Answer by SirGive · May 29, 2011 at 09:10 AM

Yes, and this has been done with Unity. Let me try to find the link. There was a video and everything. It was done really nicely.

A quick google search yielded it. And it is indeed called procedurally generated terrain. Head to page 2 and its at the bottom.

Here is another procedural generator.

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 Varine · May 29, 2011 at 09:16 AM 0
Share

Wow... so Unity basically just about does everything you could want it to, doesn't it?

avatar image SirGive · May 29, 2011 at 09:18 AM 0
Share

It is an extremely useful tool for indie devs. :)

avatar image
2

Answer by HuskyPanda213 · Mar 06, 2014 at 05:55 PM

Kind of late, but if you have terrain toolkit I've made a script to generate random textures/heightmaps using terraintoolkit:

 using UnityEngine;
 using System.Collections;
 
 public class PerlinTerrain : MonoBehaviour {
 
     //Toolkit instance.
     [SerializeField]TerrainToolkit kit;
     //Array of textures.
     [SerializeField]Texture2D sandTexture;
     [SerializeField]Texture2D grassTexture;
     [SerializeField]Texture2D rockTexture;
     [SerializeField]Texture2D cliffTexture;
 
     void Start() {
         //Check if we have the kit assigned;.
         if (kit == null) {
             //If there is not an instance assigned or on gameObject, return.
             if (!GetComponent<TerrainToolkit>())
             {
                 return;
             }
             //Else assign kit to gameObject's toolkit.
             else
             {
                 kit = GetComponent<TerrainToolkit>();
             }
         }
         //Generate the terrain.
         Generate();
     }
 
     void OnGUI(){
         if (GUILayout.Button ("Generate")) {
             Generate();        
         }
     }
 
     public void Generate() {
         //Generate the perlin terrain.
         kit.PerlinGenerator((int)Random.Range(3,6),Random.Range(0.4f,0.9f),Random.Range(2,6), 1f);
         //Gives it a less smooth feel.
         kit.PerlinGenerator(4,4,4, 0.1f);
         //Creates arrays for stops.
         float[] slopeStops = new float[2];
         float[] heightStops = new float[4];
         Texture2D[] terrainTextures = new Texture2D[4];
         //Assigns values to the arrays.
         slopeStops[0] = 30f; slopeStops[1] = 70f;
         heightStops[0] = Random.Range(0.05f, 0.18f);
         heightStops[1] = Random.Range(0.19f, 0.49f);
         heightStops[2] = Random.Range(0.5f, 0.69f);
         heightStops[3] = Random.Range(0.7f, 0.89f);
         terrainTextures[0] = cliffTexture;
         terrainTextures[1] = sandTexture;
         terrainTextures[2] = grassTexture;
         terrainTextures[3] = rockTexture;
         //Paints the textures.
         kit.TextureTerrain(slopeStops, heightStops, terrainTextures);
     }
 
     public void Generate(bool doublePerlin) {
         //Generate the perlin terrain.
         kit.PerlinGenerator((int)Random.Range(3,6),Random.Range(0.4f,0.9f),Random.Range(2,6), 1f);
         //Gives it a less smooth feel.
         if(!doublePerlin){
             kit.PerlinGenerator(4,4,4, 0.1f);
         }
         //Creates arrays for stops.
         float[] slopeStops = new float[2];
         float[] heightStops = new float[4];
         Texture2D[] terrainTextures = new Texture2D[4];
         //Assigns values to the arrays.
         slopeStops[0] = 30f; slopeStops[1] = 70f;
         heightStops[0] = Random.Range(0.05f, 0.18f);
         heightStops[1] = Random.Range(0.19f, 0.49f);
         heightStops[2] = Random.Range(0.5f, 0.69f);
         heightStops[3] = Random.Range(0.7f, 0.89f);
         terrainTextures[0] = cliffTexture;
         terrainTextures[1] = sandTexture;
         terrainTextures[2] = grassTexture;
         terrainTextures[3] = rockTexture;
         //Paints the textures.
         kit.TextureTerrain(slopeStops, heightStops, terrainTextures);
     }
     
 }
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 hike1 · May 13, 2015 at 03:58 AM 0
Share

thanks Husky, this is interesting. The terrain toolkit doesn't always update my height changes.

I switched the 1st part around to get a smoother terrain

 //Generate the perlin terrain.
      kit.PerlinGenerator((int)4,Random.Range(0.16f,0.18f),(int)3, 1f);
      //Gives it a less smooth feel.
      //kit.PerlinGenerator(4,4,4, 0.1f);

I commented out the 'less smooth' part. Now I get a smooth terrain with only the sand, what do I want to change to get all 4 textures on a smooth terrain?

https://sites.google.com/site/terrymorgan1213/tutorials/terrain_toolkit/smoother_but_only_1_tex.jpg

avatar image hike1 · May 13, 2015 at 02:43 PM 0
Share

Never $$anonymous$$d, I realized my terrain was 70 units high out of a possible 600, 12%, so I fit all my texture changes in the 1st 12%.

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

Connecting Perlin Terrain Tiles 1 Answer

Mesh based on noise 1 Answer

Terrain height map influences ocean wave heights? 2 Answers

How to seamlessly tile terrains 0 Answers

Procedural terrain tiles 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