[TEST] Hardware Tessellation on Radeon in OpenGL (Part 2/2)



GPU Tessellation on Radeon

AMD Tessellation Demo OpenGL - GeeXLab
Continuous tessellation – factor=15.0


This article is the second part of Hardware Tessellation on Radeon in OpenGL. The first part can be found HERE.


Update (2010.02.10): AMD provided me some important details about tessellation on Radeon. You can read these details HERE.



Tessellation on Radeon – Practice

I added the functionalities brought by GL_AMD_vertex_shader_tessellator in GeeXLab (in version 0.1.15) and coded a small demo that uses the shader given in the extension specification.

You can download the demo here
Download GXL - AMD Tessellation Version 1.0

Just drop the demo in GeeXLab 0.1.15+. That’s all.




The demo is rather simple: a mesh plane is rendered (with VBO) in wireframe in order to see the impact of tessellation.

Here is the code of the shader used to render the mesh plane

[Vertex_Shader]
#extension GL_AMD_vertex_shader_tessellator : require
varying vec4 color;
__samplerVertexAMD VertexPosition; // 0
__samplerVertexAMD VertexColor; // 1
void main()
{
  vec4 gVertex = vec4(0.0);
  vec4 gColor = vec4(0.0);
  for (int i=0; i<3; i++)
  {
    float weight = gl_BarycentricCoord[i];
    gVertex += weight * 
         vertexFetchAMD(VertexPosition, gl_VertexTriangleIndex[i]);
    
    gColor += weight * 
         vertexFetchAMD(VertexColor, gl_VertexTriangleIndex[i]);
  }
  gl_Vertex = gVertex;
  color = gColor;
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;	
}
[Pixel_Shader]
varying vec4 color;
void main (void)
{
  //gl_FragColor = color;			
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);			
}

This code works fine except the fetching of vertex color. Only the vertex position can be fetched. Color or normal fetching always returns the vector vec4(0.0, 0.0, 0.0, 0.0). A bug in GeeXLab? Maybe but after after many tests, I decided to download AMD's Catmull Clark Subdivision demo. It's an OpenGL demo that uses the tessellator. And same result: the color attribute can't be fetched.

So currently with Catalyst 10.1 only the vertex position can be fetched.

I tested the demo on a Radeon HD 5770. The Radeon HD 5770 is a DX11 card and I thought: cool I can increase the tessellation factor up to 64.0. Result: the max factor is 15.0.

Conclusion: the tessellation amplication factor depends on the API used even if you have a DX11 hardware. For DX9, DX10 and OpenGL 2, the tessellation factor
is limited to 15.0. In Direct3D 11 the factor can be increased up to 64.0. And in OpenGL 3.0 ? I don't know yet. I have to code a small demo in GPU Caps Viewer for that. But I'll do it when all vertex attributes can be fetched.

The previous conclusion is valid at the time of the article writing. Maybe in a next release of Catalyst, AMD will allow a X64-tessellation factor for Radeon HD 5000 series.

Here are some screenshots forvarious tessellation factors:

Discrete tessellation mode

AMD Tessellation Demo OpenGL - GeeXLab
No tessellation

AMD Tessellation Demo OpenGL - GeeXLab
Tessellation - factor=1.0

AMD Tessellation Demo OpenGL - GeeXLab
Tessellation - factor=2.0

AMD Tessellation Demo OpenGL - GeeXLab
Tessellation - factor=5.0

AMD Tessellation Demo OpenGL - GeeXLab
Tessellation - factor=10.0

AMD Tessellation Demo OpenGL - GeeXLab
Tessellation - factor=15.0


Continuous tessellation mode

AMD Tessellation Demo OpenGL - GeeXLab
Continuous tessellation - factor=1.0

AMD Tessellation Demo OpenGL - GeeXLab
Continuous tessellation - factor=1.2

AMD Tessellation Demo OpenGL - GeeXLab
Continuous tessellation - factor=1.8

AMD Tessellation Demo OpenGL - GeeXLab
Continuous tessellation - factor=4.5

AMD Tessellation Demo OpenGL - GeeXLab
Continuous tessellation - factor=15.0

These examples show us one limitation: to get a highly tessellated mesh, the coarse mesh (also called control cage or superprimitive mesh) must have enough polygons to generate the desired high-resolution mesh.

As soon as the fetching of all vertex attributes is okay, I'll code a displacement mapping demo with real time tessellation....





[ Subscribe to Geeks3D latest news by email ]

Geeks3D.com

↑ Grab this Headline Animator