my terrain is really choppy :(

Started by
7 comments, last by Nibbles 23 years, 1 month ago
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
Advertisement
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.

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
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.
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;
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
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.

(one of the put-hand-on-head-cause-some-hours-of-debugging-were-spend-problems )


greetings

Bastian
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."
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( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.

This topic is closed to new replies.

Advertisement