In order to practice 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 *. 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 bezr line evaluate with a small input of control points. but it works 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 shocould 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.
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 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. andEach of them are processed independently.Saying, The two types below are the same thing.
Type1, the Italic word "Index" are used to hint the order we store the groups in.
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 shoshould take for an edge.
After that, we got the edge fact, which describes how much the edge shocould be tessellated, but problems may happen if we chose different lods for different patchs:
To solving this problem, we need only change the UV value of the point of a instance patch to suit for its edge facts:
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 shocould 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 socould 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.
Link:
Http://blog.sina.com.cn/dillyduck