gl_line_distance_cull

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: gl_line_distance_cull

Re: gl_line_distance_cull

by drfrag » Thu Sep 05, 2019 11:23 am

The position of the vertexes changes when you look around in hardware so for low cull distances even a line close to you can be culled. There's no workaround.
I've added sprite culling too and it certainly has an impact on performance.

Re: gl_line_distance_cull

by drfrag » Thu Sep 05, 2019 5:21 am

I know what's going on, a line behind is being culled and when i draw on that line the texture can be seen since there's no mid texture on the front line, that wall is supposed to open later. I don't think there's a solution since it's a different line. >:(
Edit: no, it's the line itself. It's being culled intermitently. No idea of what's going on with that line. Same happens in MAP20.

Re: gl_line_distance_cull

by drfrag » Wed Sep 04, 2019 11:58 am

Done. I've pushed the changes here: https://github.com/drfrag666/gzdoom/com ... 4e655128f1
It works well now however with low values some strange things happen, such as this line being culled intermitently from that sector on MAP23 when looking around.
Screenshot_Doom_20190904_200305.png

Re: gl_line_distance_cull

by drfrag » Wed Sep 04, 2019 5:26 am

Thanks very much! It's fixed now. :) I should fill the gaps anyway with the ceiling texture.

Re: gl_line_distance_cull

by Graf Zahl » Wed Sep 04, 2019 3:26 am

You have to go through GLWall's main process function but have to make adjustments that it properly recognizes this case.

Re: gl_line_distance_cull

by drfrag » Wed Sep 04, 2019 2:43 am

Thanks but again sorry easier said than done. :?
How? Calling Skyplane? Both Skyplane and Skynormal are private in GLWall.
The culling takes place here in GLSceneDrawer::AddLine:

Code: Select all

	if (IsDistanceCulled(seg))
	{
		if (seg->frontsector->GetTexture(sector_t::ceiling) == skyflatnum)
		{
			GLWall wall(this);
			wall.SkyPlane(seg->frontsector, sector_t::ceiling, false);
		}
		clipper.SafeAddClipRange(startAngle, endAngle);
		return;
	}

Re: gl_line_distance_cull

by Graf Zahl » Tue Sep 03, 2019 1:42 pm

You are not supposed to turn the line into a horizon but to treat it like one when during rendering you find out that it is the place where culling takes place.

Re: gl_line_distance_cull

by drfrag » Tue Sep 03, 2019 1:24 pm

Thanks. But easier said than done. :?
If i try to do that everything dissapears.

Code: Select all

inline bool IsDistanceCulled(seg_t *line)
{
	double dist3 = gl_line_distance_cull * gl_line_distance_cull;
	if (dist3 <= 0.0)
		return false;

	double dist1 = (line->v1->fPos() - r_viewpoint.Pos).LengthSquared();
	double dist2 = (line->v2->fPos() - r_viewpoint.Pos).LengthSquared();
	if ((dist1 > dist3) && (dist2 > dist3))
	{
		if (line->frontsector->GetTexture(sector_t::ceiling) == skyflatnum)
		{
			line->linedef->special = Line_Horizon;
		}
		return true;
	}
	return false;
}

Re: gl_line_distance_cull

by Graf Zahl » Tue Sep 03, 2019 12:38 pm

If you want distance culling you have to close the gaps, otherwise stuff will look broken. And if you cull the back of a linedef whose front side has a sky, you have to let the renderer process the sky. If you want to get the same behavior as the software renderer you have to draw a horizon on the linedef.

Re: gl_line_distance_cull

by drfrag » Tue Sep 03, 2019 11:40 am

I see, then i guess it's not fixable. It only happens on certain maps when facing certain directions, for instance on MAP15 it doesn't.
In software it was not a problem since you filled the gaps with the sky or the floor (memcpy) or else you'd get HOMs.

Re: gl_line_distance_cull

by Graf Zahl » Tue Sep 03, 2019 10:42 am

Skies are being drawn as part of the outer wall they are on. Since you cull the wall you also cull the sky - and if no linedef with a sky remains, nothing will be drawn instead.

gl_line_distance_cull

by drfrag » Tue Sep 03, 2019 10:06 am

I've merged the hardware_cull branch (gl_line_distance_cull CVAR) from QZDoom and it works with a huge performance increase but there's a problem. On very big maps the sky dissapears (black) when looking at the big part of the level (e.g. facing east in Planisphere 2).
@dpJudas @Rachael @Graf Zahl @realdevs:
Any idea of what's going on? Could be a limitation of the clipper? :3:

https://github.com/madame-rachelle/qzdo ... dware_cull

Top