   Infinity Far Plane
  Hi all!I''d like to realize shadow volumes with z-fail but don''t know how to set the far clip plane to inifite. does anyone have an idea?Thanks a lotCorrail   --------------------------------------------------------"If it looks good, it is good computer graphics""If it looks like computer graphics, it is bad computer graphics"Corrailcorrail@gmx.atICQ#59184081 
  In discrete space, very_large_number = infinity. The largest number you can set it to is max_value_of(float). To find this out, Google for data type sizes (eg int32 is 232).   ;  But I know there is a way to tell OpenGL to use a real infinity far plane. You have to pass a certain projection matrix to the GL but I don''t know which and how.   --------------------------------------------------------"If it looks good, it is good computer graphics""If it looks like computer graphics, it is bad computer graphics"Corrailcorrail@gmx.atICQ#59184081 ;  Yeah, but if you set it to the maximum value a float can have, then what difference will it make? You can not use any values that are higher than that anyway... except if you use double or something like it... ;  But this won''t solve my problem anyway. If I''ve got a fragment which is farther away than my VERY far clip plane it will be discard which I''d like to prevent!   --------------------------------------------------------"If it looks good, it is good computer graphics""If it looks like computer graphics, it is bad computer graphics"Corrailcorrail@gmx.atICQ#59184081 ;quote:Original post by Corrail  But this won''t solve my problem anyway. If I''ve got a fragment which is farther away than my VERY far clip plane it will be discard which I''d like to prevent!   --------------------------------------------------------"If it looks good, it is good computer graphics""If it looks like computer graphics, it is bad computer graphics"Corrailcorrail@gmx.atICQ#59184081   Please read my previous post again. It is impossible to have infinity in a discrete (see def. 3) system. Your computer is a discrete system. Infinity can only be simulated and is thereby limited to some discrete value. If you''re working on a 32-bit platform, the size of float should be 32 bits (sign, exponent and mantissa together) - this is your not-so-theoretical-but-actual size limit. If you tell the graphics card to regard infinity as "infinity", it will do its best to clip everything at the largest possible value it can handle - this is either max_value_of(float) or max_value_of(double). I''m pretty sure it''s the first one, though (at least in most cases). ;  But Depth Buffer works like this:The Depth value which is stored in Depth buffer isn''t an absolute value. The smaller your distance between your near plane and your far plane the more exact. AFAIK the depth value is stored in Depth Buffer like this:near plane is 1000far planet is 2000Depth Buffer value is 0,5So absolute depth value is 1500.But somewhere these values have to be translated from absolute values to this interval and a Depth-Testing has to be done. So if I use a such high value my depth testing will cause artifacts.If I use your idea of passing the highest possible value to the GL for far plane how am I able to determine which the highest value is? Different GL implimentation use different floating point precision?   --------------------------------------------------------"If it looks good, it is good computer graphics""If it looks like computer graphics, it is bad computer graphics"Corrailcorrail@gmx.atICQ#59184081 ;  You could go with something like 10 million - that is a reasonably small/large number.   ;  1. Using homogenous coordinates it is possible, using OpenGL to render a point that is infinitely far away from the origin.  Not just very far away, but infinitely far away.  This is done by setting the w coordinate to 0.  Further more, OpenGL is guarenteedto correctly render polygons specified with vertices that are infinitely far away.2. The standard projection matrix is:  2 × NearRight + Left------------0------------  0Right - LeftRight - Left    2 × NearTop + Bottom0------------------------  0Top - BottomTop - Bottom    Far + Near  2 × Far × Near00- ----------- --------------  Far - Near    Far - Near  00-1  0   As Far tends to infinity (mathematical infinity, not MAX_FLOAT) the projection matrix becomes:  2 × NearRight + Left------------0------------    0Right - LeftRight - Left    2 × NearTop + Bottom0------------------------    0Top - BottomTop - Bottom  00-1-2 × Near  00-1    0   For more information see this white paperEnigmaEDIT: space between lines of matrices was collapsed.   [edited by - Enigma on December 3, 2003 5:49:25 AM];  Thanks Enigma! That''s exactly what I''m looking for! :-)And I''ve got to pass this matrix just likeglMatrixMode(GL_PROJECTION);glLoadMatrixf(my_infinity_projection_matrix);Or do I have to change the clip planes too?   --------------------------------------------------------"If it looks good, it is good computer graphics""If it looks like computer graphics, it is bad computer graphics"Corrailcorrail@gmx.atICQ#59184081 