Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.16k stars 83 forks source link

Low performance #563

Closed YALdysse closed 10 months ago

YALdysse commented 10 months ago

Please, help me. I have a terrible performance. I use low graphics setting in game, but it didn't help.

OpenGothic version: commit - cd4fe04 OS: Manjaro Linux Kernel: 6.169-1 DE: KDE Plasma CPU: AMD Ryzen 5 5500U iGPU: AMD Redeon RX Vega 7

Screenshot at 23-58-30

Try commented 10 months ago

Hi, @YALdysse !

After googling on AMD Redeon RX Vega 7 - in benchmarks it somewhat bellow mobile-gpus, so 23 fps is probably is far as it can reach. While currently I'm working on new solution for geometry pipeline, yet unlikely that much can be done on Vega

YALdysse commented 10 months ago

@Try On such a configuration as mine, I can run 4 (or maybe more) original Gothic 2 games. It's very strange that your project behaves like this. Is there any way to reduce the graphics settings? Personally, I think it's inappropriate to turn a 2004 game into a super heavy project without changing the graphics dramatically.

Try commented 10 months ago

Is there any way to reduce the graphics settings?

I've assumed that you already done this. We have instruction in readme: Settings -> Extended configuration -> ***. Depend of hardware you may want to disable SSAO/SSR/water-tesselation/sky-occlusion.

If you asking from programming point of view: there is already an issue with too wide tech span. We have high-end graphics for latest GPUs, including RT-GI, yet we still can't adopt even16-bit floats and have to use 11-bit for potability.

heavy project without changing the graphics dramatically

I'm sorry if graphics is not as good as you may expect. Yet on technical point of view it's very up-to date tech wise (assets are obviously same, as in 2004).

Try commented 10 months ago

Since topic is about performance allow me to rant about GPU's a little:

We do have a generational span problem: it hard to support low-end micro controller and high-end RT-gpu in the same time with reasonable scaling. Would be nice to use, for example, bindless, for optimization. Vega sort of support it, but via emulation :(. And older iPhone(like mine) do not have it at all. Do bindless and non-bindless in the same time? - quite a commitment and afaik only call-of-duty can do that. Do primitive-shader to optimize geometry? You gpu in theory has that in hardware, but not in driver... Do mesh-shader? We do actually, but it really works on on NVidia, AMD has only emulation and only since RDNA2. Do index-scan + indirect? Tested last December actually - slower that a mesh. Indirect draw-calls hammering FE so much units, so even RTX suffers to run it ( btw Starfield apparently has same issue to indirect, but they ship-it like so :D ). Do software rendering (ala Nanite)? Working on prototype actually, but it scales poorly on large triangles: not an issue for UE5, but a huge problem for Gothic. Also SW-rendering is somewhat OK with opt-out bindless - way less engineering cost to support it optimally as optimization. And it fully broken on mobile.. ofc. OK, that was only for geometry actually... Ambient occlusion and SSR, are mostly bound by memory-read speed. Sky-occlusion is supper-bound by memory-speed, but at least can be disabled (radial-fog). And decoding textures is quite slow (lot of math to do), for iGPU, based on my experience with IntelUHD.

ezamelczyk commented 10 months ago

I've assumed that you already done this. We have instruction in readme: Settings -> Extended configuration -> ***. Depend of hardware you may want to disable SSAO/SSR/water-tesselation/sky-occlusion.

There's nothing about this in the readme.

YALdysse commented 10 months ago

@Try , thanks for answer. Good luck.

YALdysse commented 10 months ago

@Try , could you add change rendering distance ?

Nindaleth commented 10 months ago

@ezamelczyk It is, the description in readme is here.

Maybe it's clear only to people who already saw and remember the options from the game's Extended Configuration menu and (in the current shape) it's not as helpful as we hoped?

Nindaleth commented 10 months ago

@YALdysse Did you also try to lower the render scale setting in game? I don't remember the exact setting name and cannot check it at the moment.

ezamelczyk commented 10 months ago

Available option:

but doesn't say anywhere how to set that option. I don't understand this.

YALdysse commented 10 months ago

@YALdysse Did you also try to lower the render scale setting in game? I don't remember the exact setting name and cannot check it at the moment.

How can I do this ?

Nindaleth commented 10 months ago

@ezamelczyk It's in the in-game menu Options -> Extended configuration. Some of the game options are reused for more useful modern replacements (the approach is chosen as it's either very hard or impossible to modify this in-game menu reliably).

The menu looks like this: ext_cfg

Nindaleth commented 10 months ago

@YALdysse The render resolution scale is in Options -> Video configuration.

It doesn't change the display resolution as such, but instead - while keeping it constant - decreases the amount of detail rendered in it; you'll see what I mean when you change it, it's applied immediately after selecting another value. Most importantly, it should raise FPS significantly.

render_resolution

Try commented 10 months ago

How can I do this ?

As mentioned above Settings -> Extended configuration.

could you add change rendering distance ?

Tested it a while ago. Overall it ~5% gain if you clip to world close to player's nose. Unfortunately geometry it much more complex than a draw distance: we need some way to cull+draw clusters efficiently.

Significant (and probably most significant) portion of GBuffer-pass is landscape. And we have to draw it in huge cluster, to avoid FE-limit. But huge clusters = lots of useless polygons. Mesh-shader helps, by enabling small clusters (64 primitives in our case), but you need a hardware support for it.

Tested SW-rendering today: изображение

Cluster are sort-of fine: 0.02ms for frustum + HiZ, but actual rasterization is awful: 2.00ms: изображение

90% of the time shader is busy rasterizing green + orange cluster at the bottom. Maybe it still usable only for water... One way to move forward is to kick a non-indexed-indirect draw (similar to assassins-creed) with instance count=count of visible clusters.

YALdysse commented 10 months ago

@Nindaleth I changed the value of the render scale parameter and got an increase in FPS. Unfortunately, I was hoping for 60 FPS, but now I realise that this is probably not possible in my case. Screenshot at 07-20-51

Nindaleth commented 10 months ago

@YALdysse I'm getting close to double the FPS when decreasing the render scale on my machine, you're almost there too.

I'm wondering... you're on Manjaro which is an Arch derivative, in other words (AFAIK) very recent package versions should be available to you. However, your Mesa version 23.1.x was initially released back in May with only bugfixes done afterwards in that series, maybe there's a chance you could get a few more FPS by updating to the newest version? If it's worth it for you to try, 23.3.x should be available in repos.

EDIT: Fixed my comment slightly - I've misread the Mesa version from your MangoHUD, not sure why there's a 23.1.2 listed too in addition to 23.1.9.

thokkat commented 10 months ago

I tested on a 6650U which should have about the same graphics performance as 5500U. I get ~50 fps in that test scene with nativ rendering, so double performance. Make sure ray tracing is turned off by using -rt 0 command line option. Should be off for igpus but isn't in this case.

not sure why there's a 23.1.2 listed too in addition to 23.1.9.

This is the Manjaro version, confusingly looks like mesa.

Nindaleth commented 10 months ago

This is the Manjaro version, confusingly looks like mesa.

Oh... my mistake :eyes: Thanks for the explanation.

Try commented 10 months ago

I think we can close this particular ticket - changing resolution helps and readme on graphics settings is updated.

For general graphics-optimization stuff we have now: https://github.com/Try/OpenGothic/discussions/568