Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making relief mapping faster #1136

Open
illwieckz opened this issue May 12, 2024 · 1 comment
Open

Making relief mapping faster #1136

illwieckz opened this issue May 12, 2024 · 1 comment
Labels
A-Renderer T-Improvement Improvement for an existing feature

Comments

@illwieckz
Copy link
Member

illwieckz commented May 12, 2024

Relief mapping is slow, here are some framerate recorded on my system with all of our presets and for each of them I enabled and disabled relief mapping. This is recorded for a 4K screen resolution on an AMD Radeon PRO W7600.

preset RM off RM on
lowest 1250 fps 780fps
low 1100 fps 650 fps
medium 600 fps 330fps
high 580 fps 280 fps
ultra 580 fps 290 fps

This single feature removes 500 fps from the framerate of lowest and low presets, and 300 fps from the framerate of medium, high and ultra presets.

Actually don't ask me why with ultra preset and relief mapping enabled I get 10 fps more than with high and same feature enabled, I tested multiple time and reproduced it. 🤔️

Anyway, the root problem addressed by this issue is the slowness of relief mapping.

The big performance loss between low and lowest presets compared to medium, high and ultra is the enablement of multitexturing with normal mapping, specular mapping, etc. which adds a lot of code and binds many more textures. We may also lose performance in some way we switch between shaders (something the material branch attempts to fix).

But, the relief mapping single handledly consumes as much as performance as all the features enabled in medium presets.

Among possible improvements we may investigate, @SomaZ said this in developper chat channel:

texture2d is usually slow in loops. using textureGrad can improve performance as it doesnt need to determine mips again and again

Here is some Khronos documentation about textureGrad:

@illwieckz illwieckz added T-Improvement Improvement for an existing feature A-Renderer labels May 12, 2024
@illwieckz
Copy link
Member Author

I forgot to say the scene I used for the benchmark was plat23 default spectator scene.

When running the game at 4K with relief mapping enabled, the game CPU usage is only 32%, so the game is waiting on the GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Improvement Improvement for an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant