Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

[4.15 p2] MSAA and Alpha2Coverage problem


The forward renderer is really awesome. But with MSAA and masked materials, too much of the texture is masked out by default. It is worse with 2x MSAA than with 4X.

Here is an image using the UE4 VR template and Epic assets to illustrate the problem.

alt text

To fix this, the opacity mask clip value has to be lowered by a significant amount. So i ended up with a workaround. Changing the DiscardMaterialWithPixelCoverage fuction in MaterialTemplate.usf to adjust the clip values globally, when MSAA is on. Scaling MaskClip by 0.1 fixed the issues.

I'am not sure if this is a bug, but it would be good if this would somehow work by default, so that masked materials look the same with all Anti-Aliasing methods.

Brest Regards Michael

Product Version: UE 4.15 Preview
msaa.png (3.0 MB)
more ▼

asked Jan 31 '17 at 01:28 PM in Rendering

avatar image

106 7 13 15

avatar image 0lento Jan 31 '17 at 08:51 PM

I noticed this as well. It's an issue with speedtrees as leaves also get smaller when you go further away from the tree. Effect is so bad that the leaves almost vanish in the end.

avatar image AndrewHurley Feb 01 '17 at 08:20 PM

Hey guys,

So what you are seeing is expected since Alpha to Coverage is not yet supported with MSAA and Forward Rendering. We have plans to get this implemented, but I do not currently have a timeframe as to when that will be. For now, I would use your global clipping value workaround.

We highlighted these unsupported features in the 4.14 Release notes which you can view by following the link I have provided below.


Thank you,

Andrew Hurley

avatar image HEGI Feb 02 '17 at 01:51 AM

Thanks Andrew for the headsup.

The behaviour of masked materials in 4.15 is different than in 4.14 and Alpha to Coverage is listed as supported feature here. https://docs.unrealengine.com/latest/INT/Engine/Performance/ForwardRenderer/index.html

In 4.14 there was no Anti-Aliasing at all on masked materials. And in 4.15 Alpha to Coverage is mentioned alot in the shader code. It just has the bug, of masking out too much from the texture, but the Anti-Aliasing works.

avatar image AndrewHurley Feb 02 '17 at 06:48 PM

Okay, well I am going to get clarification on whether or not it is officially supported in the 4.15 release, but I entered a ticket to have the information clarified and uniform.

Once I get the answer, we can investigate more into the issue you are experiencing. I will say that the large disclaimer at the top of the documentation link you provided applies to all the associated features, so it is expected certain features are not production ready yet. Thanks,

Andrew Hurley

avatar image HEGI Feb 03 '17 at 12:16 AM

Thanks! Some clarification would indeed be good. But yea, i understand that the "experimental" applies to the listed features aswell. I'am fine with the workaround right now.

avatar image HEGI Feb 03 '17 at 01:08 AM

Also, here is the simple workaround. A function change in MaterialTemplate.usf . Line 1739 .

 uint DiscardMaterialWithPixelCoverage(FMaterialPixelParameters MaterialParameters, FPixelMaterialInputs PixelMaterialInputs)
         float OriginalMask = GetMaterialMaskInputRaw(PixelMaterialInputs);
         float MaskClip = GetMaterialOpacityMaskClipValue();
         if (View.NumSceneColorMSAASamples > 1)
             MaskClip = MaskClip * 0.05; //Workaround for Alpha2Coverage
             float Mask = (OriginalMask - MaskClip) / (1.0 - MaskClip);
             uint CurrentPixelCoverage = GetDerivativeCoverageFromMask(Mask);
             clip(float(CurrentPixelCoverage) - 0.5);
             return CurrentPixelCoverage;
         clip(OriginalMask - MaskClip);
         return 0xF;
avatar image spidershift Feb 17 '17 at 09:45 PM

Thank you for posting a workaround. I tried this and while it helped a little bit the fading problem still seems to exist after the 4.15 update. The pictures you posted were relatively close to the trees but in practice things are much worse when farther away in a more realistic scenario.

I'm wondering if there is some way to disable this new alpha to coverage feature completely? I really like the new renderer especially for MSAA but after this update things just look ridiculous. I'm really surprised this slipped through the cracks because it's extremely noticeable especially when opening any nature map.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

This is a workaround to help with the visual banding that appears when using MSAA and Alpha to Coverage, but perhaps it will also help with the masking issues here?

To get a result closer to the deferred renderer, you can make your OpacityMask input into a steeper gradient. For example if you have an OpacityMaskClipValue of .33, you can do a Mul with 5 and then Subtract (.33 * 5). This will make the OpacityMask gradient steeper, pushing the translucent bands closer together, but keeping the value .33 in the same spot.

There are no updates to this issue as of now, but it is on our roadmap to be improved.


Andrew H.

more ▼

answered Jun 15 '17 at 07:10 PM

avatar image HEGI Jun 16 '17 at 10:21 AM

Thanks Andrew, this works.

It can also be added to GetMaterialMaskInputRaw in MaterialTemplate.usf to make this global. This means less control ofc. Making a material function is probably the best way.

For people with this issue, you can check for MSAA with a custom material node using View.NumSceneColorMSAASamples

I also noticed that it seems to work pretty well with MSAA 4x now without any changes. This is also mentioned in the CustomAlpha2Coverage function in BasePassPixelShader.usf . It says todo: support non 4xMSAA as well. So it seems something is moving forward(no pun) there. :)

Best Regards


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Alpha to coverage in the forward renderer with MSAA is indeed a new supported feature in 4.15. Thanks for pointing out the coverage difference vs non-MSAA. We'll investigate and find a solution for this. I don't know when we'll get to it though.

more ▼

answered Feb 06 '17 at 08:15 PM

avatar image

1.9k 31 11 72

avatar image HEGI Feb 06 '17 at 11:19 PM

Great to hear ,thanks!

avatar image andtheand Feb 19 '17 at 07:33 PM

Just found this thread after I posted here: https://answers.unrealengine.com/questions/564774/strange-outline-against-the-sky-with-foliage-in-41.html

Is this the same problem? I'm using a BP only project so this workaraound doesn't work for me...

avatar image AndrewHurley Feb 20 '17 at 04:09 PM

Hey andtheand,

It does look like your issue could be from MSAA alpha to coverage. We are aware of issues like this, and you we ask you remain patient until we can officially address for an upcoming release.

We have no timeframe, and the only suggestions I have would be to try and edit the masked clipping value within your material, or disabling the Forward Renderer and stick with the default method of Temporal AA.

Thank you,

Andrew Hurley

avatar image andtheand Feb 20 '17 at 07:37 PM

please give this problem some priority. For every VR project MSAA is essential but can't be used in any nature environment with this behaviour. Thanks!

avatar image HEGI Jun 14 '17 at 04:08 PM

Sadly, the workaround does not work anymore in 4.16.

Are there any news on another fix ?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question