RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.38k stars 247 forks source link

Using Shadowmapping kills performance #395

Closed LordKane1701 closed 1 year ago

LordKane1701 commented 6 years ago

Hi, I have a older video card (a ATI Radeon HD 5770) and using soft shadows just murders my performance is there anything I can do about this?

BielBdeLuna commented 6 years ago

try r_shadowMapLodBias 4 to reduce the quality of the soft shadows

further than this I don't know any more commands to reduce the quality of the current implementation, the next solution I guess would be to add a lower quality shadowmap algorithm, maybe even disable the soft shadow mapping, it would look ugly but older cards would be able to play it.

LordKane1701 commented 6 years ago

Will do that, thank you for the suggestion

ROCKNROLLKID commented 6 years ago

On my Nvidia 1070 and Ryzen 1700, my fps drops as low as 35fps in some areas with shadow mapping on. Using r_shadowMapLodBias 4 only improved my fps ~10. I guess it just needs more optimization.

I suppose adding Vulkan support from vkdoom 3 would keep it around 50-60 fps minimal.

nottux commented 5 years ago

My AMD RX 540 does drops 27~ frames sometimes

FireCulex commented 5 years ago

Same problem here, RX 580, soft shadows kills the fps

brazzjazz commented 4 years ago

I was having the same problem. I was puzzled at first because the GPU load was nowhere near 100%. How can this be, that I get 45-60 (but below 60) fps while being under 100% GPU load? Can single shaders / effects screw up the framerate like this without utilizing the GPU 100%? Is it because buggy shaders force the rest of the GPU to wait or something? Just trying to understand low framerates with <100% GPU load (given CPU is not 100%).

Calinou commented 4 years ago

@brazzjazz Maybe shadowmapping is constrained by the GPU memory bandwidth, which means the GPU core isn't used at its full potential.

RinMaru commented 4 years ago

shadowmaps in The OG Doom 3 via dhewm3 dont have any sort of perf hit so im surprised

DanielGibson commented 4 years ago

dhewm3 doesn't have shadowmaps but uses the old stencil shadows, that's why it's fast, but the shadows are also not "soft"

kkuez commented 3 years ago

This problem still persists in 2021. Is it really that no solution was found yet? I'm not able to play this mod then unfortunately.

Calinou commented 3 years ago

This problem still persists in 2021. Is it really that no solution was found yet? I'm not able to play this mod then unfortunately.

Try entering r_shadowMapLodBias 4 in the console to reduce the quality of the soft shadows. (Use Tilde or Shift + Escape to open the console.)

BielBdeLuna commented 3 years ago

r_shadowmapsamples down to 2 or 4 for a less sampled bluring on the shadow maps, it will increase shadow map acne though.

RobertBeckebans commented 3 years ago

r_shadowMapLoadBias 2 or 4 is not really helpful. I measured this again on my current system in 1440p.

rbdoom-3-bfg-20210106-163546-002 rbdoom-3-bfg-20210106-163559-003

As you can see with com_showFPS 3 this is one of the heaviest performance penalty corners I can find in the game. About 8100 drawcalls and you only save 0.1 milliseconds by suffering a worse quality. I got a lot of feedback that Nvidia users who have no performance problems at all. I optimized the master branch last year on a RX 580 and I figured that the shadowmap resolution isn't really a problem with the performance. It's simply the poor AMD Windows OpenGL driver and that RBDoom does too many context switches for shadow mapping.

A state of the art performance improvement would be to use a shadowmapping atlas with octahedral projection as shown here: http://hd-prg.com/tileBasedShadows.html

Calinou commented 3 years ago

@RobertBeckebans Would the change below be more useful?

r_shadowmapsamples down to 2 or 4 for a less sampled bluring on the shadow maps, it will increase shadow map acne though.

It could be applied to AMD GPUs only, although I don't know if RBDoom has a way to apply cvars based on the GPU vendor.

BielBdeLuna commented 3 years ago

Another big improvement could be to make "rs_enable 3" or "r_screenfraction 50" a credible solution, all pixel shader effects related to the _currentrender don't understand a _currentrender image with changing resolution.

Also it seems that a lower r_shadowMapSamples ( like at 1 ) is somewhat more useful when combined with r_shadowmaplodbias around 4. it's true that at lodbias 0 lowering the samples does next to nothing. that's my experience at a sub HD resolution in a 10 CU integrated GPU within a AMD machine. in that place you posted I get an increase from 18 fps - 20 fps to 24fps - 25fps