I’ve been working on a shader for a real-time rendering project, but I’m struggling with performance optimization. The shader looks great, but it causes a noticeable drop in FPS, especially on lower-end GPUs. I’m mainly using HLSL and working within Unreal Engine. Are there any best practices for reducing shader complexity…
you've got access to insights and gpu capture tools in unreal - you can also get things like renderdoc working so analysing a capture is easy enough. there is also the potential for branching to cause the gpu to stall while doing on demand shader compilation - not sure how bad the issue is on current unreal versions…
Working with mobile GPUs a few years ago, we found the use of Pow was a big non-no for perf. So I had to use Add and Sub and Mult instead. I seem to recall some Unreal docu about shader perf, have you searched? It might be specifically for mobile.
A lot of shader performance comes down to your textures as well. If you can get away with less textures being accessed, you'll do better. Many materials just need a monochromatic albedo, tinted a color, so you can compress to the red channel, and pack other maps in with it. It's better to pack materials into less textures,…
at the most basic level.... you usually just start commenting stuff out and see what effect it has on frame rate or drop in a basic shader just to check its the root cause of slow down. Though you may need to accept that you need lower graphic quality on lower end cards.
Just saw this in my feed, maybe useful? https://www.linkedin.com/posts/wojciech-sterna-193a7b44_here-is-how-in-unreal-engine-5-i-profile-activity-7307698546730786816-Z9oA