Code Monkey home page Code Monkey logo

bevy_water's People

Contributors

66oj66 avatar neopallium avatar noebm avatar timjentzsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bevy_water's Issues

Buoyancy

I have some half finished buoyancy code using bevy_rapier. Do you think that fits in this library when its finished?

I'm somewhat hesitant to add dependencies.

Incorrect shader path when importing package

Hello!
When importing the package I had to copy the shaders into my projects assets directory.
This seems to be because the shaders are only imported at runtime and bevy uses the environment set up by cargo to infer the correct paths.
Loading the shaders via load_internal_asset worked for me.

Cleanup non issue

When my account was compromised a spam issue was created in this repo. I sincerely apologize. Cleaning up such issues via script.

create_render_pipeline error

Whenever water would be rendered I receive the error output below. I have tested having the WaterPlugin added, but no water to render and there is no errors.

I've also tested this on Windows 11 as well as Pop!_OS 22.04.

This is the simplest version of the code which causes the error.

use bevy::prelude::*;
use bevy_water::{WaterPlugin as BevyWaterPlugin, *};

pub struct WaterPlugin;

impl Plugin for WaterPlugin {
    fn build(&self, app: &mut App) {
        app
            .insert_resource(WaterSettings {
                spawn_tiles: Some(UVec2::new(10, 10)),
                ..default()
            })
            .add_plugins(BevyWaterPlugin);
    }
}

Error Output:

2024-03-23T23:01:51.863351Z  INFO bevy_winit::system: Creating new window "Play Koi" (0v1)
2024-03-23T23:01:51.863533Z  INFO log: Guessed window scale factor: 1    
2024-03-23T23:01:51.896667Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 7900 XTX (RADV NAVI31)", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 24.0.0-1pop0~1706872735~22.04~0fa430c", backend: Vulkan }
2024-03-23T23:01:52.160780Z  INFO log: Gamepad /dev/input/event3 (ASRock LED Controller) connected.    
2024-03-23T23:01:52.177643Z  INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
2024-03-23T23:01:52.177754Z  INFO play_koi::plugins::camera_controller: 
2024-03-23T23:01:52.248743Z ERROR log: Device::create_render_pipeline error: Error matching ShaderStages(VERTEX) shader requirements against the pipeline    
2024-03-23T23:01:52.248764Z ERROR log: Handling wgpu errors as fatal by default    
thread 'Async Compute Task Pool (3)' panicked at /home/achill113/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.3/src/backend/wgpu_core.rs:3006:5:
wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_alpha_blend_mesh_pipeline`
    Error matching ShaderStages(VERTEX) shader requirements against the pipeline
    Shader global ResourceBinding { group: 0, binding: 9 } is not available in the pipeline layout
    Visibility flags don't include the shader stage


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread 'Compute Task Pool (1)' panicked at /home/achill113/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.13.0/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError

customization of water size

Put these in water settings

pub const WATER_SIZE: u32 = 256;
pub const WATER_HALF_SIZE: f32 = WATER_SIZE as f32 / 2.0;
pub const WATER_GRID_SIZE: u32 = 6;

Simplified calls for wave position / height

One can simplify the code by using a custom SystemParam that contains WaterSettings and Time data. This will allow one to access the members directly instead of manually specifying the time and height.
Calling Time methods repeatedly shouldn't cause any overhead AFAICT.

Error binding when running in wasm

I tried running the ocean example on desktop and it works perfectly with Bevy 0.10.
Adapter Info:

2023-06-28T14:37:34.618525Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3050 Laptop GPU", vendor: 4318, device: 9634, de
vice_type: DiscreteGpu, driver: "NVIDIA", driver_info: "525.116.04", backend: Vulkan }
2023-06-28T14:37:34.791949Z  INFO yogurt_sim::bevy_water::ocean: Move camera around by using WASD for lateral movement
2023-06-28T14:37:34.791972Z  INFO yogurt_sim::bevy_water::ocean: Use Left Shift and Spacebar for vertical movement
2023-06-28T14:37:34.791978Z  INFO yogurt_sim::bevy_water::ocean: Use the mouse to look around
2023-06-28T14:37:34.791981Z  INFO yogurt_sim::bevy_water::ocean: Press Esc to hide or show the mouse cursor
2023-06-28T14:37:34.792265Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.04 Pop!_OS", kerne
l: "6.2.6-76060206-generic", cpu: "12th Gen Intel(R) Core(TM) i7-12700H", core_count: "14", memory: "15.5 GiB" }

But when I tried it in wasm using wasm-pack and I got this error:

panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_alpha_blend_mesh_pipeline`
    error matching FRAGMENT shader requirements against the pipeline
    shader global ResourceBinding { group: 0, binding: 16 } is not available in the layout pipeline layout
    binding is missing from the pipeline layout

Here is the log from console for Adapter info:

AdapterInfo { name: "Intel(R) HD Graphics", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }

What should I do to get rid of this error ?

Customization of waves

First of, this is a really cool project!

I think the project currently lacks the ability to customize the waves

It seems the current state is that only the height of the waves is changeable.

Options that I think are needed:

Color including the opacity

In a stylized game, the water might be unnaturally colored.
In swamp regions the water should be able to be dirty brown without the ability to see the ground
In tropical regions the water should be able to be a bit more greenish with the ability to be partly transparent

Speed of the wave

If someone wants to create water with stronger wind, the speed of the waves is at least as important as the height

Move/wind direction?

Wouldn't consider this one strictly needed but I think it would be nice

Support terrain heightmap in WaterMaterial.

Having access to a terrain heightmap would allow:

  1. Nicer waves on shorelines/beaches.
  2. Breaking waves (Surfing?).
  3. Water color based on depth. (Done via DepthPass support). Water depth color is relative to the viewer, so needs the view depth texture.
  4. Waves breaking against cliff faces.

Implement Tessendorf waves

A C++ source that could easily be ported is e.g. available as part of the Houdini Ocean Toolkit here:

https://github.com/eloop/hot

A nice property of this algorithm is that it outputs parameters that can be used to drive foam (shading) and spray (particles).

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.