Engine shaders
An exported tree carries data that only a matching shader uses. The repository has one set of shaders per engine under engine/. They share the same maths, the same wind values and the same names, so a tree moves and looks the same in each engine.
Status
- Unity (
engine/unity/): compiled and rendered by automated runs on Unity 6000.6 with URP 17.6; not yet used in a real project, and HDRP is only compiled. See Unity package. - Unreal (
engine/unreal/): written from Unreal's documentation, never run in Unreal. See Unreal Engine. - Godot (
engine/godot/): written from Godot's documentation, never run in Godot. See Godot.
What the shaders do
| Data | Written as | A shader uses it to |
|---|---|---|
Wind (treegen_wind_v1) | vertex colour + UV sets 1–2 | bend the whole tree, swing each branch around its pivot, flutter the leaves (layout) |
| Crown ambient occlusion | vertex colour alpha | darken the inside of the crown |
| Leaf translucency | a texture listed in the manifest | let light through leaves |
| Impostor atlases + metadata | <name>_Impostor_*.png, <name>_export.json | pick and blend the 3 nearest views, shift them by depth, relight with the baked normals (impostors) |
Each engine gets two shader families:
- Vegetation (bark and leaves): wind in three layers (leaf flutter, branch bend around its pivot, sway of the whole tree), cut-out leaves, two-sided lighting with light through the leaves, the baked ambient occlusion, and a fade of the wind with distance.
- Impostor: draws the card of the last LOD. It picks the three nearest baked views, blends them, shifts them by one parallax step, and lights the result with the baked normals. The card's strips follow the silhouette of the visible views, so fewer empty pixels are drawn.
An import helper per engine reads <name>_export.json and sets the materials, the LOD switch distances and the impostor values, so a tree needs no hand setup.
Install the package of an engine
The editor's File > Install engine support… copies the package of an engine into a project: choose the engine and the project folder, or tick Save as a zip file instead. The command line does the same:
askrgarden-cli engine-package --list
askrgarden-cli engine-package unity D:/Projects/MyGame
askrgarden-cli engine-package godot D:/Projects/MyGodotGame
askrgarden-cli engine-package unreal D:/Projects/MyUnrealGame --zip| Engine | Installs as | A project is recognised by |
|---|---|---|
| Unity | <project>/Packages/com.askrgarden.unity | Assets/ plus Packages/ or ProjectSettings/ |
| Godot | <project>/addons/askrgarden | project.godot |
| Unreal | <project>/Plugins/AskrGarden | a .uproject file |
Any other folder gets the package folder inside it. Installing again replaces the old version and removes files that are no longer in the package; nothing outside the package folder is touched. --zip writes AskrGarden-<Engine>-<version>.zip instead. AI agents use the MCP tool install_engine_package.
Wind values
The wind is global: one set of values for the whole scene, set by a wind object (Unity, Godot) or a Material Parameter Collection (Unreal). Same meaning and defaults in every engine:
| Value | Default | Meaning |
|---|---|---|
| direction | (1, 0) | wind direction on the ground plane |
| strength | 0.5 | 0 = still, 1 = strong |
| gust scale | 40 | size of a gust in metres |
| gust speed | 6 | how fast gusts travel, metres per second |
| gust amount | 0.5 | how much gusts add to the strength |
| fade start | 60 | distance in metres where the wind starts to fade |
| fade end | 120 | distance where the wind is gone; set it to the impostor switch distance |
| Engine | Where the values live |
|---|---|
| Unity | global shader values _AskrWindDirection (direction and strength), _AskrWindGust (size, speed, amount), _AskrWindFade (start, end), set by the Askr Wind component (it can copy a Wind Zone) |
| Unreal | MPC_AskrWind: WindDir, WindStrength, GustScale, GustSpeed, GustAmount, FadeStart, FadeEnd |
| Godot | Shader Globals askr_wind_dir, askr_wind_strength, askr_gust_scale, askr_gust_speed, askr_gust_amount, askr_fade_start, askr_fade_end, set by the AskrWind node |
Each material also has its own amplitudes and frequencies per layer: main sway 3° at 0.25 Hz, branch bend 12° at 0.6 Hz, leaf flutter 0.03 m at 2.5 Hz. Set an amplitude to 0 to switch that layer off.
Roadmap
| Item | Engine | Status |
|---|---|---|
unity-impostor-shader | Unity URP / HDRP | in validation: compiled and rendered by automated runs |
unity-wind-shader | Unity URP / HDRP | in validation: wind motion not yet checked by eye |
unreal-materials | Unreal | in validation: written, never run |
godot-shaders | Godot 4 | in validation: written, never run |