https://catlikecoding.com/unity/tutorials/advanced-rendering/tessellation/
1 hulls and domains 啥意思???
tessellation is the art of cutting things into smaller parts. in our case, we are going to subdivide triangles so we end up with smaller triangles that cover the same space. this makes it possible to add more details to geometry, though in this tutorial we will focus on the tessellation process itself.
the gpu is capable of splitting up triangles fed to it for rendering. it does this for various reasons, for example when part of a triangle ends up clipped. we can not control that, but there is also a tessellation stage that we are allowed to configure. this stage sits in between the vertex and the fragment shader stages. but it is not as simple as adding just one other program to our shader. we are going to need a hull program and domain program. 一个壳,一个域
1.1 creating a tessellation shader
the first step is to create a shader that has tessellation enabled. let us put the code that we will need in its own file, MyTessellation.cginc, with its own include guard.
#if !defined(TESSELLATION_INCLUDED)
#define TESSELLATION_INCLUDED
#endif
to clearly see that triangles get subdivided, we will make use of flag wireframe shader. duplicate that shader, rename it to tessellation shader and adjust it’s menu name.
Shader "Custom/Tessellation" { … }
the minimum shader target level when using tessellation is 4.6. if we do not set this manually, unity will issue a warning and automatically use that level. we are going to add tessellation stages to the forward base and additive pass, plus the deferred pass. also include MyTessellation in those passes, after MyFlatWireframe.
#pragma target 4.6
…
#include "MyFlatWireframe.cginc"
#include "MyTessellation.cginc"
creates a material that relies on this shader and add a quad to the scene that uses it. i made the material gray so it is not too bright, like the flat wireframe material.
we use this quad to test our tessellation shader. note that is consists of two isosceles right triangles. the short edges have length 1, while the long diagonal edges have length sqr(2).