I know...but I'm using phong shading not gouraud which really doesn't change much. I am renormalizing the normals or I'm telling Direct3D to do it...but I'm still getting the flickery crap.
I will implement a pixel shader or vertex shader very soon in HLSL...but not quite yet.
Voxels are what got me starting doing terrains and yes I've coded several and I have one in DirectX except that I changed something and now I don't have any height in it. I optimized it so much that I...optimized myself out of the code. I'm totally lost when I look at it. Shame, shame Bubba, I know.
The heightmap is 256x256 and the cellsize for those shots I think is about 10. The tile screenshot is using a cellsize of 4 and a texture increment the same size as the texture which causes it to tile nicely and yet gives a lot of detail up close. I can't tile the terrain texture because it is not tileable and looks ugly when it is done. The clouds are not going to stay there and I've changed the bitmap since those shots because that one sucks. You can clearly see the grid in the sky. Not anymore. Also using 2 alpha blended cloud layers so I can simulate some pretty cool stuff. The sun glare is simply going to be a pure white quad the size of the screen alpha blended depending on the sun's position (alpha coeficient is derived from sun's position). This will cause a white out. Cheesy but it works. Also I'm looking at some docs concerning real-time volumetric fog - might use this for the clouds...but major framerate hit for this.
BTW if anyone wants to help with models contact me. I do not have a 3D modeling program so I'm SOL right now. Also I rather suck at creating textures so I need some artists. Any help would be greatly appreciated. I'm a programmer and therefore I suck at art.
By the way the blockiness you are talking about comes from the fact that the map has a definite resolution and you are attempting to project a map on the screen that has more resolution than your map.
There are several things you can do.
First you need to select a cellsize for your world and a magnification factor. Larger cellsizes produce smoother terrain because the changes are not so abrupt but you will get flatter land unless you up the magnification factor. If its too high...same problem. Small cellsizes work well except that you must reduce the mag factor by a lot or you will have some very spikey terrain. Cellsize should be larger than 3. Any less and you effectively eliminate the magnification effect on the terrain. You will get nearly an exact representation of the heightmap on screen....which is blocky.
So here are things to remember:
1. Too blocky -> increase cellsize
2. Too flat -> increase magnification
Also you must change the walking speed of the player relative to your cellsize. Larger cellsizes will require bigger 'steps' or you will feel like you are crawling. Smaller cellsizes require smaller steps or you will feel like you are zipping across the terrain at light speed and it gives your terrain a very 'small cramped' feeling.
Here is some basic code to get you started:
And a simple average filter.
for (int worldx=0;worldx<maxworldx;worldx+=cellsize)
for (int worldz=0;worldz<maxworldz;worldz+=cellsize)
Can also be done with a matrix....but easier to show this. You can also linear interpolate:
for (int i=0;i<numRows;i++)
for (int j=0;i<numCols;j++)
if (neg_j<1) neg_j+=(numCols-1);
if (pos_j>numCols) pos_j-=(numCols-1);
if (neg_i<1) neg_i+=(numRows-1);
if (pos_i>numRows) pos_i-=(numRows-1);
where f1 varies from 0 to 1.
or bi-linear interpolate:
where f1 and f2 vary from 0 to 1.