https://github.com/elringus/grass-bending
A replacement for Unity's terrain vegetation shader with alpha blended rendering and touch bending effect
https://github.com/elringus/grass-bending
asset dynamic plugin shader unity3d vegetation
Last synced: about 1 year ago
JSON representation
A replacement for Unity's terrain vegetation shader with alpha blended rendering and touch bending effect
- Host: GitHub
- URL: https://github.com/elringus/grass-bending
- Owner: elringus
- License: mit
- Created: 2018-12-27T17:30:24.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T14:52:39.000Z (over 2 years ago)
- Last Synced: 2024-05-22T18:11:46.561Z (about 2 years ago)
- Topics: asset, dynamic, plugin, shader, unity3d, vegetation
- Language: HLSL
- Homepage:
- Size: 29.3 MB
- Stars: 539
- Watchers: 26
- Forks: 77
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
## Description
The package contains a shader used for billboarded terrain details with waving and bending support and components to provide the required bend data to the shader.

## Installation
Use [UPM](https://docs.unity3d.com/Manual/upm-ui.html) to install the package via the following git URL: `https://github.com/elringus/grass-bending.git#package` or download and import [GrassBending.unitypackage](https://github.com/elringus/grass-bending/raw/main/GrassBending.unitypackage) manually.

## How to use
Paint grass on the terrain. Make sure the grass is billboarded (it will use a default shader otherwise).

Add a `BendGrassWhenEnabled` or `BendGrassWhenVisible` component to a gameobject that should apply the bend effect when positioned over the grass.

`BendRadius` controls the radius of the bending sphere with center being the pivot of the gameobject.
`Priority` is used to control the bending source priority; when concurrent bend sources limit is exceeded, benders with lower priority values will be served first.
You can also add your own implementation of the `IGrassBender` interface instead of using the built-in bender components.
The bending grass shader replaces Unity's default `Hidden/TerrainEngine/Details/BillboardWavingDoublePass` shader used for the terrain grass when `Billboard` option is enabled. It additionally allows to control the wind waving and bending power via the healthy/dry color tint alpha; when alpha of the both colors is zero, the wind and bending won't affect the grass at all.