Jan 13

The most boring screenshot ever

Tag: Full Games,MMORPG Tycoontrevor @ 11:20 pm

I’m amazingly thrilled to have gotten this working, but unfortunately it’s a very boring screenshot.  If you consult the past few screenshots and videos, you may notice some very visible seams between squares of terrain (though I mostly tried to avoid showing them, when I could).  These were caused by mismatched vertex normals between the patches of terrain.

In computer graphics, a vertex normal basically tells the renderer which direction a point on a surface faces;  it’s used in lighting calculations to figure out how much light falls onto that position.  Worse, since I’m also generating the terrain colour in part based upon the slope of the ground, the normal can also change the brightness, hue, or saturation of the terrain, making the seams even more visible.

Since I’m generating these normals procedurally based upon nearby heights in the terrain, and each patch of terrain doesn’t know about the other nearby terrain, it ended up with mismatching normals along the edges of each patch.

To fix it, I’ve extended each patch by one vertex in each direction.  Those outside-most triangles never get drawn, but having each patch calculate them means that the patches will always agree on the normals along their edges.  I’m still nervous that there might be some corner cases that I haven’t thought of, but so far it seems to work pretty well!

In the screenshot above, I have only four patches of terrain being drawn (in previous shots, I’ve had between 40 and 80 visible;  having so many fewer makes it much easier to find the patch seams!).  My cursor is pointing to the middle point, where all four patches meet, to point out the lack of seam.

This change was actually quite tricky;  lots of stuff was relying on the number of vertices in the terrain matching its visible width and depth.  It’s kind of distressing how unimpressive the results of this tricky change.  With luck, next time I should have something more interesting than this mere bugfix, tricky as it may have been.  :)

2 Responses to “The most boring screenshot ever”

  1. Dan Haraj says:

    This reminds me of a story I once read about a development team that celebrated when they managed to render a single triangle to the screen. The achievement was that they had passed that triangle through their entire graphics engine and it worked correctly.

  2. trevor says:

    That’s actually a pretty common story. In fact, I had a similar celebration, the first time VectorStorm managed to draw a vector line to the screen, for precisely the same reason.

    It’s kind of sad that the most exciting milestones for programmers are completely uninteresting to everyone else.. but I imagine that that’s true in many other fields as well.