• Stars
    star
    108
  • Rank 310,493 (Top 7 %)
  • Language
    Rust
  • Created over 1 year ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dynamic ocean material for Bevy.

bevy_water

Dynamic water material (with waves) for Bevy.

Example

A fleet of pirate ships moving with the waves.

cargo run --release --example pirates

Dutch ship model from polyhaven (CC0)

WASM examples

See the WebGPU and WebGL versions online here

Setup

rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli

Build & Run

Following is an example for pirates. For other examples, change the pirates in the following commands.

WebGPU:

RUSTFLAGS="--cfg=web_sys_unstable_apis" cargo build --release --example pirates \
	--target wasm32-unknown-unknown \
	--no-default-features --features webgpu,embed_shaders,depth_prepass

echo "wasm-bindgen"
wasm-bindgen --out-name pirates_webgpu \
  --out-dir examples/wasm/target \
  --target web target/wasm32-unknown-unknown/release/examples/pirates.wasm

echo "Optimize wasm"
wasm-opt --strip-debug --vacuum -Oz \
	-o ./examples/wasm/target/pirates_webgpu_bg.wasm ./examples/wasm/target/pirates_webgpu_bg.wasm

WebGL2:

cargo build --release --example pirates --target wasm32-unknown-unknown \
	--no-default-features --features webgl2,embed_shaders

echo "wasm-bindgen"
wasm-bindgen --out-name pirates_webgl2 \
  --out-dir examples/wasm/target \
  --target web target/wasm32-unknown-unknown/release/examples/pirates.wasm

echo "Optimize wasm"
wasm-opt --strip-debug --vacuum -Oz \
	-o ./examples/wasm/target/pirates_webgl2_bg.wasm ./examples/wasm/target/pirates_webgl2_bg.wasm

Then serve examples/wasm directory to browser. i.e.

# cargo install basic-http-server
basic-http-server examples/wasm

Features

  • Moving 3d waves (vertex height offset).
  • Get the wave height using get_wave_point to dynamically move objects based on the water height.
  • Tileable - allows for adding/removing tiles of water for endless ocean.
  • Normals calculated based on wave height for lighting.
  • Imports bevy_pbr::* shader for lighting/shadow support.

Ideas/Improvements

  • Improve water color/texture.
  • Heightmap support to adjust waves based on water depth.
  • Mask texture to remove water from areas that shouldn't have water.
  • Volumetic water below the surface.
  • Dynamic depth buffer for objects partially below the surface (boats, peers). Render pass?

Versions

  • Bevy 0.13.1: bevy_water = "0.13"
  • Bevy 0.12: bevy_water = "0.12"
  • Bevy 0.11: bevy_water = "0.11"
  • Bevy 0.10: bevy_water = "0.10"
  • Bevy 0.9: bevy_water = "0.9"
  • Bevy 0.8: bevy_water = "0.8"

More Repositories

1

lua-pb

Lua Protocol Buffers
Lua
287
star
2

lualogging

New maintainer at: https://github.com/lunarmodules/lualogging
Lua
146
star
3

lua-llthreads

Low-Level threads(pthreads or WIN32 threads) for Lua.
C
143
star
4

llvm-lua

Automatically exported from code.google.com/p/llvm-lua
C
141
star
5

lua-handlers

Provides a set of async. callback based handlers for working with raw TCP/UDP socket, ZeroMQ sockets, or HTTP client/server.
Lua
103
star
6

LuaNativeObjects

A Lua bindings generator written in Lua.
Lua
95
star
7

slua

Static lua compiler - Compile Lua code into C code.
C
65
star
8

nixio

System, Networking and I/O library for Lua. This is an unoffical fork of NIXO from: http://luci.subsignal.org/
C
58
star
9

mmap_lowmem

mmap() wrapper to expand MAP_32BIT to use all of the low 4Gbytes of address space.
C
35
star
10

lua-nanomsg

Lua bindings to NanoMsg
Lua
32
star
11

lua-epoll

Lightweight wrapper for epoll.
C
20
star
12

bevy_shader_graph

Shader graph for Bevy
Rust
15
star
13

s1vm

Fast Wasm interpreter in Rust
Rust
14
star
14

lua-clang-cindex

FFI bindings to libclang's CIndex interface.
Lua
12
star
15

websocket-client-go

Reconnecting Websocket Client Golang Library
Go
12
star
16

lua-llnet

A low-level network IO library.
C
12
star
17

luagit2

LuaGit2 has move to a new home at https://github.com/libgit2/luagit2
Lua
10
star
18

lua-buf

Mutable buffer object for Lua.
C
10
star
19

lua-http-tokenizer

A HTTP protocol tokenizer
C
8
star
20

node_engine

Rust
7
star
21

lludp_dissector

Wireshark dissector for the LLUDP protocol
Lua
6
star
22

luaxcb

Lua bindings for XCB
C
4
star
23

jpeg2k

Safe wrapper for openjpeg-sys.
Rust
4
star
24

bevy_fake_interior

Fake interior material for Bevy
Rust
4
star
25

serialization-benchmarks

Benchmark comparison of C/C++ serialization systems.
C
3
star
26

cr-sys

Rust raw bindings for cr.h: A Simple C Hot Reload Header-only Library
Rust
2
star
27

lua-net-bench

Network service benchmark/stress-testing suite written in Lua.
Lua
2
star
28

mongrel2_stream_prototype

Prototype a stream interface between mongrel2 and backend handlers.
Lua
2
star
29

faxpp

Fast XML Pull Parser
C
2
star
30

sub-script

Scripting interface for substrate nodes.
Rust
2
star
31

cr-rs

Rust safe wrapper for cr.h: A Simple C Hot Reload Header-only Library
Rust
2
star
32

lua-http-message

Fast HTTP message parser for Lua.
Lua
2
star
33

n_closure

header-only C Closure library
C++
2
star
34

pusher-client-go

Pusher Client Go Library
Go
1
star
35

material_designer

Designer for working on Materials/Shaders for Bevy
Rust
1
star