Terrain with Lakes rendering probs

Started by
7 comments, last by fatherjohn666 21 years, 10 months ago
Just wondering about the following.... WHAT AM I TRYING TO DO? I render some terrain, then I fake rivers and lakes by using a huge quad with blending at about 5-10 points above the lowest point on the terrain, so it actually looks ok. MY PROBLEM? Why does it look all blocky and ugly when I move "blah" pixels away from it? (blah being any pixel distance past some unmeasurable distance). Up close it looks fine, the further away, the worse it looks. I know its because Im intersecting some planes, but why does it make the graphics look so ugly? Do I need to learn mipmapping? Im just a beginner!!! http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni
Advertisement
Had the SAME problem a few weeks ago while working on this:

http://dwarvenale.tripod.com/screenshots.html

Try using the following function:

void sysChangeSize(int wndWidth, int wndHeight){		wndHeight = GetSystemMetrics(SM_CYSCREEN);	//Get height of screen resolution    wndWidth = GetSystemMetrics(SM_CXSCREEN);	//Get width of screen resolution		if(wndHeight==0)			{				wndHeight = 1;			}		glViewport(0, 0, wndWidth, wndHeight);		glMatrixMode(GL_PROJECTION);		glLoadIdentity();	gluPerspective(45.0f, (GLfloat)wndWidth / (GLfloat)wndHeight, 1.0f, 1000.0f);		glMatrixMode(GL_MODELVIEW);		glLoadIdentity();} 


It''s your Z-Buffer woes man... It''s that 1.0f and 1000.0f if I remember...

(I don''t know exactly why, but if the above doesn''t work, slap me with a fishstick)

~Dwarf
----------[Development Journal]
CHEERS!

Ok Im at work, unable to modify code or play with it but....

...gluPerspective(45.0f, (GLfloat)wndWidth / (GLfloat)wndHeight, 1.0f, 1000.0f); .....

I know I had the min z as -500.0f behind me and max z as 10000000 (lol) units into the screen.

eg:
gluPerspective(45.0f, (GLfloat)wndWidth / (GLfloat)wndHeight, -500.0f, 10000000.0f);

is that what is fucking it?
I was checking out the screenshots earlier and was impressed (and frustrated as to why I cant do it!)

cheers



Im just a beginner!!!

http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni
The Larger your viewing distance the worse the problems get with polygons that are near to each othere this is very true for intersecting ones because you can''t get any closer. make your viewing distance shorter if you can if you can''t the try to use GL_LESS for your depth testor and try to sort your objects this may help depending on your situation, any way good luck

and if im wrong please inform me of what I said thats wrong.
"I seek knowledge and to help those who also seek it"
quote:
gluPerspective(45.0f, (GLfloat)wndWidth / (GLfloat)wndHeight, -500.0f, 10000000.0f);


This is a problem with misuse of the z buffer.

Firstly, your near clip plane should be positive. It clearly says this in the gluPerspective description.

Secondly, you've got a stupidly huge far clipping plane distance, which is the reason for your problem.

In general, you should set your far clipping plane as near as possible, and your near clipping plane as far as possible. The near clipping plane is particularly important because most of the depth buffer precision is in the near distances. Setting your near plane to 2.0 for instance, instead of 0.2 will give you thousands of times more precision at long range.

____________________________________________________________
www.elf-stone.com

[edited by - benjamin bunny on June 2, 2002 12:39:52 AM]

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

keep the tips and help rolling in, bunny - I am revisiting the gluPerspective command once I get home...thanks!

Any tutorials for terrain TEXTURE rendering I could follow?
Any tips?

Im just a beginner!!!

http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni
>>Any tutorials for terrain TEXTURE rendering I could follow?
There''s probably a few on this site; it''s a pretty common topic. And there''s always google

>>Any tips?
um, don''t forget the texture coordinates?

____________________________________________________________
www.elf-stone.com

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

Fixed it up thanks bunny, though I have ditched water for now, but my triangles dont "flutter" any more.

also for those reading a great site is also game tutorials by digiben
check out the terrain mapping tutorials:

http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg3.htm



Im just a beginner!!!

http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni
There''s a book coming out thats all about terrain rendering (lotsa cool texturing stuff in it too, trust me, I''d know ). Unfortunately, it won''t be coming out for a *long* time. But I''m working on it!

Trent(ShiningKnight)
THE Engine
trent@voxelsoft.com

This topic is closed to new replies.

Advertisement