Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11

时间:2022-08-18 03:57:01


 

In order to practise english and share what i have learned about the instanced tessellation, i wrote this artical, just talking about the Instance tessellation pipeline, not the mathematical research about the surface soomthing.--Zxx

                           

Days buried myself in the *.cpp and *.pdf files, i finally got the idea of the Instanced tessellation, which has been implemented in the earlier days after when DX10 is released and Nvidia added a Geometry Process part to the GPU pipeline (you can also find the ppt Inst_Tess_Compatible.pdf from the NV's developer web site http://developer.nvidia.com, which is released months ago together with their GDC08 talk notes), but "geometry shader isn't for the tessellation"(reference 1)--in my understanding, it doesn't suit for the job, although it can do some small tasks like Bezier line evaluate with a small input of control points. But it works much much better while processing volume data with the matching cubics algorithm, and is also helpful in a tessellation pipeline, which will be described in detail in the following part.

I am writing this tring to make others have a clear concept of the Instanced tessellation based on my understanding, and will keep the words as simple as it can be.

 

1. What is Instanced tessellation?

Take a 4^4 or 16*16 or 32*32 or (even more...) patch with each of its grid point contains a uv value only(or point ID from zero to density*density) as a Instance, replace the original patchs in the model by this patch, and in a VS, compute what position of each grid point of the Instance patch should be by the uv coordinate and its instanceID, which is used to index its control point values already being stored in a Vertex Buffer in the prior pass.

                               

      

Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
 

 

 

 High light point:

 the only attribute the instance patch has (or saying, we need for a patch) is the uv value(or point ID) and its patch index(instance_ID), which were than transformed into the VS to index the ControlPoints. The instance_IDs are stored in an IndexBuffer and the the control points are stored in the VertexBuffer. And when you are drawing by call the InstanceDraw()function, the GPU will draw the patch repeatedly by instance_num times, in which case, a patch is considered to be an element, so as in the normal cases when we are drawing the point, each "patch" was given a index value in the Index Buffer, so that the VS can locate its control points in the VB, and each group of the control points is stored as a pair together with the index value. Be aware, the order we store the controlPoints[16] and controlNormals[16] and controlTangents[16] and also textureCoordinate[16] together with the index value pair is not a matter, as long as we are keeping the group of them in group and when we are using them, they are used by group. Because we are drawing the pre-tessellated patch as an element.And each of them are processed independently. Saying,the two types below are the same thing.

           

 

Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
  

 

Type1, the italic word "index" are used to hint the order we store the groups in.

           

 

Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
 

 

Type2, the italic word "index" are used to hint the order we store the groups in.

 

Here, all the values are called "conrolValues", because they will be used to evaluate the final value we take for the PixelShader rendering, instead of being used directly.

 

2. What a role does a Geometry Shader play in a tessellation task?

   In fact, GS play no role in the tessellation, but if we need to do the adaptively tessellation by the curvature of the surface or by the distance of the surface or the distance of a patch in the screen size (these are the research parts), we need the GS, as we are applying the same computation to each patch, why not use the parallel processing ability of GPU? And in GPU, only the GS part can do this job, which can take line-adjacency as input and based on some rules we take,computer and output the edge facts of a patch, which represent how much tessellation we should take for an edge.

                

Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
 

 

After that, we got the edge fact, which describes how much the edge should be tessellated, but problems may happen if we chose different LODs for different patchs:

             

Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
 

 

 

To solving this problem, we need only change the uv value of the point of a instance patch to suit for its edge facts:

             

Intanced Tessellation -- A new part of the GPU pipeline for surface techniques in DX10 and coming DX11
Attention:

 

Here, we are not changing the vertex position or the connecting relationship between neigboring vertexs, we are just changing the uv value. Take the edge whose fact=2 as an example, there were 4 uv value in the edge, but as its fact=2, the midright uv value which once was (0,3) is modified to be (0,4), we keep the mid one as it was, and modify the midleft one to be (0,0), as a matter of fact, we drawed 4*4*2 triangles after VS processed this instance, but some of their vertexs are evaluated to be at the same point. I use "evaluated to be" here to remind you that we are modifying the uv value first and then evaluate the position by the evaluate function, as the control points are the same, then, the evaluating equation should be same, then, the same uv value will get the same position value.

 

Why not we first evaluate the position, then modify the position?

Surly we cannot do this, consider the VS's function,  we can evaluate the position value, but how can we chang it to another one which the VS does not know? But when dealing with uv, we are sure "to what value it sould be modified", so that we can modify it.

 

 

3. Can GS take a line_strip_adjacency representing a patch as input, then compute and output the control mesh by some algorithsm?

   I think the GS can do this, as long as the algorithm is a local algorithm, which need to only take one triangular information and out put a control mesh. Like PN triangle algorithm, is such an example. And maybe some of the approximated catmull-clark subdivision algorithm develoed by Loop.

 

 

 

After when you have read this note, you will Know the pipeline most of the CG researchers are using when building up a Instanced tessellation project. But you get nothing with the DX10's feature and how to implement that in a DX10, and nothing with how to apply surface techniques while evaluating, all of the topics requires more reading.

                                                                                                                            

 

Reference

[1] Instanced Tesselation in DX10. Nv. Co. .

[2] Siggraph 2007 course Introduction to DirectX10. Microsoft Corp, Microsoft game stdio, Crytek, LucasArts, Relic Entertainment.


挂个友链: