Comments (14)
Ironwail and vkQuake have gl_farclip as 16384. Does the issue show itself in those engines?
CC: @temx, @andrei-drexler
from quakespasm.
Yes it happens in those engines aswell.
IW and VK don't have the yellow stuff, but its the same issue.
from quakespasm.
Joequake recently bumped it to 65536:
j0zzz/JoeQuake@7ad2e8d
@ericwa: Any objections? (CC: @andrei-drexler)
from quakespasm.
Default value of gl_farclip bumped to 65536 in git: Closing as fixed.
from quakespasm.
Can we add glEnable(GL_DEPTH_CLAMP_NV);
to avoid this?
diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c
index cedc791..67a08f9 100644
--- a/Quake/gl_vidsdl.c
+++ b/Quake/gl_vidsdl.c
@@ -1351,6 +1351,7 @@ static void GL_SetupState (void)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glDepthRange (0, 1); //johnfitz -- moved here becuase gl_ztrick is gone.
glDepthFunc (GL_LEQUAL); //johnfitz -- moved here becuase gl_ztrick is gone.
+ glEnable(GL_DEPTH_CLAMP_NV);
}
/*
from quakespasm.
Can we add
glEnable(GL_DEPTH_CLAMP_NV);
to avoid this?
Done: 74c4786 , thanks.
from quakespasm.
Probably we need to check GL_ARB_depth_clamp instead of GL_NV_depth_clamp, or probably both
https://registry.khronos.org/OpenGL/extensions/ARB/ARB_depth_clamp.txt
GL_EXTENSIONS on my Intel HD Graphics 4600 does not contain GL_NV_depth_clamp, but GL_ARB_depth_clamp is there
I used GL_DEPTH_CLAMP_NV just because it is already defined in SDL_opengl.h
from quakespasm.
Probably we need to check GL_ARB_depth_clamp instead of GL_NV_depth_clamp, or probably both
Done: Checking both now in git HEAD
from quakespasm.
MH added this function to dynamically get the extent of the map at load time
static float R_GetFarClip (void) //MH
{
// don't go below the standard Quake farclip
float farclip = 4096.0f;
int i;
// this provides the maximum far clip per view position and worldmodel bounds
for (i = 0; i < 8; i++)
{
float dist;
vec3_t corner;
// get this corner point
if (i & 1) corner[0] = cl.worldmodel->mins[0]; else corner[0] = cl.worldmodel->maxs[0];
if (i & 2) corner[1] = cl.worldmodel->mins[1]; else corner[1] = cl.worldmodel->maxs[1];
if (i & 4) corner[2] = cl.worldmodel->mins[2]; else corner[2] = cl.worldmodel->maxs[2];
if ((dist = VectorDistance(r_refdef.vieworg, corner)) > farclip)
farclip = dist;
}
return farclip;
}
called in r_SetupGL
farclip = R_GetFarClip();
Cvar_SetValue("r_farclip",farclip);
from quakespasm.
MH added this function to dynamically get the extent of the map at load time
Doesn't seem to work as expecked with ej3_aesop (CC: @mhQuake )
from quakespasm.
This shouldn't be used at load time, as it depends on the current player position. It's appropriate to call it each frame at runtime and use it instead of the r_farclip cvar. It only takes player position into account, not orientation nor fov, so there is scope for optimization. It can also be micro-optimized by not updating it if the player's position hasn't changed since last time it was called.
It is of course dependent on the worldmodel bounds being correctly set. If they're set wrong, then it will likewise give the wrong result. If in doubt, recalc the worldmodel bounds correctly at load time.
from quakespasm.
This shouldn't be used at load time, as it depends on the current player position. It's appropriate to call it each frame at runtime and use it instead of the r_farclip cvar.
That's what I did: put it in R_SetupGL, not in R_NewMap
It only takes player position into account, not orientation nor fov, so there is scope for optimization. It can also be micro-optimized by not updating it if the player's position hasn't changed since last time it was called.
It is of course dependent on the worldmodel bounds being correctly set. If they're set wrong, then it will likewise give the wrong result. If in doubt, recalc the worldmodel bounds correctly at load time.
Seems too much hassle for corner cases. Player can always set gl_farclip by hand himself.
from quakespasm.
That's what I did: put it in R_SetupGL, not in R_NewMap
So other than that it's just getting distances from the player position to the 8 corners of the worldmodel bounding box. So either mathematics is broken, or something else is wrong. Is the player position valid at the time you call it? Have you verified that the worldmodel bounding box is correct?
Seems too much hassle for corner cases. Player can always set gl_farclip by hand himself.
I do understand the rationale behind this, I just don't agree with it. If a solution can be found to an issue that doesn't require player input, then it should at least be considered. Requiring player input is a barrier and can lead to false bug reports. A quick once-per-frame calculation of the distance from the player position to the farthest corner of a bounding box hardly seems "hassle". It depends on who should have the "hassle" inflicted on them: the player or the engine?
from quakespasm.
That's what I did: put it in R_SetupGL, not in R_NewMap
So other than that it's just getting distances from the player position to the 8 corners of the worldmodel bounding box. So either mathematics is broken, or something else is wrong. Is the player position valid at the time you call it? Have you verified that the worldmodel bounding box is correct?
Haven't put serious effort in it. The call chain is the standard
SCR_UpdateScreen -> V_RenderView -> R_RenderView -> R_RenderScene -> R_SetupScene -> R_SetupGL
from quakespasm.
Related Issues (20)
- Mac Windowed Mode Out Of Focus Input HOT 20
- Alpha sorting issues HOT 3
- Center Print Deletes Con Notify HOT 1
- SZ_GetSpace: overflow in certain maps with sv_protocol 999 HOT 1
- Fog blending/banding issues HOT 8
- gl_overbright cvar not working HOT 25
- Issue with depth clamp extension HOT 4
- Geometry Rendering Distortion (Mac) HOT 7
- Case sensitive game command HOT 20
- Host & play on localhost HOT 11
- Flatpak distribution HOT 5
- Border on screenshot HOT 1
- bad loop HOT 1
- negative uints HOT 19
- moving bmodels receive dynamic lighting from original position HOT 3
- Any plans to add minimal HUD and water warp from Quake Remaster? HOT 1
- Stack buffer overrun on loading of `lim_daviddg` map HOT 2
- i can't enable m_filter HOT 2
- *Sky_ClipPoly: MAX_CLIP_VERTS* error in `lim_daviddg` map HOT 21
- issues with map starslave HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quakespasm.