title: DirectX Large Plane Tessellation
body: <p>Just a question about DirectX11 Tessellation.</p>
  
  <p>In the Hull Shader, the maximum tessellation factor that can be set is 64 (Not sure why). Now whilst this enough for small planes, when it comes to large planes, it simply is not enough and so I was wondering how I could render large planes?</p>
  
  <p>The following code generates my quad where <code>R</code> is the radius:</p>
  
  <pre><code>vertices[0] = D3DXVECTOR3(-R, 0.0f,  R); //Top left
  vertices[1] = D3DXVECTOR3( R, 0.0f,  R); //Top right
  vertices[2] = D3DXVECTOR3( R, 0.0f, -R); //Bottom right
  vertices[3] = D3DXVECTOR3(-R, 0.0f, -R); //Bottom left
  vertices[4] = D3DXVECTOR3(-R, 0.0f,  R); //Top left
  vertices[5] = D3DXVECTOR3( R, 0.0f, -R); //Bottom right
  
  indices[0] = 0;
  indices[1] = 1;
  indices[2] = 2;
  indices[3] = 3;
  indices[4] = 4;
  indices[5] = 5;
  </code></pre>
  
  <p>I did modify this by putting it in a loop to generate multiple quads say in a 3x3 grid. However when I passed it to the tessellation shader, it works okay for the first quad but others screw up.</p>
  
  <pre><code>vector&lt;D3DXVECTOR3&gt; verts;
  vector&lt;D3DXVECTOR2&gt; tex;
  
  float R = 1000;
  
  for(int z = 0; z &lt; 4; z++)
  {
      for(int x = 0; x &lt; 4; x++)
      {
          float xOffset = x * (2*R);
          float zOffset = z * (2*R);
  
          // Load the vertex array with data.
          verts.push_back( D3DXVECTOR3(-R+ xOffset, 0.0f,  R+ zOffset) ); //Top left
          verts.push_back( D3DXVECTOR3( R+ xOffset, 0.0f,  R+ zOffset) ); //Top right
          verts.push_back( D3DXVECTOR3( R+ xOffset, 0.0f, -R+ zOffset) ); //Bottom right
          verts.push_back( D3DXVECTOR3(-R+ xOffset, 0.0f, -R+ zOffset) ); //Bottom left
          verts.push_back( D3DXVECTOR3(-R+ xOffset, 0.0f,  R+ zOffset) ); //Top left
          verts.push_back( D3DXVECTOR3( R+ xOffset, 0.0f, -R+ zOffset) ); //Bottom right
  
          tex.push_back( D3DXVECTOR2(0.0f, 0.0f) );
          tex.push_back( D3DXVECTOR2(1.0f, 0.0f) );
          tex.push_back( D3DXVECTOR2(0.0f, 1.0f) );
          tex.push_back( D3DXVECTOR2(0.0f, 1.0f) );
          tex.push_back( D3DXVECTOR2(1.0f, 0.0f) );
          tex.push_back( D3DXVECTOR2(1.0f, 1.0f) );
      }
  }
  
  // Set the number of vertices in the vertex array.
  m_vertexCount = verts.size();
  
  // Set the number of indices in the index array.
  m_indexCount = verts.size();
  
  // Create the vertex array.
  vertices = new VertexType[m_vertexCount];
  if(!vertices)
  {
      return false;
  }
  
  // Create the index array.
  indices = new unsigned long[m_indexCount];
  if(!indices)
  {
      return false;
  }
  
  for(int i = 0; i &lt; m_vertexCount; i++)
  {
      vertices[i].position = verts[i];
      vertices[i].texture =  tex[i];
      indices[i] = i;
  }
  </code></pre>
  
  <p>This is how it looks when I render the looped plane:
  <img src="https://i.stack.imgur.com/nJBDZ.png" alt=""></p>
  
  <p>How come it doesn't tessellate properly when using multiple quads? 
  Should I solve this by creating a loop in my graphics class where I then translate and render the same quad over and over to create a grid?</p>
  
  <p>Hope this makes sense.</p>