Jump to content
The Dark Mod Forums

[Resolved] Dev build, fewer FPS in some scenes using stencil shadows


Daft Mugi

Recommended Posts

@stgatilov In Written in Stone at 308 -1768 123 -13.7 68.3 0 (noclip) using stencil shadows (r10166), the FPS drops from 60 to 45-50. There is no FPS drop with r9853/2.10; it's 60 fps.

I found that enabling Frontend Acceleration improved the situation and FPS was a steady 60 fps.

Summarized:

  • Frontend Acceleration enabled
    • r10166 stencil 60 fps
  • Frontend Acceleration disabled
    • r10166 stencil 45-50 fps
    • r10166 maps 60 fps
    • r9853 stencil 60 fps

I thought you might want to investigate this scene. Maybe there's an optimization that can be done.

wis-fps-drop-stencil-shadows-r10166.webp

Edited by Daft Mugi
  • Like 1
Link to comment
Share on other sites

1 hour ago, Daft Mugi said:

That made the FPS a steady 60 fps.

So, what does that tell us?

The BVH optimization that splits models might be doing too much work in that scene.

What might be informative is if you uncap FPS ( com_fixedTic 1 ) and try setting r_modelBvhBuild back to the default setting. It may be that it doesn't properly work with capped FPS for some reason? Also see what happens with Frontend Accelleration enabled and uncapped FPS when you toggle r_modelBvhBuild to different modes.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

42 minutes ago, nbohr1more said:

What might be informative is if you uncap FPS ( com_fixedTic 1 )

For the results so far, my settings have been com_fixedTic 1 and com_maxFPS 60.

On Linux with an AMD GPU, com_fixedTic 0 has a low, erratic FPS. So, I don't use com_fixedTic 0.

 

@stgatilov Compared to r9853/2.10, I know recent dev builds have a different and improved implementation of stencil shadows. So, what has changed in the new implementation that would cause this particular scene and view angle to have worse performance even though other scenes have better performance?

Edited by Daft Mugi
Link to comment
Share on other sites

10 minutes ago, Daft Mugi said:

Compared to r9853/2.10, I know recent dev builds have a different and improved implementation of stencil shadows. So, what has changed in the new implementation that would cause this particular scene and view angle to have worse performance even though other scenes have better performance?

It uses BVH culling, which is way faster on large meshes:

 

Link to comment
Share on other sites

26 minutes ago, Daft Mugi said:

For the results so far, my settings have been com_fixedTic 1 and com_maxFPS 60.

On Linux with an AMD GPU, com_fixedTic 0 has a low, erratic FPS. So, I don't use com_fixedTic 0.

To determine if there is any further bvh bottle-necking in accelerated mode we will need you to set com_maxFPS to something high enough to show a difference, maybe 120 ?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

9 minutes ago, nbohr1more said:

To determine if there is any further bvh bottle-necking in accelerated mode we will need you to set com_maxFPS to something high enough to show a difference, maybe 120 ?

I tried setting max FPS to 120 and vsync off, but my FPS is still 60 fps. I wonder why that is.

Link to comment
Share on other sites

6 minutes ago, Daft Mugi said:

I tried setting max FPS to 120 and vsync off, but my FPS is still 60 fps. I wonder why that is.

Could be forced vsync in your video driver, forced vsync in your desktop composite solution, etc?

You have TDM set to Windowed, Fullscreen, or Borderless Windowed ?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

24 minutes ago, nbohr1more said:

Could be forced vsync in your video driver, forced vsync in your desktop composite solution, etc?

I thought the same at first, so I tested a few other games. I'm able to run Quake (Ironwail) with an uncapped framerate. I even got over 3800 fps on the start map. 😆 That was just for this test, though. I usually cap it at 60.

47 minutes ago, nbohr1more said:

You have TDM set to Windowed, Fullscreen, or Borderless Windowed ?

Fullscreen

Link to comment
Share on other sites

14 hours ago, Daft Mugi said:

I tried setting max FPS to 120 and vsync off, but my FPS is still 60 fps. I wonder why that is.

Maybe related: If I (in Linux) start the nVidia config software, quit and then start TDM, I get high fps. If I don't start the nVidia software first, fps is capped at 60fps.

Link to comment
Share on other sites

As a general proviso, I would caution against using well optimized missions like "Written in Stone" for evaluating this BVH feature. While it might be desirable that the heuristic detect when a mapper has done considerable work with visportals and culling to evade the necessity of BVH culling evaluations and disable them, it's entirely unclear whether any such heuristic is even feasible. The BVH feature is for very poorly optimized missions. It should have negligible impact on optimized missions while drastically improving poorly optimized ones. I'll try to replicate locally but I would not expect too much more work to improve things here. I guess it might be cool if there were an entity flag to bypass BVH for mappers who are experts at optimization? ( LOD \ SEED flags already bypass it in the latest builds as I recall )

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Probably not all that useful but in my testing "r_modelBvhBuild 0" did not make the above scene any faster,

only Frontend Acceleration helped with performance.

I probably have different bottle-necks with a GTX 1050 and an i7-3xxx CPU.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

13 hours ago, nbohr1more said:

Probably not all that useful but in my testing "r_modelBvhBuild 0" did not make the above scene any faster,

I hope you did set the cvar before starting mission?
Just to make sure... because otherise it did not apply.

Anyway, it is indeed possible.

Locally, I don't see much difference, but I see that shadow computation takes too much, and it seems to take about 1 ms less (out of 14ms) without BVH. I think I'll make BVH shadow computations more coarse, and hopefully it will help.

  • Like 2
Link to comment
Share on other sites

Yes, I set it before running the mission.

I guess I should do my homework about setting up tracy profiling rather than eyeballing FPS.

( I still think the home-grown performance tool in 2.08 was very cool. )

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

I added cvars for tuning BVH code in runtime:

  • modelBvhShadowsGranularity
  • modelBvhLightTrisGranularity

Meshes with size less than X are now processed using the old non-BVH algorithm, so if you set it to huge value, you'll get non-BVH performance (well, almost). Also it limits how much BVH traversal recurses into its subnodes.

However, I did not get much difference from tuning them.


Also, I have optimized the shadow volume generation algorithm with BVH.
Now it should be somewhat faster than before.

However, don't expect it to reach full non-BVH speed.
The non-BVH algorithm is much simpler (thus less overhead) than BVH-using algorithm, and also it can avoid computing some quantities several times thanks to the fact it always processes all triangles + vertices.
So, some slowdown here is the price to pay.

  • Thanks 2
Link to comment
Share on other sites

@stgatilov I tried out r10174 and tested that scene, and it's now a steady 60 fps with Frontend Acceleration disabled. Great job!

I read through your code changes, and my jaw dropped. It's really impressive work!

When I originally posted about the drop in FPS, I thought maybe a few basic tweaks could be made. You went above and beyond that. I appreciate that you used several different techniques to improve performance.

  • Like 1
  • Haha 1
Link to comment
Share on other sites

  • Daft Mugi changed the title to [Resolved] Dev build, fewer FPS in some scenes using stencil shadows

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...