#perlin-noise #bevy #grayscale #maps #gpu #visibility #foliage

bevy_foliage_tool

A configurable foliage painting system using perlin noise, grayscale maps, and chunked visibility

10 releases

new 0.15.1 Dec 12, 2024
0.15.0 Nov 30, 2024
0.14.9 Nov 14, 2024
0.14.6 Sep 29, 2024
0.14.3 Aug 29, 2024

#906 in Game dev

Download history 262/week @ 2024-08-29 2/week @ 2024-09-05 120/week @ 2024-09-12 177/week @ 2024-09-19 183/week @ 2024-09-26 28/week @ 2024-10-03 14/week @ 2024-10-10 5/week @ 2024-10-17 2/week @ 2024-10-31 2/week @ 2024-11-07 366/week @ 2024-11-14 16/week @ 2024-11-21 138/week @ 2024-11-28 97/week @ 2024-12-05

617 downloads per month

MIT license

1MB
1.5K SLoC

Bevy Foliage Tool

Description

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

Create, edit, save, load, render your foliage all with one tool. Built with GPU mesh+material instancing in mind. Supports multiple layers of foliage, each with any mesh + material provided by you. The provided grass shader is toon-colored and waves in the wind.

bevy-grass2

An example of the tool being used in the spirit_editor:

foliage_tool

Installing

cargo add bevy_foliage_tool

Run example

cargo run --example basic

Integration

In your main.rs :


    app 

    .add_plugins(BevyFoliageToolPlugin {

            foliage_config_path: "assets/foliage/foliage_config.ron".to_string()

        } ) 
        
   .add_plugins(BevyFoliageProtoPlugin )

   ;

Then make a system to load+register foliage assets: (for BevyFoliageProtoPlugin)



 app  .add_systems(Startup, register_foliage_assets) ;



 ...




fn register_foliage_assets(

    asset_server: Res <AssetServer>, 

    mut assets_resource: ResMut<FoliageAssetsResource>, 

    mut next_state: ResMut<NextState<FoliageAssetsState>>, 

) {


    let green_material: StandardMaterial = Color::srgb(0.4, 0.7, 0.6) .into();

    assets_resource.register_foliage_mesh("grass1", asset_server.load( "foliage/meshes/grass1.obj" ));

    assets_resource.register_foliage_material("standard_green", asset_server.add( green_material ));


    next_state.set( FoliageAssetsState::Loaded );
}



Then, define your foliage types : one for each layer

 (
    foliage_definitions: [

      //layer index 0 
        (
            name: "Grass",

            mesh_name: Some("grass1"),

            material_name: Some("standard_green")
            
           
        ),
        
        


	]
)

Do you like this crate? Support the creator on Patreon

https://www.patreon.com/infernaltoast

creatinggames-preview

Dependencies

~27–38MB
~628K SLoC