Inertia
Why use inertia?
While the GPU excels in many tasks, it cannot easily access memory from the last frame. This can lead to situations where a wind zone passes by a tree bending it properly but when it fully passes by the tree, the tree immediately bounces back without any spring force.
Shader Graph
Adding inertia support to a shader graph is simple! All you need to do is add two properties to your shader and Zephyr's built-in nodes will work out of the box with no other customizations required.
Add the define
Next, you need to add the _ZEPHYR_USEINERTIA define to your shader. In Shader Graph, we can do this by adding a boolean keyword.

Once this is created, name the keyword "_ZEPHYR_USEINERTIA" and set the definition to Multi Compile. Optionally, set Is Overridable and Generate Material Property to true to expose a toggle in your material editor.
Make sure that your default value is set to true if you do not expose this property! If this value is set to false, the wind inertia will be automatically disabled.

Amplify Shader Editor
In order to add support for inertia using ASE, all we need to do is declare the _ZEPHYR_USEINERTIA directive in our shader.
Add the define
To begin, add the _ZEPHYR_USEINERTIA define to your shader. In Amplify Shader Editor, we can do this by adding a boolean keyword. Create a new switch node in your graph

Next, rename it to _ZEPHYR_USEINERTIA and set the keyword type to multi-compile and enable auto register to not have to add it to your graph.

HLSL
In order to add support for inertia in an HLSL shader, all we need to do is declare the _ZEPHYR_USEINERTIA directive in our shader and add the _ZEPHYR_WindHistory property.
Add use inertia define
Next, add this line along with your pragmas and defines:
#define _ZEPHYR_USEINERTIA(Optional) Add a property to be able to toggle the define from the material inspector.
Use this line instead in your pragmas:
#pragma multi_compile_local __ _ZEPHYR_USEINERTIAThen add a toggle with your properties:
[Toggle( _ZEPHYR_USEINERTIA )] _ZEPHYR_USEINERTIA( "UseInertia", Float ) = 1Last updated


