Code Monkey home page Code Monkey logo

hafewa / procedural-planet-generation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thehunterjpscripts/procedural-planet-generation

0.0 0.0 0.0 205 KB

This is an older version of a procedural planet generation. I'm actually working on an other version that is way better optimized and have a lot of added features. Feel free to use this code until I upload the new one. Note: if u plan on using it i recomend to implement an octree for finding the tiles that need to be load, it improve the loop time a lot.

License: Apache License 2.0

C# 100.00%

procedural-planet-generation's Introduction

New feature added:

Now the planet have water and can be populate:

Procedural-planet-generation (Unity Project)

Generate planets proceduraly. (Generate)

Low Poly style:

Terrace style:

How to use?

We only need to import 5 files:

'Planet.cs' , 'PlanetData.cs' , 'Polygon.cs' , 'ColorHeight.cs' , 'GenerationData.cs'.

GenerationData:

This scriptable object stores the information that will then be used to get the height of the map vertices (it uses perlin noise).

PlanetData:

This scriptable object stores the information that will then be used to create a planet.

Generate the planets:

To add a planet to the list of planets that will be created, use the functtion:

Planet.AddPlanetToQueu();

To start the thread that will calculate the data for the mesh sphere generation and modification of the landscape (will only be executed after StartDataQueu has ended):

Planet.StartDataQueu();

Instantiate the planet into the scene:

Planet.InstantiateIntoWorld();

Wait until the planet data have been compute. Then load the chunks in range to the position.

Planet.HideAndShow(Vector3 position);

Both InstantiateIntoWorld and HideAndShow can be used at the same time. In that case InstantiateIntoWorld will generate the planet until it's fully generated and the will hide all the terrain that is not in range of the position.

The end result should look like this:

procedural-planet-generation's People

Contributors

thehunterjpscripts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.