Git Product home page Git Product logo

bevy_terrain's Introduction

Bevy Terrain

GitHub Crates.io docs.rs Discord

Bevy Terrain is a plugin for rendering terrains with the Bevy game engine.

(Data Source: Federal Office of Topography, ©swisstopo)

Warning: This plugin is still in early development, so expect the API to change and possibly break you existing code.

Bevy terrain was developed as part of my bachelor thesis on the topic of large-scale terrain rendering. Now that this project is finished I am planning on adding more features related to game development and rendering virtual worlds. If you would like to help me build an extensive open-source terrain rendering library for the Bevy game engine, feel free to contribute to the project. Also, join the Bevy Terrain Discord server for help, feedback, or to discuss feature ideas.

Examples

Currently, there are two examples.

The basic one showcases the different debug views of the terrain. See controls down below.

The advanced one showcases how to use the Bevy material system for texturing, as well as how to add additional terrain attachments. Use the A Key to toggle between the custom material and the albedo attachment.

Before running the examples you have to preprocess the terrain data this may take a while. Once the data is preprocessed you can disable it by commenting out the preprocess line.

Documentation

The docs folder contains a high-level implementation overview, as well as, the development status, enumerating the features that I am planning on implementing next, of the project. If you would like to contribute to the project this is a good place to start. Simply pick an issue/feature and discuss the details with me on Discord or GitHub. I would also recommend you to take a look at my thesis. There I present the basics of terrain rendering (chapter 2), common approaches (chapter 3) and a detailed explanation of method used by bevy_terrain (chapter 4).

Debug Controls

These are the debug controls of the plugin. Use them to fly over the terrain, experiment with the quality settings and enter the different debug views.

  • T - toggle camera movement

  • move the mouse to look around

  • press the arrow keys to move the camera horizontally

  • use PageUp and PageDown to move the camera vertically

  • use Home and End to increase/decrease the camera's movement speed

  • W - toggle wireframe view

  • P - toggle tile view

  • L - toggle lod view

  • U - toggle uv view

  • C - toggle tile view

  • D - toggle mesh morph

  • A - toggle albedo

  • B - toggle base color black / white

  • S - toggle lighting

  • G - toggle filtering bilinear / trilinear + anisotropic

  • F - freeze frustum culling

  • H - decrease tile scale

  • J - increase tile scale

  • N - decrease grid size

  • E - increase grid size

  • I - decrease view distance

  • O - increase view distance

Attribution

The planar terrain dataset is generated using the free version of the Gaia Terrain Generator. The spherical terrain example dataset is a reprojected version of the GEBCO_2023 Grid dataset.

GEBCO Compilation Group (2023) GEBCO 2023 Grid (doi:10.5285/f98b053b-0cbc-6c23-e053-6c86abc0af7b)

License

Bevy Terrain source code (this excludes the datasets in the assets directory) is dual-licensed under either

at your option.

bevy_terrain's People

Contributors

kurtkuehnert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bevy_terrain's Issues

Please, release this library

Hi, I would really like to work with this project, it would be really nice to have it in crates.
Can I help you to test/release?

Possible port to Godot Engine?

Is it possible to implement a similar terrain system in Godot? I took a look at your thesis and it looks promising, but I can't grasp how the code is structured since I don't know much about rust and bevy engine's documentation is rather sketchy.

Terrain collider using Rapier's heightfield

Hello,

I really like this project, but one of the important things that appear to be missing for potential games and simulations is colliders on the terrain. Rapier contains a collider type that seems to be ideal for this purpose, I'm talking about heightfield colliders. Are there possibly any plans to include this? I tried to make a prototype with these myself, but this project is pretty big and honestly I have no idea where to even begin. Can you provide me with some guidance? Most importantly I need to find a step in the whole preprocessing/rendering pipeline where the images are processed and already available in the form of 2d height matrix, spawning a collider at this point should be trivial.

Discussion about editable terrain

After initial investigations, it looks like the path towards making the terrain editable would be to load the heightmap (and other textures) into memory first from a path, and then load them into the terrain from memory. Right now, the terrain loader seems to load the heightmap directly from a path which is non-conducive to making it editable.

If the heightmap data were loaded into memory first and then that struct were used to build the terrain (like AddAttachmentFromMemory or something similar) then a system could be built to edit that heightmap in memory and hot-reload the tiles/chunks every ~200ms as needed. Once that is done, the only thing left to do would be to add some sort of manual or auto save/export feature that could export the heightmap in memory back out to a file as the editor desired.

thoughts?

Basic example with LOD > 5 panics with `Atlas out of indices`

Hi there,

When I change the LOD_COUNT constant from 4 to 5 everything seems to work, but changing it to 6 or above yields this error:

thread '<unnamed>' panicked at src/terrain_data/node_atlas.rs:365:57:
Atlas out of indices
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `preprocess_earth::setup`!

Also a few remarks unrelated to this particular issue, hoping you won't mind:

  • the keybindings seem to have diverged between the readme and the code base.
  • the default debug camera position made me think I had a problem, until I realised I needed to elevate the camera.
  • is it possible to import a non-square heightmap?

Thanks!

Jun

mismatched types when running the examples on a fresh checkout

❯ cargo run --release --example basic
error[E0308]: mismatched types
   --> src/debug/camera.rs:105:30
    |
105 |         transform.rotation = rotation;
    |         ------------------   ^^^^^^^^ expected struct `bevy::prelude::Quat`, found struct `dolly::glam::Quat`
    |         |
    |         expected due to the type of this binding
    |
    = note: struct `dolly::glam::Quat` and struct `bevy::prelude::Quat` have similar names, but are actually distinct types
note: struct `dolly::glam::Quat` is defined in crate `glam`

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.