I am generating a terrain with Perlin noise, the terrain is generated procedurally. right now I cannot render all the outer faces of terrain, some triangles are displayed from inside the terrain. As you might have known, it's winding order problem. so How to render the outer face of triangles without disabling culling??
In another word, if I did clock wise order, some triangles will be rendered and others will disappear, for instance let's imagine a cube it has front and back faces, one of them need to be ordered in clock-wise winding order the other face will be counter clock-wise in order to render the outer or inner faces of the cube. How to determine whether I should use the clockwise or counter clock wise of the current triangle.
Note: the terrain may have caves or bridges