百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
W

WaterRW

> 编程语言
开源

WaterRW 是一个适用于 Unity 的 2D 互动水系统。

199 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

WaterRW 是一个适用于 Unity 的 2D 互动水系统。

WaterRW

WaterRW is 2D interactive water system for Unity.

Table of Contents

  • WaterRW
    • Table of Contents
    • Installation
      • Requirements
      • Install via UPM git dependency
    • Quick Start
      • 1. Import Prefabs and Materials
      • 2. Place a prefab
      • 3. Enable reflection and refraction (optional)
    • ☑️ Material Settings Guide
    • Enable Interactions
      • WaterRWCompute Settings
      • Avoid Divergence
      • Buffer Scrolling

Installation

Requirements

  • Unity 2022.3 or later
  • Compute shader compatible platform
  • Universal Render Pipeline enabled
    • 2D Renderer is also required to enable reflection and refraction.

Install via UPM git dependency

Add git URL from Package Manager:

https://github.com/ruccho/WaterRW.git?path=/Packages/com.ruccho.water-rw

Quick Start

1. Import Prefabs and Materials

  • Import Prefabs & Samples from Samples page in Package Manager.

2. Place a prefab

  • Place Prefab/Water-RW (Compute).prefab to the scene.

3. Enable reflection and refraction (optional)

  • To enable reflection and refraction, you have to use 2D Renderer.

    • https://docs.unity3d.com/Packages/[email protected]/manual/2DRendererData-overview.html
  • Enable Camera Sorting Layer Texture at the layer you want to reflect and refract.

  • Water-RW has to be rendered after Camera Sorting Layer Texture. Use Mesh Renderer Sorting component to configure the sorting layer of a Water-RW instance.

☑️ Material Settings Guide

WaterRW uses the shader Water-RW/With Compute.

Property Type
Tint Color Tint color.
Pixel Snap Float Same as one in Sprites-Default shader.
Normal A Texture2D Normal map A. Use tiling properties to scale a map.
Normal A Intensity Float Amount of distortion of normal map A.
Normal A Speed Vector Scroll speed of normal map A. Only X and Y works.
Normal B Texture2D Same as normal A.
Normal B Intensity Float Same as normal A.
Normal B Speed Vector Same as normal A.
Background Blend Float Rate of reflection blend.
Transparency Float Dark reflection areas goes transparent.
Multiplier Color Color multiplier.
Addend Color Color addend.
Wave Size in Viewport Space Float Horizontal size of near-surface distortion.
Wave Distance in Viewport Space Float Vertical size of near-surface distortion.
Wave Frequency by Position Float Frequency of sin curve used for near-surface distortion by vertical position.
Wave Frequency by Time Float Frequency of sin curve used for near-surface distortion by vertical time.
Surface Color Color Color of surface line.
Surface Width in Pixel Color Width of surface line in pixels.
Fade Distance in Viewport Space Float Vertical size of fade to avoid display reflection areas out of Camera Sorting Layer Texture.
Smooth Buffer Edge in World Space Float Size of smoothing area in world space at the edge of wave buffer.
Reflection Intensity Float Intensity of reflection.
Enable Lighting bool Enables Light2D integration (experimental).

Enable Interactions

WaterRW supports rough interation with rigidbodies. (Colliders with complex shapes may not be handled correctly!)

In inspector of WaterRWCompute script, select layers to interact with in Layers To Interact With property.

WaterRWCompute Settings

Property Type
Mesh segments Per Unit float Numbers of mesh divisions per unit.
Update Mode FixedUpdate / Update Timing to calculate wave. Use FixedUpdate to work interactions correctly.
Override Fixed Time Step bool Determine whether to use custom timestep.
Fixed Time Step float Custom time step.
C float The constant used in wave calculation. Increasing this will increase the speed of the waves.
Decay float Coefficient for damping waves.
Enable Interaction float Determine whether to use interaction.
Layers To Interact With LayerMask Layers to interact with.
Spatial Scale float Horizontal scale used in wave calculation.
Max Interaction Items float Max number of rigidbodies to interact with.
Wave Buffer Pixels Per Unit float Resolution of buffers used to wave calculation.
Scroll To Main Camera bool Track the range of the wave calculation to the position of the main camera.
Flow Velocity float Velocity of the flow.
Max Surface width float Max width of the wave in world scale.

Avoid Divergence

Values of Fixed Time Step, C, Spatial Scale and Wave Buffer Pixels Per Unit may cause divergence.

To avoid divergence, keep: 0 ≤ (C * dt / dx) ≤ 1.

dt = time step (Fixed Time Step when Override Fixed Time Step is true, otherwise Time.deltaTime or Time.fixedDeltaTime is used)

dx = Spatial Scale / Wave Buffer Pixels Per Unit

Buffer Scrolling

Although the size of the buffer used for wave calculation is finite, interaction with the seemingly infinite surface of the water can be achieved by making the wave calculation range follow the camera position. If Scroll To Main Camera is true, it will automatically follow Camera.main. To set it manually, set the X coordinate to float WaterRWCompute.WavePosition.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言