Per fragment lighting with OpenGL 4.x tessellated model
- by Finlaybob
I'm experienced with OpenGL 3+. I'm dabbling with tessellation shaders and have now got to a point where I have a nicely tessellated teapot/plane demo (quick look here)
As can be seen from the screenshots, the lighting is broken (though admittedly doesn't look too bad in the image)
I've tried to add a normal map to the equation but it still doesn't come out right, I can calculate the normals, tangents and binormals per triangle in the geometry shader but still looks wrong.
I think the question would be; How do I add per fragment lighting to a tessellated model?
The teapot is 32 16-point patches, the plane is one single 16 point patch.
The shaders are here, but they are a complete mess, so I don't blame anyone who cant make sense of them. But peruse at your leisure if you like.
Also, if this question is more suited to be somewhere else i.e. Stack Overflow or the Programming stack please let me know.