# Mesh Distance Fields Seem Broken Project-Wide

**URL:** <https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109>\
**Category:** Rendering\
**Tags:** Shadows, unreal-engine, UE5-0, Rendering, Lighting, question\
**Created:** [September 5, 2022, 6:29pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109 "2022-09-05T18:29:37Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 5, 2022, 6:29pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/1 "2022-09-05T18:29:37Z")

</div>

Hi all,

I’m having an issue with Mesh Distance Fields- sort of greasy, splotchy shadows that (from my research) are a common symptom of meshes that aren’t playing nice with MDF generation. However, as I’ve dug deeper into the issue, I’m coming to believe that, in my case, that’s not what’s going on- For a couple of reasons.

Firstly, the artifacts are present even on the default Material Sphere- If you look carefully, you’ll see some subtle splotching on the sphere- that’s not image compression, that’s actually in-engine. It’s pretty obvious in motion.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/8/2a8978e413f8fcd1a2787be05cb14c604eb2a383.jpeg) ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/3/233a728636b4d13e9886787ddd6bb796507846e9.jpeg)

And here’s a shot of the material graph:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/7/eb7e09a1d932c0f7adf9cd915287fd07c4d865b6.png)

Of course, splotching isn’t there without Mesh Distance Fields enabled.

The next issue is that, when I visualize mesh distance fields, there’s a lot of this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/8/fb8f1dc52de5e96abec03aa57269d777c780810e.jpeg) ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/0/b/e0baa6f8dcf874108a9d86f1937c539100a4aa06.jpeg) ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/4/6a4f629294c29f1f74a1146f358567fbc941786e.jpeg)

I’ve never seen any other images of Mesh Distance Fields that look like this. But then there are meshes where the effect is even more extreme, like this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/8/738d1880db81067763ef5d47a79164c71f269970.jpeg) ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/d/3cdb8adb8e1a147bc7ef938697be165b0386d048.jpeg)

and this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/b/90bef17960fe22389e09169f519a12f56ae1a06d.jpeg) ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/0/bf0669ac133d8a4d73f4335bde7d2a11c8018cba.jpeg)

I have tested many individual meshes. None have holes, or are scaled irregularly. No mesh-specific MDF settings seem to have any impact on the resulting fields, aside from straight up disabling them. Another thing: this error has been present since I started the project back in like 4.24 or 4.25, and it’s still here in 5.0. It doesn’t go away when I build the project either.

I’ve been struggling with this issue for a couple of years now. Any help, or insights would be amazing.

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 8, 2022, 5:35pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/3 "2022-09-08T17:35:35Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 10, 2022, 8:34pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/4 "2022-09-10T20:34:25Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 14, 2022, 3:57am UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/5 "2022-09-14T03:57:04Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![ZacD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZacD](https://forums.unrealengine.com/u/ZacD)\
**Post date:** [September 14, 2022, 4:43am UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/6 "2022-09-14T04:43:22Z")

</div>

Could be a few things, the size of the meshes, how they are constructed, or the the mesh distance field resolution needs to be turned up.

Mesh Distance fields tend to work best with modular scenes made up of around 5x5x5 meter or less static meshes. Also meshes tend to work better if they aren’t too concave and are solid air tight meshes with no open edges.

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 14, 2022, 2:34pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/7 "2022-09-14T14:34:47Z")

</div>

Changing the size and construction of meshes has no effect on the results of the MDF. I’ve also experimented with MDF resolution, which has done nothing. Also, all of my meshes are airtight and the first, third, and last mesh that I showed are fully convex.

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [September 15, 2022, 6:40am UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/8 "2022-09-15T06:40:28Z")

</div>

Looks like the typical issue you get when you try to use two-sided distance fields in UE5

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/3/7a3ccfbb342a0d1b1902fead3c749d1171b65b3a.jpeg)

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 15, 2022, 3:00pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/9 "2022-09-15T15:00:39Z")

</div>

As mentioned in the original post, I already tried all the mesh-specific MDF settings including two-sided distance field generation. It had no or minimal impact on the results

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [September 15, 2022, 3:24pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/10 "2022-09-15T15:24:27Z")

</div>

When you tried this, did you actually press “apply”? Because if you just save the mesh, it will not regenerate the distance field, you need to actually press the apply button first.

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 15, 2022, 3:39pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/11 "2022-09-15T15:39:38Z")

</div>

Yes, I did

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [September 15, 2022, 3:50pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/12 "2022-09-15T15:50:16Z")

</div>

How were these meshes created? Seems your trees have escaped this fate, did you make those the same way?

Also I know this sounds stupid but have you tried simply reimporting the meshes?

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 15, 2022, 4:20pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/13 "2022-09-15T16:20:49Z")

</div>

It was the same person who made all the meshes. I’ve inspected them carefully and I haven’t found any meaningful differences- no doubled up vertices or anything weird like that. Reimporting them doesn’t work either unfortunately

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [September 20, 2022, 1:42pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/14 "2022-09-20T13:42:02Z")

</div>

Update: I recently imported a kitbashed mesh (so it does break MDF best practices) and the MDF artifacts are now moving. They sort of wiggle back and forth and ripple along the artifacted sections of the mesh.

---

<div class="post-metadata">

**Author:** ![ZacD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZacD](https://forums.unrealengine.com/u/ZacD)\
**Post date:** [September 26, 2022, 6:24pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/15 "2022-09-26T18:24:09Z")

</div>

Using two sided materials can also cause this issue.

---

<div class="post-metadata">

**Author:** ![souHad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@souHad](https://forums.unrealengine.com/u/souHad)\
**Post date:** [October 12, 2022, 5:03pm UTC](https://forums.unrealengine.com/t/mesh-distance-fields-seem-broken-project-wide/642109/16 "2022-10-12T17:03:14Z")

</div>

That did the trick, thanks!
