# What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity]

I came across the following declaration on unity tutorial

#pragma surface surf BlinnPhong addshadow fullforwardshadows
vertex:disp tessellate:tessEdge nolightmap


I think disp is the displacement shader but what does vertex:disp mean? Likewise for tesselate:tessEdge.

Thanks. I am rather new to HLSL.

• if you don't use it your vertex function not work any way. – Seyed Morteza Kamali Nov 4 '18 at 6:43
• @SeyedMortezaKamali. What do you mean by vertex function? You mean vertex shader? – Chuanyuan Liu Nov 4 '18 at 9:43

It is possible to use a “vertex modifier” function that will modify the incoming vertex data in the vertex Shader. This can be used for things like procedural animation and extrusion along normals. Surface Shader compilation directive vertex:functionName is used for that, with a function that takes inout appdata_full parameter.

your vertex modifier function named disp.

so vertex:disp mean that your vertex will use disp:

void disp (inout appdata v)
{
float d = tex2Dlod(_DispTex, float4(v.texcoord.xy,0,0)).r * _Displacement;
v.vertex.xyz += v.normal * d;
}


DX11 Tessellation

This controls how many subdivisions you want to split your triangles into. (Note that DirectX is Windows only, requires a DX11 GPU and has to be enabled in Unity)

so tesselate:tessEdge mean that your tesselatation will use tessEdge:

float4 tessEdge (appdata_full v0, appdata_full v1, appdata_full v2)
{
return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);
}


If you want to understand tesselatation use Shading Mode > WireFrame then move around your object that has this shader:

• Thank you so much for the detailed response Seyed Morteza Kamali. – Chuanyuan Liu Nov 5 '18 at 6:54