Coder Social home page Coder Social logo

cliff-terrain-prototype's Introduction

Terrain Generation with Integrated Cliffs

The goal of this project is to create a proof of concept for a terrain generation method that integrates sheer cliffs into heightmap based terrain. Smooth cliff faces are generated in an otherwise grid-based terrain system by identifying conditions for each grid space which determine if and how a cliff section of a given type should be included. While current implementation is limited to simple walls, more complex art could be used to created detailed cliffs using the same premise.

The project is motivated primarily by the importance of terrain features in real-time strategy games such as Supreme Commander and Planetary Annihilation. Heightmap based terrain generation is used in many such games, and terrain features can have a significant impact on gameplay and strategies in these games. Planetary Annihilation uses CSG-based features to introduce novel complexity to its terrain in ways not commonly found in these games. Unfortunately, such a system requires using pre-fabricated features, heavily limiting the ability to generate complex, organic terrain features. Inspired by the CSG approach, the intent of this project is to achieve similarly complex features directly from heightmap data, without the limitations of the CSG approach.

example image 1

An example of generated terrain featuring layered cliffs and spiralling slopes.

example image 2

An example of dungeon-like terrain with its associated heightmap. The heightmap used is shown at full resolution, demonstrating the accuracy of wall and cliff generation.

General Usage

The prefab TerrainSystem.prefab should be included in a scene to use the system, and its settings options are as follows:

settings image 1

Image Sampler

Two different types of terrain samplers are included with the system, which generate data needed by the terrain system. These are both image samplers:

  • The fast image sampler samples an image at a fixed 1:2 resolution. This is done because a 1:1 sampling of the image has insufficient degrees of freedom for the full solution space of possible cell types and shapes to exist.

  • The slow image sampler is able to sample images at arbitrary resolutions and offsets, although doing so is relatively slow.

Terrain Builder

This component contains references to meshes required for the system to work, and defines how the mesh construction takes place. The referenced meshes currently require very specific properties for the system to work. For this reason, these references are set by default in the TerrainSystem prefab, and should not be changed.

Terrain System

This component defines the parameters of the terrain generation, and acts as a factory for generated terrain cells. Its settings are:

  • Vertical Scale: The height scaling of the generated terrain.

  • Cliff Height: The minimum height difference between vertices in the terrain past which cliffs will be generated. This can also be thought of as the steepest rate of ascent allowed.

  • Layering: This parameter contols regions over which walls below the maximum cliff height can still exist. When set to 0, it has no effect. When set to 1, cliffs will exist everywhere the terrain passes a multiple of the Cliff Height, much like a contour map.

  • Map Width, Length: Dimensions of the generated terrain.

  • Block Size: Maximum size of a given terrain cell (Block Size x Block Size)

  • Materials: Materials used for the ground and walls.

  • Outline Thickness: This parameter controls the way the 2nd UV map is generated for walls. This UV map is used to texture outlines along the top and bottom of walls (sample materials are included for this), and the Outline Thickness setting controls the thickness of these lines.

cliff-terrain-prototype's People

Contributors

aevns avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.