Skip to content

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 ​

DataWritten asA shader uses it to
Wind (treegen_wind_v1)vertex colour + UV sets 1–2bend the whole tree, swing each branch around its pivot, flutter the leaves (layout)
Crown ambient occlusionvertex colour alphadarken the inside of the crown
Leaf translucencya texture listed in the manifestlet light through leaves
Impostor atlases + metadata<name>_Impostor_*.png, <name>_export.jsonpick 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:

sh
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
EngineInstalls asA project is recognised by
Unity<project>/Packages/com.askrgarden.unityAssets/ plus Packages/ or ProjectSettings/
Godot<project>/addons/askrgardenproject.godot
Unreal<project>/Plugins/AskrGardena .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:

ValueDefaultMeaning
direction(1, 0)wind direction on the ground plane
strength0.50 = still, 1 = strong
gust scale40size of a gust in metres
gust speed6how fast gusts travel, metres per second
gust amount0.5how much gusts add to the strength
fade start60distance in metres where the wind starts to fade
fade end120distance where the wind is gone; set it to the impostor switch distance
EngineWhere the values live
Unityglobal 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)
UnrealMPC_AskrWind: WindDir, WindStrength, GustScale, GustSpeed, GustAmount, FadeStart, FadeEnd
GodotShader 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 ​

ItemEngineStatus
unity-impostor-shaderUnity URP / HDRPin validation: compiled and rendered by automated runs
unity-wind-shaderUnity URP / HDRPin validation: wind motion not yet checked by eye
unreal-materialsUnrealin validation: written, never run
godot-shadersGodot 4in validation: written, never run