Using Tessellation in Unity’s HDRP
What is Tessellation and how does it work? If you have ever used 3d modeling or sculpting software before, and are familiar with the term Subdivision, you will have an easy understanding of Tessellation. 3D models are composed of meshes which are made up of polygons. Tessellation will increase the polygon count of a mesh in the familiar way to subdivision increasing the detail in a 3D model. The main similarity between the two is that the model can be quickly transitioned between high and low poly, without losing the detail information of the high poly model. Tessellation adds details to a mesh via triangles, which is ideal for real time rendering, in programs such as Unity.
Before I get started with this article on Tessellation and outdoor flooring, I will need a ground texture. I found this free Cobblestone texture on Poliigon.com. If you have never been to Poliigon’s website…go check it out. It’s founder is Andrew Price, also known as the Blender Guru. He is really an absolute pro when it comes to all things Blender, and has an immense library of free videos on YouTube for new and seasoned 3D artists alike.
I ended up grabbing the 3k version of this texture, but the really high resolution options are there if you want them.
You get a few color variations for the Base Map, as well as a Height Map (displacement map), Normal Map, Gloss and Reflective maps.
Before bringing in this new Cobblestone texture, let’s apply some Tessellation to the already existing rough stone texture I have in the game scene. The first thing that needs to be done is to change the Shader on the Material from HDRP/Lit to HDRP/Lit Tessellation.
Next the Displacement Mode needs to be set to Tessellation Displacement.
Under Surface Inputs, I crank up the Amplitude to really show what’s happening here.
The higher amplitude really gives the ground some depth. Unlike Pixel Displacement, Tessellation really changes the actual base mesh!
The highlighted edges really show how displaced the flat plane mesh has become.
Turning on the Selection Wire visibility under Gizmos, shows the vertices composing the floor.
You can see how the Tessellation really adds a lot of polygons to the otherwise flat ground plane, so be careful about when and where to use this. Too much Tessellation throughout a game could become costly on a processor, so be thoughtful about where you really need that extra detail and realism.
Here is an extreme example of pushing the amplitude with the Selection Wire visible.
The floor plane tends to dip down on the low spots, so the Base slider can be reduced to bring the overall floor level back up.
Looks warm and sunny out there.
Now that the rough stone has some Tessellation going on, let’s replace it with the Cobblestone material from Poliigon. In the Assets folder, I create a new Material and name it Cobblestone.
The Shader is set to the HDRP/Lit Tessellation option.
The Displacement Mode is set to Tessellation Displacement.
There are three color options to choose from as for the Albedo, so I choose and assign the second color option to the Base Map.
Even though this floor texture is not yet done, I go ahead and assign it to the plane object by dragging and dropping it from the Assets folder directly on to the object in the scene view.
The Normal Map is dragged into the Inspector to assign it.
There is already some additional depth happening to these stones.
There is a Displacement Map that I drag into the Height Map assignment box.
The Color of the Base Map is changed in the Albedo channel to be a softer grey.
That was a little dark for my taste, but you can see the big changes that occur with a small adjustment to the color.
I turn up the Max value in the Parametrizatior option to get some more depth out of the cobblestone.
You can see the surface mesh changing as the Max option is increased.
Here is an even more extreme example.
The Tessellation Factor controls the strength of the tessellation effect. The higher the value, the greater the effect. The PS4 and Xbox both can handle a max tessellation value of 15, so let’s crank this up to max!
As the tessellation factor increases, you can see the floor become grainier with more detail and resolution.
I hope you enjoyed this article on tessellation, and please join me next time when I talk about using Decals in your game scene. Thanks for reading!