# MSAA breaks post process material that compares scene depth and custom depth

**URL:** <https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008>\
**Category:** Rendering\
**Tags:** Post-Processing, msaa, custom-depth, Forward-Rendering, unreal-engine, question\
**Created:** [August 27, 2017, 9:20pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008 "2017-08-27T21:20:24Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Envieous](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/envieous/32/1194501_2.png) [@Envieous](https://forums.unrealengine.com/u/Envieous)\
**Post date:** [August 27, 2017, 9:20pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/1 "2017-08-27T21:20:24Z")

</div>

I’m not sure whether this is an issue that’s just inherent to MSAA or not, but I can’t seem to find any proper information on this issue.

1. Download 's outline shader. [Multi-color Outline Post Process - Tom Looman](http://www.tomlooman.com/multi-color-outline-post-process-in-unreal-engine-4/)

2. Enable Forward Renderer

3. Set custom depth stencil pass to enabled with stencil

4. Create a new material with a base color input of 0.1

5. Create an unbound post process volume using the post process material.

6. Create some spheres and place them in a similar manner to what’s shown below. Enable custom depth on them and set their custom depth stencil value to 254. Apply the material we made previously to them to improve visibilty of the effect.

7. Observe the effect rendering correctly

 ![211318-fxaa.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/0/c20481af853a71005d1a6830183d081a5b22b663.png)

1. Switch to MSAA with atleast 2 samples.

2. The effect no longer works correctly.

 ![211319-msaa.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/7/4270889b04e2a77c7a61afe7ebcb029bb13ba2fe.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [August 31, 2017, 5:26pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/2 "2017-08-31T17:26:08Z")

</div>

Hey,

Could you provide a sample project that shows the behavior you’re seeing. When following your reproduction steps, I don’t see any difference in the spheres between steps 7 and 9. Additionally, this issue seems to be mentioned at the bottom of the download page you linked. As mentioned there, can you try replacing the occlusion test with the setup provided ?

---

<div class="post-metadata">

**Author:** ![Envieous](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/envieous/32/1194501_2.png) [@Envieous](https://forums.unrealengine.com/u/Envieous)\
**Post date:** [September 1, 2017, 3:17am UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/3 "2017-09-01T03:17:25Z")

</div>

Hi . Here is the project.

[https://www.dropbox.com/s/f5b0xfzi5yi65d9/MSAADepth.zip?dl=0](https://www.dropbox.com/s/f5b0xfzi5yi65d9/MSAADepth.zip?dl=0)

Just toggle between MSAA and FXAA/TAA, and the issue should appear.

The posts from the material’s page are mine, as is the workaround which I found after I made this post. However the workaround is noticeably less accurate and doesn’t fully solve the issue.

Basically the issue seems to stem from this:

 ![211818-msaadepthbug.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/c/8ac6c6df2c6ded0a8b345565caf7a2720bba2b59.jpeg)

This is a screenshot taken from another project. One under MSAA, the other under FXAA, while using the post process material below. The depth comparison produces entirely different (incorrect) results under MSAA.

 ![211819-depthmat.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/c/25c8e754abab1c1119365fdbc3547b8c1fff3429.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [September 15, 2017, 7:00pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/4 "2017-09-15T19:00:55Z")

</div>

Hey-

Sorry for the delayed response. I have entered a report based on the sample project you provided: [Unreal Engine Issues and Bug Tracker (UE-49851)](https://issues.unrealengine.com/issue/UE-49851) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers

---

<div class="post-metadata">

**Author:** ![MillhouseOne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MillhouseOne](https://forums.unrealengine.com/u/MillhouseOne)\
**Post date:** [November 22, 2017, 8:19pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/5 "2017-11-22T20:19:14Z")

</div>

I too am running into this, but noticed the issue is flagged as “won’t fix.”

Is there an alternate approach we can rely on or is there any insight into why this will not be fixed?

---

<div class="post-metadata">

**Author:** ![MillhouseOne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MillhouseOne](https://forums.unrealengine.com/u/MillhouseOne)\
**Post date:** [November 22, 2017, 8:20pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/6 "2017-11-22T20:20:37Z")

</div>

Would you mind sharing your workaround? I’m running into this as well but your project’s dropbox link has expired.

---

<div class="post-metadata">

**Author:** ![Envieous](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/envieous/32/1194501_2.png) [@Envieous](https://forums.unrealengine.com/u/Envieous)\
**Post date:** [November 23, 2017, 3:06am UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/7 "2017-11-23T03:06:51Z")

</div>

https://

That was how I solved it. It’s not as accurate, but for my needs it didn’t need to be.

---

<div class="post-metadata">

**Author:** ![MillhouseOne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MillhouseOne](https://forums.unrealengine.com/u/MillhouseOne)\
**Post date:** [November 23, 2017, 4:47am UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/8 "2017-11-23T04:47:35Z")

</div>

Ah, thanks for posting! I need a little more accuracy, but hopefully your post will help someone else in a similar situation.

---

<div class="post-metadata">

**Author:** ![Mathias\_Wenzel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mathias_wenzel/32/934891_2.png) [@Mathias\_Wenzel](https://forums.unrealengine.com/u/Mathias_Wenzel)\
**Post date:** [April 10, 2018, 8:46pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/9 "2018-04-10T20:46:36Z")

</div>

This picture is not avaiable anymore. Can you repost your solution ? Thanks in Advance

---

<div class="post-metadata">

**Author:** ![Envieous](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/envieous/32/1194501_2.png) [@Envieous](https://forums.unrealengine.com/u/Envieous)\
**Post date:** [April 10, 2018, 8:49pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/10 "2018-04-10T20:49:57Z")

</div>

![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/2/ff2d61a366023addd443e2150ec3d23ccc44235b.jpeg)

---

<div class="post-metadata">

**Author:** ![nyronic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nyronic](https://forums.unrealengine.com/u/nyronic)\
**Post date:** [April 14, 2018, 1:08am UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/11 "2018-04-14T01:08:28Z")

</div>

Any update on this? We’re also running into this issue with MSAA and scenedepth.

---

<div class="post-metadata">

**Author:** ![PicaroonX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PicaroonX](https://forums.unrealengine.com/u/PicaroonX)\
**Post date:** [May 21, 2018, 10:06am UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/12 "2018-05-21T10:06:00Z")

</div>

Any update on this? We’re also running into this issue with MSAA and scenedepth.

---

<div class="post-metadata">

**Author:** ![UJ.Choi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UJ.Choi](https://forums.unrealengine.com/u/UJ.Choi)\
**Post date:** [November 5, 2019, 2:57pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/13 "2019-11-05T14:57:36Z")

</div>

Any update on this? We are running into this issue and wasted tons of time just to find it flagged “Won’t Fix”

---

<div class="post-metadata">

**Author:** ![Andr3wV](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Andr3wV](https://forums.unrealengine.com/u/Andr3wV)\
**Post date:** [June 23, 2020, 9:00pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/14 "2020-06-23T21:00:43Z")

</div>

Yes, what is the correct solution then if this is not something that will be fixed?

---

<div class="post-metadata">

**Author:** ![Andr3wV](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Andr3wV](https://forums.unrealengine.com/u/Andr3wV)\
**Post date:** [June 23, 2020, 9:38pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/15 "2020-06-23T21:38:25Z")

</div>

Can confirm this workaround worked with mobile MSAA for me.

---

<div class="post-metadata">

**Author:** ![BEEENTHERE](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/beeenthere/32/88714_2.png) [@BEEENTHERE](https://forums.unrealengine.com/u/BEEENTHERE)\
**Post date:** [October 21, 2021, 10:56pm UTC](https://forums.unrealengine.com/t/msaa-breaks-post-process-material-that-compares-scene-depth-and-custom-depth/403008/16 "2021-10-21T22:56:45Z")

</div>

+1 I would kindly appreciate an brief explanation on why this is marked as “won’t fix.” And ideally any information regarding an alternative approach for using MSAA and custom depth would be great.
