#### Archived

This topic is now archived and is closed to further replies.

# my terrain is really choppy :(

This topic is 6781 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hi, as you can see in the screenshot below, my terrain is very rough. I've tried a few things to make smoother hills, like rolling hills, but without success. can anyone shed some light on this? or just give me some algorithm names to look up that deals with this sort of thing? thanks, Scott
"If you try and don't succeed, destroy all evidence that you tried." Edited by - wojtos on March 20, 2001 10:51:25 PM

##### Share on other sites
It doesn''t look like you''re calculating vertex normals, that will help a lot. Just do a search on this board for them, you''ll find heaps.

##### Share on other sites

below is where i draw the triangs strips that make up my terrain, now calling glNormal3f i would assume only finds the normal for the first triangle.. but what happens if the 2nd triangle is on a different plane? could that be the problem in my case?

  glBegin(GL_TRIANGLE_STRIP); glNormal3f(x, -y, z); glTexCoord2f(0.0f, 1.0f); glVertex3f(p[i].x, p[i].y, p[i].z); glTexCoord2f(1.0f, 1.0f); glVertex3f(p[i+size].x, p[i+size].y, p[i+size].z); glTexCoord2f(1.0f, 0.0f); glVertex3f(p[i+1].x, p[i+1].y, p[i+1].z); glTexCoord2f(0.0f, 0.0f); glVertex3f(p[i+size+1].x, p[i+size+1].y, p[i+size+1].z);glEnd();

"If you try and don't succeed, destroy all evidence that you tried."

Edited by - wojtos on March 20, 2001 12:12:49 AM

##### Share on other sites
You calculate 1 normal per face. Hence this blocky style! Don''t forget that lighting model use normals for interpolate shading. You should calculate 1 normal per vertex in order to have smooth shading hills.

##### Share on other sites
find all faces that share the same vertex, add their plane normals together and then divide it with num faces, and you''ll have the vertex normal. make sure your planenormals are normalized though.

return 1;

##### Share on other sites
also it looks like your hills geometry is pretty blocky. use a paint program to draw a greyscale texture with a few white spots for hills, do a blur. then load that in as a heightmap

http://members.xoom.com/myBollux

##### Share on other sites
Hi!

Also check, that if you use integer-values and convert them to float and do further calculations (for glVertex3f p.ex.) first do:

int ix,iy,iz;

float fx=(float)ix;
float k=fx/22;

I had the same problem with my terrain. It was solved by doing FIRST a typecast and then other calculations.

greetings

Bastian

##### Share on other sites
well, i figured i''m going to try it using a height map instead, but on the otherhand, i did manage to fix my normals.. it does look a lot nicer, but still pretty rough.

"If you try and don''t succeed, destroy all evidence that you tried."

##### Share on other sites
Yeah, the real problem is that the geometry is simply too crude. In fact, when developing a terrain engine, you should put it on wireframe mode and disable lighting for testing purposes. That would make it more obvious what the problem is.

There are two ways to increase the resolution of your geometry:

1) Make the heightmap a larger bitmap so you can use finer detail
2) Interpolate between the slopes of adjacent triangles or quadtree nodes, to blend them

The first option is much simpler and easier to do. The second is more advanced and is basically something to do last as an extra improvement.

~CGameProgrammer( );

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 14
• 30
• 9
• 16
• 12