• Advertisement
Sign in to follow this  

Questions about the Hull Shader, Tessellation and Domain Shader

This topic is 1896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I'm trying to understand how the pipeline works before I go further. I reached the Tessellation part in the pipeline explanation in a book and are some things that I dont uderstand.
Here I have an example of a simple Tessellation from Rastertek website.

[source]


cbuffer TessellationBuffer
{
float tessellationAmount;
float3 padding;
};

struct HullInputType
{
float3 position : POSITION;
float4 color : COLOR;
};
struct ConstantOutputType
{
float edges[3] : SV_TessFactor;
float inside : SV_InsideTessFactor;
};
struct HullOutputType
{
float3 position : POSITION;
float4 color : COLOR;
};






////////////////////////////////////////////////////////////////////////////////
// Hull Shader
////////////////////////////////////////////////////////////////////////////////
[domain("tri")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ColorPatchConstantFunction")]
HullOutputType ColorHullShader(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
{
HullOutputType output;

// Set the position for this control point as the output position.
output.position = patch[pointId].position;
// Set the input color as the output color.
output.color = patch[pointId].color;
return output;
}






////////////////////////////////////////////////////////////////////////////////
// Patch Constant Function
////////////////////////////////////////////////////////////////////////////////
ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID)
{
ConstantOutputType output;

// Set the tessellation factors for the three edges of the triangle.
output.edges[0] = 6;
output.edges[1] = 6;
output.edges[2] = 6;
// Set the tessellation factor for tessellating inside the triangle.
output.inside = 6;
return output;
}
[/source]
I don't know If I understand correctly. The HULL SHADER actually takes vertices and transforms them in control point for patches that are actually still vertices. I mean in this example The hull shader takes 3 vertices and "transforms" them in a control patch that is actually a triangle that will be modified. So If I want specific control points that are invisible to the mesh I must integrate them in the Vertex buffer ?

So I actually I don't understand is what the control points and patches are. An triangle is submitted to the HS and the control points are the vertices and the patch is the triangle itself ? How control patches and points are separated from the triangle ?

Share this post


Link to post
Share on other sites
Advertisement
While I actually don't know much about this stuff, yesterday I found something it may be useful to you

http://fgiesen.wordpress.com/2011/07/03/a-trip-through-the-graphics-pipeline-2011-part-3/

That's an overview of the graphics pipeline. But its part of a long series of blog posts http://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/ which explain a lot of the pipeline. Its DirectX oriented. Edited by TheChubu

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement