gl_line_distance_cull
Moderator: GZDoom Developers
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.
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.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
gl_line_distance_cull
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?
https://github.com/madame-rachelle/qzdo ... dware_cull
@dpJudas @Rachael @Graf Zahl @realdevs:
Any idea of what's going on? Could be a limitation of the clipper?
https://github.com/madame-rachelle/qzdo ... dware_cull
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: gl_line_distance_cull
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.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
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.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: gl_line_distance_cull
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.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
Thanks. But easier said than done.
If i try to do that everything dissapears.
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;
}
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: gl_line_distance_cull
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.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
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:
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;
}
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: gl_line_distance_cull
You have to go through GLWall's main process function but have to make adjustments that it properly recognizes this case.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
Thanks very much! It's fixed now. I should fill the gaps anyway with the ceiling texture.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
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.
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.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
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.
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.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: gl_line_distance_cull
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.
I've added sprite culling too and it certainly has an impact on performance.