Quad Subdivision - Gameslinx/Tessellation GitHub Wiki

Quad Subdivision

In KSP, the terrain does not have enough vertices for tessellation to look good. We need a vertex density high enough before we tessellate it using the shader. In a shader, a triangle can only be tessellated up to 64 times. To achieve this level of detail, the terrain needs subdividing.

Example

Here is an example taken from the Parallax Stock Textures pack which subdivides Kerbin's terrain.

@Kopernicus:FOR[ParallaxStock]
{
	@Body[Kerbin]
	{
		%PQS
		{
			%Mods
			{
				Subdivide
				{
					subdivisionLevel = 2              //Range 1 to 5
					advancedSubdivisionLevel = 32     //Range 1 to 64
					order = 999999                    //Constant
					//overrideDistLimit = true        //Allow range override
					//customDistLimit = 1100          //Range at which quads are subdivided     
				}
			}
		}
	}
}

This acts on individual terrain quads in an area around the craft. Only nearby quads are subdivided. The maximum subdivision level is 5. If you still don't have the level of detail that you require, you can increase the advancedSubdivisionLevel.

Advanced Subdivision

Advanced subdivision was introduced in update 1.3.0 and is the core feature powering Parallax.

How it works

Advanced Subdivision is a component that is added to the terrain quads after their initial subdivision takes place. It works by iterating through each vertex and selecting a square made up of 16 vertices around the craft. These vertices are then subdivided by the advancedSubdivisionLevel to increase the level of detail even more.

Advanced Subdivision compared with just Subdivision

Performance

Be mindful of how much you are subdividing. We don't need ungodly amounts of tessellation - this will put a big load on the GPU. If you increase the subdivisionLevel too high (4 - 5), the framerate will begin to dip due to AdvancedSubdivision having to process all of those vertices.

If the terrain is still not detailed enough (this applies for large planets only), you can increase the PQS maxLevel in your planet's config before you try subdividing.