bevy_feronia
Environment scattering tools and shaders/materials that prioritize visual fidelity/artistic freedom, a declarative API and modularity.
Who is this for?
In the current stage this is mostly for tinkerers and learners within the bevy ecosystem, but I am planning to use this for actual game dev myself eventually.
[!CAUTION] This package is in early development and in an experimentation stage. I wouldn't personally use this in production quite yet, but it's getting closer to that state incrementally.
Getting started
cargo add bevy_feronia
The possible use-cases are demonstrated in the examples
Setup
The setup depends on the use-case, but a typical setup would look like something like this:
app.add_plugins;
The Scatter system needs to know when it can set up since it can depend on height mapping. You need to insert the setup state at some point.
[!NOTE]
In complex setups that load assets and bake a height map, this can be after theStartup.
app.insert_state
Or
ns_height_map.set;
ns_scatter.set;
Defining layers
A ScatterItem's LODs are grouped by Name. If the names end in LOD_1 or lod1 etc., the LOD suffix will be stripped from the name to match it to the other lods of the asset.
[!CAUTION] When defining multiple
ScatterItemsperScatterLayerwithout names, a different asset will render whenLODsare changing, leading to visual bugs.
// Landscape
cmd.spawn;
Scattering
Now you can start scattering! π± π πΏ π π³ π² π΄ πΊ
cmd.trigger;
[!NOTE]
ScatterLayersand theirScatterItemsof the sameScatterTypeare always scattered in order, but layers of differentScatterTypescan be scattered at the same time.
Ordered Scattering
In complex scenes it is often required to scatter a complete hierarchy in order (rocks β trees/foliage β grass).
[!TIP] If an ordered scatter is still required, and you can't or don't want to scatter in parallel, observers need to be used to chain the scattering of
ScatterTypesin order.
Compatibility
There are very experimental releases before 0.5.0, but I wouldn't use them.
| bevy | bevy_feronia |
|---|---|
| 0.17 | 0.5 |
License/Credits/Inspirations/References
The code is dual-licensed:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
Feel free to copy the grass assets. All the other assets used in the examples are licensed assets.
[!IMPORTANT] If you intend to use them, make sure you comply with the license.
- Graswald for their amazing assets and
GScatter, which served as inspiration for the scatter tools. - Sucker Punch Productions for their Procedural Grass and Wind simulation in 'Ghost of Tsushima' and GDC Talks.
- bevy_procedural_grass by jadedbay
- warbler_grass by EmiOnGit
- GDC 2011 "Approximating Translucency"
- BlinnβPhong reflection model
- All the other assets
Roadmap
A bunch of issues are already open, but some of the larger milestones could be:
- Allow physics-based and other entities to impact the displacement/wind.
- Make use of compute shaders (Allow scattering on CPU and GPU, improve culling).
- Allow for multiple
ScatterRootswhen baking height maps (otherwise it should work... probably but it isn't tested yet)