Distortion performance


I want to improve distortion performance.

I know one way is reduce the count of static meshes used distortion material.

Could you suggest another way to improve distortion performance? maybe add some codes for it.

The GPU cost of the distortion pass is usually due to pixel shader overhead. To bring the cost down, there are a few things you can do:

  • Try to reduce the amount of overdraw of any effects rendering into the distortion buffer (e.g. reduce the size of particles, reduce the spawn rate)
  • Reduce the complexity of materials which write to distortion (in particular, simplifying the graph which outputs through the refraction pin, reducing texture samples and instructions)
  • Somewhat obvious, but disabling distortion on any materials which don’t need it will definitely help!

These are just general guidelines. If you’re seeing a particular issue then it may be worth using a graphics profiler (e.g. RenderDoc or Intel GPA) to capture the frame and drill down into the cause. That should show you what you’re bound on, and also which assets are causing problems. If you do this, make sure to enable draw events first with the toggledrawevents console command. The command showmaterialdrawevents can give you more detail about the materials and assets being rendered if you need it.