lwjglgamedev/lwjglbook-leg

Wrong culling of terrain (chapter 15)

ArminBu opened this issue · 2 comments

I experienced an issue with the terrain being culled off from the opposite viewing direction.
The indices of the terrain are generated in clockwise rotation in HeightMapMesh.java , which is most likely causing this issue.
Changing a few lines from:

indices.add(leftTop);
indices.add(leftBottom);
indices.add(rightTop);

indices.add(rightTop);
indices.add(leftBottom);
indices.add(rightBottom);

to count-clockwise order, happens to solve the problem for me:

indices.add(rightTop);
indices.add(leftBottom);
indices.add(rightBottom);

indices.add(leftTop);
indices.add(leftBottom);
indices.add(rightTop);

Ok, it seems you're right I will fix it ASAP. Many thanks !

Fixed. Thanks !