Decrease far clipping plane

The Far clipping plane did not need to be nearly as high as it was, the new value is 32768, which I suspect is about how far software can render before it completely falls apart.
It is desirable to increase the near clipping plane to between 6-10, but it can introduce more issues with close geometry not being drawn when the player or camera is scaled or viewheight is set to MIN in first person view. It would also stop sprites from being drawn ever so slightly too early, but this isn't too much of an issue and isn't too noticeable with those values. Might look into scaling near clipping plane in accordance to camera scale in the future.
The reason for wanting to increase the near clipping plane is because the small value can cause very noticeable Z-fighting where there shouldn't be on older GPU's, usually Intel ones, that don't support 24-bits for the depth buffer.
This commit is contained in:
Sryder 2018-03-06 03:48:15 +00:00
parent 538d0de949
commit 67ee1637c9
3 changed files with 10 additions and 9 deletions

View file

@ -20,8 +20,8 @@
#define _HWR_DEFS_ #define _HWR_DEFS_
#include "../doomtype.h" #include "../doomtype.h"
#define ZCLIP_PLANE 4.0f #define ZCLIP_PLANE 4.0f // Used for the actual game drawing
#define NZCLIP_PLANE 0.9f #define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
// ========================================================================== // ==========================================================================
// SIMPLE TYPES // SIMPLE TYPES

View file

@ -5330,12 +5330,13 @@ static void HWR_DrawSkyBackground(player_t *player)
//Hurdler: the sky is the only texture who need 4.0f instead of 1.0 //Hurdler: the sky is the only texture who need 4.0f instead of 1.0
// because it's called just after clearing the screen // because it's called just after clearing the screen
// and thus, the near clipping plane is set to 3.99 // and thus, the near clipping plane is set to 3.99
v[0].x = v[3].x = -4.0f; // Sryder: Just use the near clipping plane value then
v[1].x = v[2].x = 4.0f; v[0].x = v[3].x = -ZCLIP_PLANE-1;
v[0].y = v[1].y = -4.0f; v[1].x = v[2].x = ZCLIP_PLANE+1;
v[2].y = v[3].y = 4.0f; v[0].y = v[1].y = -ZCLIP_PLANE-1;
v[2].y = v[3].y = ZCLIP_PLANE+1;
v[0].z = v[1].z = v[2].z = v[3].z = 4.0f; v[0].z = v[1].z = v[2].z = v[3].z = ZCLIP_PLANE+1;
// X // X
@ -5403,7 +5404,7 @@ static inline void HWR_ClearView(void)
(INT32)gr_viewwindowy, (INT32)gr_viewwindowy,
(INT32)(gr_viewwindowx + gr_viewwidth), (INT32)(gr_viewwindowx + gr_viewwidth),
(INT32)(gr_viewwindowy + gr_viewheight), (INT32)(gr_viewwindowy + gr_viewheight),
3.99f); ZCLIP_PLANE);
HWD.pfnClearBuffer(false, true, 0); HWD.pfnClearBuffer(false, true, 0);
//disable clip window - set to full size //disable clip window - set to full size

View file

@ -59,7 +59,7 @@ typedef struct GLRGBAFloat GLRGBAFloat;
#define N_PI_DEMI (M_PIl/2.0f) //(1.5707963268f) #define N_PI_DEMI (M_PIl/2.0f) //(1.5707963268f)
#define ASPECT_RATIO (1.0f) //(320.0f/200.0f) #define ASPECT_RATIO (1.0f) //(320.0f/200.0f)
#define FAR_CLIPPING_PLANE 150000.0f // Draw further! Tails 01-21-2001 #define FAR_CLIPPING_PLANE 32768.0f // Draw further! Tails 01-21-2001
static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE; static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
// ************************************************************************** // **************************************************************************