Amplify Terrains
Amplify Terrains
A standard unity terrain is a regular surface shader with a few fixed requirements such as splat and control splat
and render parameters. Creating terrains with Amplify Shader Editor is really quick and easy, follow the instruct
taking advantage of our editor in no time.
Create Shader
As with any other ASE shaders, right-click on the Project view, select Create > Amplify Shader > Surface Shade
advise you to have 'First-Pass' included on the shader name since it performs what is called a first pass over the
Queue Index
Set the Queue Index to -100 on the Output Node Properties General tab.
Render Type
By default a created shader already comes with the Opaque shader type selected, which is required by the terrain
Mode tab and check that Opaque is the selected option.
Feel free to open the ASESampleShaders/SimpleTerrainBase shader located at AmplifyShaderEditor > Examp
> SimpleTerrainBase.shader and check what is being done. Please note that property naming in the base shader
names must be maintained.
ASE supports multiple splats but its maximum amount needs to be specified into the shader through a custom ta
In order to do that:
Diffuse
Each splat can be accessed via their properties, having yet again strict naming to be maintained. The splat diffus
the sampler variables _Splat0 through _Splat3, so in your shader you must create four Texture Sampler nodes wi
Splat 3 as the _ is automatically placed and the empty spaces are also automatically removed from the created va
Normal
The same goes to normal maps, they are accessed through the sampler variables _Normal0 through _Normal3 so
shader you must create four Texture Sampler nodes with the names Normal 0 through Normal 3. One detail to ta
Normal Map should be turned off for each one of the nodes and an Unpack Scale Normal node should be applied
combined.
Smoothness + Metallic
Smoothness and Metallic values must also have specific variable names, _Smoothness0 through _Smoothness3 a
_Metallic3 respectively.
These variables however are Float properties, so to access them you need to create Float nodes, set them to Prop
Smoothness 0 through Smoothness 3 and Metallic 0 through Metallic 3 respectively.
To maintain consistency with the Unity terrain shader, you should add the Gamma attribute to the Metallic prope
Combining Maps
The weight of each layer is given by yet another sampler variable. The _Control sampler variable contains, in ea
contribution each layer/splat have on the final result. To get access to it, simply create a Texture Sampler node in
being Control. This Control texture is dynamically created when you paint your terrain with the Terrain tools and
the terrain asset on the Project view.
Again, we invite you to check the Four Splats First Pass Terrain shader function located at AmplifyShaderEditor
ShaderFunctions > Four Splats First Pass Terrain for a more in-depth view on how the Control texture is used.
Support for 4+ Splat Maps
We've introduced support for over 4 Splat Maps through the SimpleTerrainAddPass shader, which is registered i
SimpleTerrainFirstPass - as a dependency, and is used to add any additional pass that is set in the main shader's S
example, the shader function we provide may only use 4 splats, so if you have 9 splats, you'll be using the First P
called twice ( 4 + 4 + 1 ).
Please note that this Tag is only necessary for Unity 2018.2 and below, if you're using Unity 2018.3+ you'll hav
for the shader to work as expected.
Instanced Terrain
Starting from Unity 2018.3, terrains can be GPU instanced.
If the terrain is set to be GPU instanced ( option Draw Instanced turned on over Terrain Settings )
then each one of its shaders must be prepared for it.
ASE already supports this option via the Instanced Terrain over the Master Node properties panel.
Please note that, not only the First Pass shader, but also all its dependencies ( Base and Add Pass )
MUST be compiled with this option turned on.