Jump to content

Tessellation of quads


Rastar
 Share

Recommended Posts

I would like to tessellate quadrilateral patches. I guess this currently isn't possible because the API doesn't provide for a means to generate quads, and probably the patch parameter is hard-coded to three, as in

 

glPatchParameteri(GL_PATCH_VERTICES, 3)

?

 

Or is there a way? If not, would it be possible to extend the API to add quads (e.g. by adding Surface::AddQuad() ) and set the patch parameter accordingly?

Link to comment
Share on other sites

Well, it seems I got this working by setting

 

layout (vertices = 4) out;

 

in the control shader and

 

layout (quads) in;

 

in the evaluation shader. Wasn't aware of those functions (still new to tessellation..). On the other hand, I'm only working with a four vertex/two triangle patch right now that I am going to instance so that the patches can be frustum culled. Don't now what would happen if you start with a mesh that has more quads/polygons, since the vertex order is probably determined by the triangle indices?

 

EDIT: Nah, this doesn't work. Of course, it only controls the patch size handed to the evaluation shader (which can be different to the input patch size). Also, the glTessCoord are barycentric with respect to that patch.

 

So back to square zero: Is there a way to submit patches of four to the shaders?

Link to comment
Share on other sites

This tessellation stuff is really interesting. The screenshot below was done using a simple heightmap+normalmap+colormap from World Machine and a modified version of the tessellation_example material (and of course shadmar's skybox!) applied to a scaled plane of 32x32 tris. It doesn't look spectacular because those are simple textures, and it performs like **** because this is a single mesh with no culling and LODs (every triangle side has a tessellation factor of 256, so that's a lot of vertices!), but it shows that there's a lot of potential in it. As I wrote, I would prefer to start from quads since that's more natural for terrain patches, but with adaptive tessellation guided by viewer distance, terrain features and an optional tessellation map, this could be used to render large terrains at excellent framerates.

 

post-6662-0-33992600-1389305406_thumb.png

  • Upvote 2
Link to comment
Share on other sites

Sorry guys, even if I risk boring you with my monologue... another screenshot. The heightmap resolution is too low for the foreground (4096 applied to 8000m) and the tessellation probably not optimal, so you see jaggies there, but I really like the crisp details in the background. But enough of this, I'll now have a look into optimizing the tessellation before I bother you again rolleyes.gif

 

post-6662-0-97056600-1389308704_thumb.png

  • Upvote 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...