Giter Club home page Giter Club logo

Comments (14)

sezero avatar sezero commented on August 12, 2024

Ironwail and vkQuake have gl_farclip as 16384. Does the issue show itself in those engines?

CC: @temx, @andrei-drexler

from quakespasm.

Flecked42 avatar Flecked42 commented on August 12, 2024

Yes it happens in those engines aswell.

IW
IW

VK
VK

QS
QS

IW and VK don't have the yellow stuff, but its the same issue.

from quakespasm.

sezero avatar sezero commented on August 12, 2024

Joequake recently bumped it to 65536:
j0zzz/JoeQuake@7ad2e8d

@ericwa: Any objections? (CC: @andrei-drexler)

from quakespasm.

sezero avatar sezero commented on August 12, 2024

Default value of gl_farclip bumped to 65536 in git: Closing as fixed.

from quakespasm.

andrey-budko avatar andrey-budko commented on August 12, 2024

Can we add glEnable(GL_DEPTH_CLAMP_NV); to avoid this?

master

image

patched

image

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.

sezero avatar sezero commented on August 12, 2024

Can we add glEnable(GL_DEPTH_CLAMP_NV); to avoid this?

Done: 74c4786 , thanks.

from quakespasm.

andrey-budko avatar andrey-budko commented on August 12, 2024

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.

sezero avatar sezero commented on August 12, 2024

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.

sputnikutah avatar sputnikutah commented on August 12, 2024

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.

sezero avatar sezero commented on August 12, 2024

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.

mhQuake avatar mhQuake commented on August 12, 2024

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.

sezero avatar sezero commented on August 12, 2024

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.

mhQuake avatar mhQuake commented on August 12, 2024

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.

sezero avatar sezero commented on August 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.