Giter Site home page Giter Site logo

cybersys / simpleerosion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from weigert/simpleerosion

0.0 0.0 0.0 10.19 MB

Simple C++ implementatoin of particle-based hydraulic erosion on a square grid

Makefile 0.03% C++ 86.79% C 13.10% GLSL 0.09%

simpleerosion's Introduction

SimpleErosion

Simple C++ implementatoin of particle-based hydraulic erosion on a square grid.

Rendered using homebrew engine, written in C++ using OpenGL3 with control using DearImGUI.

Banner Image

Link to Blog!

Compiling

Use the makefile to compile the binary:

make all

Dependencies

Erosion System:
- gcc (compilation)
- glm (vectors)
- libnoise (noise initialization)

Renderer:
- SDL2 (core, image, ttf)
- OpenGL3
- GLEW
- Boost (System, Filesystem)
- ImGUI (included as binaries in the project, no install required)

Usage

Launch the simulation using the binary:

./erosion

Controls

Mouse and Keyboard Inputs:

- Toggle Control Panel: ESC
- Toggle Pause: P **NOTE: PAUSED BY DEFAULT**
- Change Camera Vertical Angle: Up / Down
- Change Camera Zoom and Rotation: Scroll
- Move Camera Vertically: Space / C

Panel

Control Panel

A control panel is included with DearImGUI. There are three tabs: Map, Erosion and Renderer

Map:
  - Reinitialize the Heightmap using a random seed (i.e. perlin noise)
  - Change the map-scaling and remesh! This affects the PHYSICAL height of the map and therefore erosion characteristics!
  
Erosion (Note: Default settings produced the graphics in the blog post and in this repo):
  - Erosion Cycles: Number of cycles remaining to do
  - Stepsize: Number of cycles to do in a batch before updating the image
  - Run / Stop Erosion: Run or pause the cycles! (Note: After clicking run, unpause simulation)
  - Parameters: Erosion physical parameters.
    - Timestep: Integration timestep. Higher = More erosion, but the relative parameter scales stay the same
    - Minimum Volume: Volume below which a droplet is killed
    - Density: Density of droplet, to give their inertia
    - Deposition Rate: Rate of approach to equilibrium sediment capacity
    - Evaporation Rate: Volume loss factor every timestep
    - Friction: Speed loss factor every timestep
    
Renderer:
  - Steepness: Angle at which you transition from flat to steep color
  - Flat / Steep Color: Shader colors
  - Light Strength: ...
  - Auto-Rotate / Rate: If you want the map to turn (made this for cinematics)

Screenshots

Erosion Process

Example erosion process.

Results Gif

Sample of 10 results, only the results shown here.

Before / After Comparison Gif

A before after comparison of 10 OTHER samples.

Source

If you are interested in the erosion simulation, read the world.h and world.cpp files. This is where all the erosion code takes place. To see how this integrates into the actual project, read erosion.cpp. Everything else is just to make the results renderable in OpenGL3.

The renderer / engine is taken from another project of mine, but I stripped it down to the bare necessities for this project. If you are interested in rendering your own heightmap using OpenGL3, you should study the view.h and view.cpp files. These are the engine master files.

Otherwise some of the details are explained on my blog!

License

MIT License

See my website for a more detailed copyright notice.

simpleerosion's People

Contributors

weigert 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.