gl_line_distance_cull

Bugs with GZDoom Vintage builds. Same rules apply as with all other bug reports fora.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

gl_line_distance_cull

Postby drfrag » Tue Sep 03, 2019 11: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
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby Graf Zahl » Tue Sep 03, 2019 11: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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: gl_line_distance_cull

Postby drfrag » Tue Sep 03, 2019 12:40 pm

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.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby Graf Zahl » Tue Sep 03, 2019 1: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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: gl_line_distance_cull

Postby drfrag » Tue Sep 03, 2019 2:24 pm

Thanks. But easier said than done. :?
If i try to do that everything dissapears.
Code: Select allExpand view
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;
}
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby Graf Zahl » Tue Sep 03, 2019 2: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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: gl_line_distance_cull

Postby drfrag » Wed Sep 04, 2019 3: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 allExpand view
   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;
   }
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby Graf Zahl » Wed Sep 04, 2019 4:26 am

You have to go through GLWall's main process function but have to make adjustments that it properly recognizes this case.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: gl_line_distance_cull

Postby drfrag » Wed Sep 04, 2019 6:26 am

Thanks very much! It's fixed now. :) I should fill the gaps anyway with the ceiling texture.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby drfrag » Wed Sep 04, 2019 12:58 pm

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
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby drfrag » Thu Sep 05, 2019 6: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.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: gl_line_distance_cull

Postby drfrag » Thu Sep 05, 2019 12:23 pm

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.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain


Return to LZDoom Bugs

Who is online

Users browsing this forum: No registered users and 1 guest