What are you looking for?
Search the Community
Showing results for tags 'virtual'.
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!