Tessellation.shader
This is the front-facing shader file that defines properties and sets up the tessellation system.
It adds two new material properties for tessellation control:
Uniform tessellation: subdivides triangles evenly.
Edge-length tessellation: adapts subdivision based on screen-space edge length (closer = more subdivisions).
It defines: #define VERTEX_DISPLACEMENT_INSTEAD_OF_PARALLAX
This switches the material from parallax mapping (texture trick) to real geometric displacement (vertices actually move) when tessellation subdivides the mesh.
Inside the shader passes, it includes the tessellation code from the .cginc file, which handles the heavy lifting.
Tessellation.cginc
This file implements the tessellation pipeline.
Data Structures
TessellationControlPoint: the data passed from the mesh’s original vertices into tessellation (position, normal, tangent, UVs, etc.).
TessellationFactors: contains tessellation levels (edge[3] and inside) for a triangle.
Vertex program
MyTessellationVertexProgram copies per-vertex data into a TessellationControlPoint used in tessellation stages.
Culling helpers
Functions like TriangleIsBelowClipPlane and TriangleIsCulled check whether a tessellated triangle falls outside the camera’s clip planes (to avoid unnecessary work).
Summary of the whole system:
The .shader file defines material properties and switches displacement to be true geometric via tessellation.
The .cginc file provides the tessellation logic:
How much to tessellate (uniform vs. adaptive edge length).
How to pass vertex data into tessellation.
Optional culling to avoid wasted tessellation.
Combined, they allow your mesh to be subdivided on the GPU and then displaced for real 3D surface detail (instead of just faking depth with parallax).