terrain rendering
hi,
i would like to get some suggestions regarding terrain rendering.
i am working on rendering a huge terrain from a file. the size of the file is 2.99mb.
using opengl when i render it, the terrain is rendered on a small area whereas the actual terrain is of the size 16X16km. but on my pc window it is limited to small size only.
how do i render it to a large area? is it possible by using LOD??
expecting a quick reply..
Just rasie the scale factor. You might want to update your front/back clipping plane, if you encounter weird visual animalies (shimmering) or the triangles start to disappear in front of you.
Or just update your camera to go closer - the end effect is esentially the same ;-)
Or just update your camera to go closer - the end effect is esentially the same ;-)
when i navigate thru the terrain i am able to do it only to a small extent after a short distance the terrain ends. but i want it to be rendered on a large area.
what i get now is that the whole terrain has been limited to a smaller area.
what i get now is that the whole terrain has been limited to a smaller area.
but i am not doing any clipping as of now.
i am just reading the height map and using Opengl rendering it.
thanks
i am just reading the height map and using Opengl rendering it.
thanks
Quote:but i am not doing any clipping as of now.
Actually yes you are, if you're using a non-orthogonal projection
Quote:what is the scale factor? i am using .rst file to read the height map
The "scale factor" is just a multiplier for your x and z coordinates. A value like this is known as a scalar, hence the use of scale factor terminology. Instead of your first terrain point from the origin being at unit (1.0, 0, 0), with a scalar of 5.0 it would be at (5.0, 0, 0), so your terrain is now 5x "bigger" (with 5x less precision).
You must decide what a "unit" in world-space will represent (1 inch, 1 foot, 1 meter, etc.) and then scale everything accordingly. This scalar has to be paired with a meaningful perspective, so you will have to choose a near and far clipping plane distance accordingly.
can i post a small part of my code which loads and displays the heightmap..
then maybe you can suggest where i am going wrong..
thanks
then maybe you can suggest where i am going wrong..
thanks
Dude, it seems your trying to tackle something without enough information.
All GPU's do clipping. Right now its being clipped, you just dont know it. Are you using gluPerspective or glOrtho, glFrustum?, In these functions, they have a near and far plane. If after like 2m in front of your camera its cutting off, then make your far plane farther.
Scale factor means scale it bigger. You can use glScalef().
Of course I'm assuming this is the problem. Pictures help.
All GPU's do clipping. Right now its being clipped, you just dont know it. Are you using gluPerspective or glOrtho, glFrustum?, In these functions, they have a near and far plane. If after like 2m in front of your camera its cutting off, then make your far plane farther.
Scale factor means scale it bigger. You can use glScalef().
Of course I'm assuming this is the problem. Pictures help.
thanks for your help and patience.
yes i am using
gluPerspective (100, (GLfloat)w / (GLfloat)h, 0.01, 500.0);
void DisplayHeightMap (void) {
int Height;
int numtri=0;
for (mapX = 1; mapX < MapWidth; mapX +=4){
for (mapZ = 1; mapZ < MapHeight*4; mapZ+=4){
numtri++;
glBegin(GL_TRIANGLE_STRIP);
Height = HeightMap[mapX][mapZ];
glTexCoord2f(0,0);
glVertex3f(float(mapX),Height,float(mapZ));
Height = HeightMap[mapX][mapZ+4];
glTexCoord2f(0,1);
glVertex3f(float(mapX),Height,float(mapZ+4));
Height = HeightMap[mapX+4][mapZ];
glTexCoord2f(1,0);
glVertex3f(float(mapX+4),Height,float(mapZ));
Height = HeightMap[mapX+4][mapZ+4];
glTexCoord2f(1,1);
glVertex3f(float(mapX+4),Height,float(mapZ+4));
glEnd();
}
}
}
can u tell me how to upload the snapshot of my terrain??
yes i am using
gluPerspective (100, (GLfloat)w / (GLfloat)h, 0.01, 500.0);
void DisplayHeightMap (void) {
int Height;
int numtri=0;
for (mapX = 1; mapX < MapWidth; mapX +=4){
for (mapZ = 1; mapZ < MapHeight*4; mapZ+=4){
numtri++;
glBegin(GL_TRIANGLE_STRIP);
Height = HeightMap[mapX][mapZ];
glTexCoord2f(0,0);
glVertex3f(float(mapX),Height,float(mapZ));
Height = HeightMap[mapX][mapZ+4];
glTexCoord2f(0,1);
glVertex3f(float(mapX),Height,float(mapZ+4));
Height = HeightMap[mapX+4][mapZ];
glTexCoord2f(1,0);
glVertex3f(float(mapX+4),Height,float(mapZ));
Height = HeightMap[mapX+4][mapZ+4];
glTexCoord2f(1,1);
glVertex3f(float(mapX+4),Height,float(mapZ+4));
glEnd();
}
}
}
can u tell me how to upload the snapshot of my terrain??
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement