I’ve done my best to implement the code Dans gave me in my previous post, but with mixed results. It gets me in the ballpark but it’s chopping like mad on me. The transitions are not smooth between tris.

void getFaceNormal(int x, int y, float n[3])

{

float v1[3], v2[3], v3[3], v4[3];

float p1[3], p2[3];

float s=(float)step;

v1[0]=0.0f; v1[1]=0.0f; v1[2]=getMapZ(x,y);

v2[0]=0.0f; v2[1]=-s; v2[2]=getMapZ(x,y+1);

v3[0]=s; v3[1]=0.0f; v3[2]=getMapZ(x+1,y);

v4[0]=s; v4[1]=-s; v4[2]=getMapZ(x+1,y+1);

if (cam.y>=cam.x)

{

subtractvect(v1,v2,p1);

subtractvect(v2,v3,p2);

normcrossprod(p1,p2,n);

return;

}

subtractvect(v2,v3,p1);

subtractvect(v3,v4,p2);

normcrossprod(p1,p2,n);

return;

}

float getCamZ(void)

{

int mx=(int)mapX,

my=(int)mapY;

float n[3], p[3];

float c;

getFaceNormal(mx,my,n);

p[0]=0.0f;

p[1]=-(float)step;

p[2]=getMapZ(mx,my+1);

c=(n[1]*p[1] + n[2]*p[2]);

return (c - n[0]*cam.x - n[1]*cam.y) / n[2];

}

Basically I just get the face normal (somebody plz let me know if I’m doing that part wrong) and then find ‘c’ using the lower left point of each map square (which is common to both cells in that square), and finally calculate the height.

The result? My z values “jump” when I cross cell boundaries. At least, that’s what it looks like.

www.knology.net/~heaven/files/engine2.zip

if you want to see what I’m talking about.

Thanks for any help,

Heaven