Dynamic water material (with waves) for Bevy.
A fleet of pirate ships moving with the waves.
cargo run --release --example ocean
Pirate ship from asset pack CC0
See the WebGPU and WebGL versions online here
sh
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli
Following is an example for ocean
. For other examples, change the ocean
in the
following commands.
WebGPU: ```sh RUSTFLAGS="--cfg=websysunstableapis" cargo build --release --example ocean \ --target wasm32-unknown-unknown \ --no-default-features --features webgpu,embedshaders,depth_prepass
echo "wasm-bindgen" wasm-bindgen --out-name ocean_webgpu \ --out-dir examples/wasm/target \ --target web target/wasm32-unknown-unknown/release/examples/ocean.wasm
echo "Optimize wasm" wasm-opt --strip-debug --vacuum -Oz \ -o ./examples/wasm/target/oceanwebgpubg.wasm ./examples/wasm/target/oceanwebgpubg.wasm ```
WebGL2: ```sh cargo build --release --example ocean --target wasm32-unknown-unknown \ --no-default-features --features webgl2,embed_shaders
echo "wasm-bindgen" wasm-bindgen --out-name ocean_webgl2 \ --out-dir examples/wasm/target \ --target web target/wasm32-unknown-unknown/release/examples/ocean.wasm
echo "Optimize wasm" wasm-opt --strip-debug --vacuum -Oz \ -o ./examples/wasm/target/oceanwebgl2bg.wasm ./examples/wasm/target/oceanwebgl2bg.wasm ```
Then serve examples/wasm
directory to browser. i.e.
```sh
basic-http-server examples/wasm ```
get_wave_point
to dynamically move objects based on the water height.bevy_pbr::*
shader for lighting/shadow support.bevy_water = "0.10"
bevy_water = "0.9"
bevy_water = "0.8"