#2 Members - Reputation: 1671
Posted 21 June 2012 - 04:43 AM
http://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm
#3 Members - Reputation: 3793
Posted 21 June 2012 - 04:59 AM
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#4 Members - Reputation: 112
Posted 21 June 2012 - 05:02 AM
Edit1:If I push the near value 1.0 or greater till 1.0 distance Its not possible to see in the viewport
Edited by Haris072, 21 June 2012 - 05:06 AM.
#5 Members - Reputation: 785
Posted 21 June 2012 - 05:28 AM
http://www.opengl.org/wiki/Common_Mistakes#Depth_Buffer_Precision
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
#6 Members - Reputation: 594
Posted 21 June 2012 - 05:34 AM
This is not even remotely doable with the standard depth buffer - your near plane is absolutely ridonkulous in regards to the far plane.gluPerspective(fov,(winWid/winHgt),0.001,100000.0);
You have two options:
* use sane near and far distances.
* use floating point depth buffer (if your target supports them).
#7 Members - Reputation: 594
Posted 21 June 2012 - 05:35 AM
Given his near far plane distances - that wont help.Use a 24 bit depth buffer for better precision. It is supported on everything.
http://www.opengl.or...uffer_Precision
#8 Members - Reputation: 241
Posted 21 June 2012 - 06:08 AM
Assuming you're using a scale of 1 unit = 1 metre, you're asking for millimetre precision over one hundred kilometres. Which is impossible given the number of bits in the depth buffer.
Try 0.1 to 1000.0, which is really pushing it, but may be acceptable in some cases.
Basically, you need to reduce the number of zeros after the decimal point for the near value, and the number of zeros after the decimal point for the far. It's the ratio between the two that counts: you're asking for a ration of 1:100000000 which can't be expressed in a 24 bit depth buffer.
EDIT - having read you're post again, what are the furthest depth values you need? Maybe try 0.001 near to 1.0 far.
Edited by mark ds, 21 June 2012 - 06:15 AM.
#9 Crossbones+ - Reputation: 5144
Posted 21 June 2012 - 06:25 AM
1 = centimeters?
1 = meters?
If 1 unit = 1 centimeter (Half-Life 2, GoldenEye 007, Final Fantasy VII), you could probably get away with ranges from 10.0 to 100000.0. The low value makes more of a difference than the high value, so increasing this improves your Z quality by the most amount. 100,000 is normally a ridiculous far value, but with a near of 10.0 it isn’t too bad. Still might have some Z-fighting in detailed areas at a long-medium range or somewhat-far range.
If 1 unit = 1 meter, 0.1 to 1000.0 would be the equivalent.
In any case, you generally do not need a near value smaller than the radius of your player. For example, in an FPS the player is a capsule or cylinder, both of which have some fixed radius that keeps them that distance from walls etc. Since you can’t get closer than that to anything in the scene, your near distance should be just slightly under that value. 0.95 is often reasonable if 1 unit = 1 foot.
In any case, a near value of 0.001 is never acceptable.
If you truly need large viewing distances, use logarithmic Z.
L. Spiro
Edited by L. Spiro, 21 June 2012 - 06:28 AM.
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums
#10 Members - Reputation: 1245
Posted 21 June 2012 - 06:57 AM
#11 Members - Reputation: 457
Posted 21 June 2012 - 08:25 AM
#12 Members - Reputation: 534
Posted 21 June 2012 - 09:34 AM
#14 Members - Reputation: 58
Posted 23 June 2012 - 08:25 PM
#15 Members - Reputation: 3793
Posted 24 June 2012 - 05:55 AM
But are those machines realistically in your target audience? Or are you compromising your program for the sake of hardware that nobody is even going to run it on?yes. more than half of machines still have fixed pipeline yet.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#16 Members - Reputation: 1408
Posted 25 June 2012 - 05:39 AM
You have to decide what surface should be "above", and adjust the coordinates accordingly. If this doesn't help, then you need to adjust resolution (as described above).
The are special mechanisms in OpenGL that adds a small delta to target this problem. It is described in the OpenGL superbible, which I do not have access to just now.






