As part of my terrain streaming system, I page heightmap detail levels into a larger texture using the same method I use for the normal- and splat-map datasets, which both seem to work perfectly fine. However, the heightmap data seems to substitute in with visible artifacts, and also seems to insert or remove an additional pixel for every three in the substitution. This results in the page being unusable and skewed by about a third.
Now, I'm suspicious that it has to do with the unorthodox internal format of the texture; it is a single component, 16-bit texture (GL_RED, GL_R16, GL_UNSIGNED_SHORT). The other two datasets use relatively normal formats (GL_RGB8 for normals, and GL_RGBA8 for splat-values), and so that would explain the problem only appearing in the height data. I've double-checked my code, and I'm very positive that this is not a problem with the data or the substitution routines.
I am currently using Intel HD 4000 integrated graphics on a Linux system with Mesa drivers, both of which I realize could cause problems for me. This is still a dilemma if this is the root of the problem, because I'd like to be able to support Intel HD 4000 graphics for my game. I've been thinking that, worse case scenario, I can create a "normal" format texture (GL_RGB8) and simply use both R and G for my 16-bit height values, ignoring the B component. I'm just wondering if anybody has experienced this and/or has found a simple fix that I've been overlooking?
Here are some visual examples of this problem, taken directly from the textures themselves:
[attachment=28317:02.png]
A simple checkerboard dataset, which shows the 1/3 "skewing" effect, as well as some artifacts throughout. There was no size mismatch in the data during the substitution, which I suspected could be the cause of the misalignment at first.
[attachment=28318:01.png]
The actual height test dataset, which is a simple cosine 3D surface (better seen in the following image). The data should look more or less like the next image, but instead is skewed, and has a strange triangular artifact. I have no idea where this might be originating from. The data looks fine when I plot it using other software.
[attachment=28316:03.png]
This is the test splatmap, which looks great. I'm not handling this any differently besides the obvious different formatting, etc.