PDA

View Full Version : flat shading



heppe
12-03-2003, 11:27 PM
what is the best way to do flat shading?

It may sound simple, but consider that tristrips may reference vertices more than once, each time taking its normal from a different associated face. That would seem to exclude glDrawElements with tristrips.

Should we go strip-ordered triangles, or do something crazy like write a vertex program to take normal indices from something other than the indices for vertex positions?

What primitive will best leverage the post-T&L cache?

yeilam
12-04-2003, 05:43 AM
We render heavy scenes in flat shading (urban scenes - houses rarely have smooth geometry).
We cannot use stripes, as you wrote. We draw triangles with index buffer over vertex buffer. Vertices are different even if they have the same positions, but have different normals (we unite vertices if less than 1 degree deviation of their normal vectors).
Still vertices are mutual to some faces (like few faces on the same plane). There, instead of stripes we order the faces so that a vertex accesses are adjacent so its geometry calculation is still cashed. We get quite good results.