Jump to content

  • Log In with Google      Sign In   
  • Create Account


Questions about the Hull Shader, Tessellation and Domain Shader


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Papadopol   Members   -  Reputation: 178

Like
0Likes
Like

Posted 11 November 2012 - 01:45 PM

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.






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;

}


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 ?

Sponsor:

#2 TheChubu   Crossbones+   -  Reputation: 3627

Like
0Likes
Like

Posted 11 November 2012 - 07:17 PM

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, 11 November 2012 - 07:18 PM.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS