# GPU performance tuning of "HZB SetupMips" (As seen in GPU Visualizer)

**URL:** <https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** gpu, unreal-engine, Performance, question\
**Created:** [June 6, 2016, 5:17am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788 "2016-06-06T05:17:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joachim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Joachim](https://forums.unrealengine.com/u/Joachim)\
**Post date:** [June 6, 2016, 5:17am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/1 "2016-06-06T05:17:33Z")

</div>

Hi guys,

I need to optimize the GPU performance of a mobile VR game and tried “ProfileGPU” to view the GPU Vizualizer.  
This is what it looks like:

 ![93517-gpu_profiling.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/5/bc5f58b7a48e3d5ac14504e6812a7ebd57ebc6c8.jpeg)

Now I’m wondering about how to optimize the top offender “HZB SetupMips…” that costs 3.21ms.  
**Any ideas where that cost comes from and how I improve it?**

The level is mainly a big landscape that’s dynamically tesselated and obviously got a lot of texture repeats until the horizon line. And I use lightmapping.

I tried to change the Mip settings of the terrain textures I used (“Mip Gen Settings” and “Global Force Resident Mip Levels”) but that did not change much. (Or anything…)

Any other ideas?  
Thank you.

---

<div class="post-metadata">

**Author:** ![Jaatuli](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jaatuli](https://forums.unrealengine.com/u/Jaatuli)\
**Post date:** [June 14, 2016, 1:19pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/2 "2016-06-14T13:19:31Z")

</div>

I am interested in this as well. Could not find any documentation or answers clarifying this.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_fe58dae7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fe58dae7](https://forums.unrealengine.com/u/anonymous_user_fe58dae7)\
**Post date:** [June 15, 2016, 1:24am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/3 "2016-06-15T01:24:10Z")

</div>

Also getting this using the SteamVR template made from Proteus:

> **[Steam VR Template](https://forums.unrealengine.com/showthread.php?106609-Steam-VR-Template)**
>
> Steam VR Template 2.0 Instruction guide found in the onedrive Demo video found at SteamVR Template 2.0 for HTC Vive and Oculus Rift - YouTube &stc=1 So, what this is about? This template consists of HTC Vive and Oculus Rift compatible pawns...

but it’s taking 5.38 ms

 ![94657-gpuvis1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/9/6e968bc8285c6b94001c29f282baa8e2f34a6a66.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e9d92aa7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e9d92aa7](https://forums.unrealengine.com/u/anonymous_user_e9d92aa7)\
**Post date:** [June 20, 2016, 11:54pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/4 "2016-06-20T23:54:55Z")

</div>

Hi guys, I am also experiencing this issue.  
I think it may be a 4.12 regression, as we upgraded from a 4.11 build, and this was not an issue in that version. 5ms for this pass on an i7 with a 980ti is insane!  
It seems that it’s a problem that gets worse the longer the editor is running.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_11fb68fb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_11fb68fb](https://forums.unrealengine.com/u/anonymous_user_11fb68fb)\
**Post date:** [June 21, 2016, 5:34am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/5 "2016-06-21T05:34:21Z")

</div>

Also having this issue.

---

<div class="post-metadata">

**Author:** ![Imsopov](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imsopov](https://forums.unrealengine.com/u/Imsopov)\
**Post date:** [June 21, 2016, 10:14am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/6 "2016-06-21T10:14:36Z")

</div>

I am getting the same with out HTC Vive and a GTX 1080

---

<div class="post-metadata">

**Author:** ![Imsopov](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imsopov](https://forums.unrealengine.com/u/Imsopov)\
**Post date:** [June 23, 2016, 1:42am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/7 "2016-06-23T01:42:36Z")

</div>

Anyone have any idea what this is yet?

---

<div class="post-metadata">

**Author:** ![Anonymous\_ce1d55a347b0ac8e20af0526d6c16546](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_ce1d55a347b0ac8e20af0526d6c16546](https://forums.unrealengine.com/u/Anonymous_ce1d55a347b0ac8e20af0526d6c16546)\
**Post date:** [June 28, 2016, 11:44am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/8 "2016-06-28T11:44:33Z")

</div>

the same,some one can help?

---

<div class="post-metadata">

**Author:** ![Imsopov](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Imsopov](https://forums.unrealengine.com/u/Imsopov)\
**Post date:** [June 28, 2016, 11:48am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/9 "2016-06-28T11:48:21Z")

</div>

Has anyone from staff acknowledged this problem?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a6092ea3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a6092ea3](https://forums.unrealengine.com/u/anonymous_user_a6092ea3)\
**Post date:** [July 2, 2016, 11:42pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/10 "2016-07-02T23:42:06Z")

</div>

I had this problem as well. Out of nowhere, my build started seeing HZB Setup Mips of 8ms to 10ms. Luckily I had that build in Perforce, so I just downloaded a fresh build from scrtach, rebuilt my code and reloaded in editor. Now the HZB Setup is down to 0.5ms for the exact same level. Somehow something must get corrupted. Can anyone shed some light? I still have my old broken build.

---

<div class="post-metadata">

**Author:** ![Efrye](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/efrye/32/1194658_2.png) [@Efrye](https://forums.unrealengine.com/u/Efrye)\
**Post date:** [July 7, 2016, 11:09am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/11 "2016-07-07T11:09:39Z")

</div>

It’s happening on my project as well, but restarting the editor appears to help. At least temporarily.

---

<div class="post-metadata">

**Author:** ![RED\_X\_Strike](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RED\_X\_Strike](https://forums.unrealengine.com/u/RED_X_Strike)\
**Post date:** [July 8, 2016, 10:25pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/12 "2016-07-08T22:25:52Z")

</div>

+1 also experiencing the same issue, Titan X and the Vive

---

<div class="post-metadata">

**Author:** ![TooLazyCat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TooLazyCat](https://forums.unrealengine.com/u/TooLazyCat)\
**Post date:** [July 12, 2016, 11:03pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/13 "2016-07-12T23:03:28Z")

</div>

Same in my game. Updated from 4.11 and issue indeed is getting worse the longer editor is running.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_97c4b5d7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_97c4b5d7](https://forums.unrealengine.com/u/anonymous_user_97c4b5d7)\
**Post date:** [July 13, 2016, 5:55pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/14 "2016-07-13T17:55:26Z")

</div>

looking at DeferredShadingRenderer.cpp and SceneOcclusion.cpp (the latter is where that stat is charged via BuildHZB). The following seems to trigger it:

```
if (bSSAO || bHZBOcclusion || bSSR)
	{
		BuildHZB(RHICmdList, Views[ViewIndex]);
	}

```

so you might need the following to disable the call but this might disable screenSpace reflections and ambient occlusion.

```
r.SSR 0
r.HZBOcclusion 0
r.SSR.quality 0
r.AmbientOcclusionLevels 0

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a6092ea3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a6092ea3](https://forums.unrealengine.com/u/anonymous_user_a6092ea3)\
**Post date:** [July 13, 2016, 8:36pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/15 "2016-07-13T20:36:02Z")

</div>

That looks like a good way to side step the problem by disabling the features we wish to use, but it doesn’t address the problem where something seems to get corrupted and inflates HZB SetupMips improperly. Like I mentioned earlier, I saw this problem in my build. I got the exact same content/code from my Perforce depot, rebuilt, and the problem went away. It seems that some data is getting corrupted and causing HZB SetupMips to take excessive amounts of time.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_97c4b5d7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_97c4b5d7](https://forums.unrealengine.com/u/anonymous_user_97c4b5d7)\
**Post date:** [July 13, 2016, 9:11pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/16 "2016-07-13T21:11:55Z")

</div>

yeah I was wondering if you disabled HZB entirely, would the time slowdown still show up but perhaps in the next step – is previous step messing up the state or seem internal to that SetupMips?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ad357589](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ad357589](https://forums.unrealengine.com/u/anonymous_user_ad357589)\
**Post date:** [July 19, 2016, 7:35am UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/17 "2016-07-19T07:35:19Z")

</div>

Bump, this is a serious problem with 4.12, staff please notice! 😃

---

<div class="post-metadata">

**Author:** ![Tim\_Hobson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tim\_Hobson](https://forums.unrealengine.com/u/Tim_Hobson)\
**Post date:** [July 19, 2016, 2:20pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/18 "2016-07-19T14:20:12Z")

</div>

I’ve submitted UE-33448 for this to be investigated. It does seem higher when in the Editor/PIE modes, but when I tried in Standalone game the levels were closer to what I would expect.

Thanks for reporting.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e9d92aa7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e9d92aa7](https://forums.unrealengine.com/u/anonymous_user_e9d92aa7)\
**Post date:** [July 19, 2016, 11:52pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/19 "2016-07-19T23:52:12Z")

</div>

Cheers !

---

<div class="post-metadata">

**Author:** ![muchcharles](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@muchcharles](https://forums.unrealengine.com/u/muchcharles)\
**Post date:** [July 20, 2016, 12:08pm UTC](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788/20 "2016-07-20T12:08:45Z")

</div>

I am seeing this on 4.12 too in the Reflections (subway) example project (edit: just tested and am seeing it in other maps as well)

[Next page](https://forums.unrealengine.com/t/gpu-performance-tuning-of-hzb-setupmips-as-seen-in-gpu-visualizer/359788.md?page=2)
