Giter Site home page Giter Site logo

bevy_mesh_terrain's Introduction

Bevy Mesh Terrain

Installing

cargo add bevy_mesh_terrain 

NOTE: Make SURE you copy the terrain.wsgl shader into your assets directory properly! Otherwise your terrain will not render.

Bevy Versions

Terrain 0.6.x -> Bevy 0.12.x

Terrain 0.13.x -> Bevy 0.13.x

Run example

cargo run --example basic

Description

A very bevy-centric terrain plugin that takes advantage of entities, components and systems as much as possible to be as easy to understand and interact with as possible.

You spawn an entity and give it the 'TerrainConfig' and 'TerrainData' components, and then the plugin systems will spawn child entities which are each of the rendered chunks. In this way, it works similarly to a voxel chunking system ( a la minecraft) except using heightfields (2d) instead of voxels (3d).

image

Texture Types

Height Map Texture The source of height ! This is a grayscale image in R16 format and if values are totally dead black then the shader will actually make alpha == 1 right there so you can blow holes in the terrain for caves and such (youll prob want to put rock doodads there to make it look nice!)

Color/Diffuse Texture Array This is the source of the actual terrain textures. Up to 256 textures can be loaded in and painted with the splat map. So for example, grass, dirt, snow, and sand. You can edit that file of course for different looks.

Splat Map Texture This is an RGBA control map texture for the diffuse texture array using a special data protocol. This is what you edit in a 'terrain editor' to paint your grass in one area, dirt in another area, snow on mountains, etc.

Splat Map Texture Protocol

The splat map now supports up to 255 textures in a single material by using inspiration from 'Microsplat' documentation. The limitation is that only 2 textures can be blended together at any given pixel.

Splat map R channel - A float from 0.0 to 255.0 which is converted to an integer from 0-254 to specify the texture (of the 255) to use for this pixel on layer 0 Splat map G channel - A float from 0.0 to 255.0 which is converted to an integer from 0-254 to specify the texture (of the 255) to use for this pixel on layer 1 Splat map B channel - A float which is used to specify how much of the R channel layer to use here (0.0) versus how much of the G channel layer to use here (1.0). Splat map A channel - not used.

Reference Shader Material

see https://github.com/bevyengine/bevy/blob/main/examples/shader/shader_material.rs

Editor (WIP)

https://github.com/ethereumdegen/bevy_mesh_terrain_editor

bevy_mesh_terrain's People

Contributors

ethereumdegen avatar mattdm 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.