nick.ace Posted February 23, 2016 Share Posted February 23, 2016 Does anyone know how to write tesselation shaders? I looked at the example, and was able to integrate it with my custom shader, but the control and evaluation shaders from diffuse-normal-specular-tess.shader doesn't really seem to do anything. I want to be able to take a triangle and subdivide it into an arbitrary amount of triangles. There seems to be a lack of tutorials online for tesselation shaders . Quote Link to comment Share on other sites More sharing options...
Rastar Posted February 23, 2016 Share Posted February 23, 2016 Well, you can't divide a triangle into an arbitrary number of triangles, because the tessellation factors are limited (iirc factors of 64 are guarantueed, more might be available). But usually that's sufficient. A good approach often is to calculate the tessellation factors based on the screen-space size of the triangle edge. That way the tessellation automatically changes based on the distance from the camera. Here is an example http://codeflow.org/entries/2010/nov/07/opengl-4-tessellation/ The author's doing that for terrain tessellation, but the principle is the same. 1 Quote Link to comment Share on other sites More sharing options...
nick.ace Posted February 24, 2016 Author Share Posted February 24, 2016 Thanks! I found a link at the bottom of the page that explained it better. I didn't know what the outer and inner tess levels were and how they are used. I'm not interested in doing dynamic tesselation right now, but maybe I'll implement that later. Quote Link to comment Share on other sites More sharing options...
Rastar Posted February 24, 2016 Share Posted February 24, 2016 Which reminds me: Ages ago I did a couple of blog posts here a bout tessellation http://www.leadwerks.com/werkspace/blog/117/entry-1185-pass-the-tessellation-please-part-1/ http://www.leadwerks.com/werkspace/blog/117/entry-1195-pass-the-tessellation-please-part-2/ Maybe there's something helpful in there as well. 1 Quote Link to comment Share on other sites More sharing options...
nick.ace Posted February 25, 2016 Author Share Posted February 25, 2016 Thanks! Those tutorials you wrote are super helpful! I kind of wish I saw them earlier because those are some of the best tutorials I've seen on the subject. Btw, I actually got it working yesterday. I guess I thought there was more control you could have over the shaders than just the number of subdivisions you could have and how you want the subdivisions to behave (to an extent). I was able to make shattering windows because of it lol. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.