TheOverfloater / pathos-public

Public release of Pathos Engine
MIT License
42 stars 10 forks source link

Whats exactly 'r_gaussianblur' and 'r_shadowmap_blitting'? #28

Closed valina354 closed 4 months ago

valina354 commented 5 months ago

i have been trying to optimize dlights hella ton, to make them more usable and less fps taking, especially for my fake csm im doing with the dlights, i found out that r_gaussianblur 0 raises fps a lot by at least 40 fps, however if you restart map or something else after disabling it the dlights break, and r_shadowmap_blitting setting to 0 seems to raise fps a bit without quality loss at least for me so that i can set to 0 always but im worried about gaussianblur, im trying to optimize shadowmapping as much as possible pretty much @TheOverfloater

valina354 commented 5 months ago

i also noticed gaussian blur blurs shadowmap more, this means its harder to use less res shadowmap which increases fps gaussianblur on: image gaussianblur off: image

this is all with 512 res of shadowmap

valina354 commented 5 months ago

with 256 res of shadowmap and no gaussian blur it doesnt look so bad and performance is very good only ussue is restarting map breaks it image

valina354 commented 5 months ago

example of breaking i mean image and when r_gaussianblur is set to 1 then back to 0: image

TheOverfloater commented 5 months ago

I will take a look at why this is broken, I hadn't experienced this issue in my game. As for the cvars, r_gaussianblur controls whether blurring is applied to the shadowmap, as you can see. This was designed with higher resolutions in mind. The r_shadowmap_blitting cvar controls whether the engine only renders static scene components once, then blits them into the final shadowmap to render dynamic objects each frame. This is supposed to massively improve performance with dynamic lights, but if it's slow for you, it might be that your GPU in particular has issues with this feature. A relatively faster GPU should not be bogged down by either of these features. What is your GPU?

valina354 commented 5 months ago

I will take a look at why this is broken, I hadn't experienced this issue in my game. As for the cvars, r_gaussianblur controls whether blurring is applied to the shadowmap, as you can see. This was designed with higher resolutions in mind. The r_shadowmap_blitting cvar controls whether the engine only renders static scene components once, then blits them into the final shadowmap to render dynamic objects each frame. This is supposed to massively improve performance with dynamic lights, but if it's slow for you, it might be that your GPU in particular has issues with this feature. A relatively faster GPU should not be bogged down by either of these features. What is your GPU?

image

kinda forgot to update my gpu drivers in a while but i dont think that would really cause issues as its not like its 5 year old gpu drivers

valina354 commented 5 months ago

oh, oh yeah, i think i just did mistake calculating as turning r_shadowmap_blitting to 1 raises fps from around 400 to 700 in my fake csm test map so whoops i was wrong about that one

valina354 commented 5 months ago

i wonder exactly why shadow maps are like so expensive, i see some game engines that can render hundreds of shadowmaped lights with barely any performance loss, are shadowmaps calculated in pathos like way more expensive way then most other engines?

valina354 commented 5 months ago

oh, oh yeah, i think i just did mistake calculating as turning r_shadowmap_blitting to 1 raises fps from around 400 to 700 in my fake csm test map so whoops i was wrong about that one

it seems very strange heres vid, in a very tiny room, no shadowmap blitting actually raises fps, but in 'big' map like the fake csm test it raises fps its very strange https://github.com/TheOverfloater/pathos-public/assets/80889633/cc722b6a-aa93-4db0-96ce-859f2780da8b

TheOverfloater commented 5 months ago

It is possible that because of the low amount of scene components to process for shadowmap rendering by the engine, the overhead caused by blitting actually outweighs the performance cost of rendering such a simplistic scene. I don't think this should be taken as a baseline since most levels will not be this simplistic. I am sure if you measure this on more complex scenes, the blitted version's performance will outweigh the non-blit version.