Per fragment lighting with OpenGL 4.x tessellated model
Posted
by
Finlaybob
on Game Development
See other posts from Game Development
or by Finlaybob
Published on 2012-11-27T19:40:21Z
Indexed on
2012/11/27
23:32 UTC
Read the original article
Hit count: 220
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.
© Game Development or respective owner