Jump to content


Recommended Posts

Hi Everyone!

In the past few months we have worked on optimising a scene for a VR game, which included needing a better running terrain shader than what Unity currently uses.

We first made a shader in URP that can handle 4 terrain layers, then moved onto making a version that can handle 8 terrain layers. What's unique about this shader is the fact that we were able to reduce the number of texture samples per terrain layer - going from Unity's default of 3 (BaseColor, Normal, MaskMap) down to 2 layers. So it's a third of the cost of what a typical Unity terrain shader would utilise. For example, a terrain with 8 layers using Unity's system would require 24 textures (that's 8 layers * 3 textures per layer), whilst our shader would only need 16 textures (that's 8 layers * 2 textures per layer).

Another area of improvement was reducing the amount of data tied to the terrain mesh required for the shader to sample. We were able to remove the need of vertex normals on the terrain mesh, as well as removing the need for UVs.

With some initial testing in RenderDoc, our new shader (with 8 terrain layers) was able to save 11 textures (Unity's had 32, ours had 21). We were also able to save 10 variables used in one of the constant buffers (Unity's had 50, ours had 40). Through testing this early development shader 3 times in Renderdoc I was able to infer that this current version of our optimised shader runs about +9.47% faster than Unity's. It will still need some more testing in different scenarios and devices to conclude any other differences. 


The aim of this shader is to have an indentical look with Unity's terrain shader, but just run a little faster:

Unity's Terrain Shader:


Our Optimised Shader:


Unity's Terrain Shader:


Our Optimised Shader (still needs some work on getting the normals correct!):


Let us know what you think about this approach!


  • Like 3
Link to comment
Share on other sites

  • 1 month later...

I think this is really useful! Unity's terrain has always been known to be slightly "un-optimized", I think one of the biggest areas of improvement if you wanted to ever build your own terrain system would be easier access to modifying terrain details e.g trees and grass from within the game. Trying to use unity trees that are interactable can be a challenge as you don't want to permanently remove them from the terrain data so you usually either have to keep it memory or save it to a file and replace it later on.

Link to comment
Share on other sites

  • 4 months later...

The first iteration of this called GTS launched yesterday. We decided to move more towards feature set than pure optimization in the first release... but we will improve this over time, and we have a VR project just starting now, and this will be a great opportunity for us to developed optimized versions of it.

  • Like 1
Link to comment
Share on other sites

  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

  • Create New...