# Alpha To Coverage - Oculus GO

**URL:** <https://forums.unrealengine.com/t/alpha-to-coverage-oculus-go/440460>\
**Category:** Rendering\
**Tags:** alpha, Oculus, aliasing, unreal-engine, gear-vr, question\
**Created:** [January 2, 2019, 12:43pm UTC](https://forums.unrealengine.com/t/alpha-to-coverage-oculus-go/440460 "2019-01-02T12:43:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jinzay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jinzay](https://forums.unrealengine.com/u/jinzay)\
**Post date:** [January 2, 2019, 12:43pm UTC](https://forums.unrealengine.com/t/alpha-to-coverage-oculus-go/440460/1 "2019-01-02T12:43:40Z")

</div>

Following a lot of experiments in removing aliasing in our Apps i noticed that a significant feature seems to be out of reach.

[Alpha To Coverage](https://medium.com/@bgolus/anti-aliased-alpha-test-the-esoteric-alpha-to-coverage-8b177335ae4f) working with Unity. Also recommended here by [John Carmack.](https://twitter.com/ID_AA_Carmack/status/896723079098970112).

Im looking for tips to enable an already working feature on PC Alpha to Coverage for Oculus Go and Android.  
I hope it solves the Problem that all my masked materials alias very significantly (such as foliage).

---

<div class="post-metadata">

**Author:** ![FcGrreat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FcGrreat](https://forums.unrealengine.com/u/FcGrreat)\
**Post date:** [May 28, 2019, 7:45pm UTC](https://forums.unrealengine.com/t/alpha-to-coverage-oculus-go/440460/2 "2019-05-28T19:45:17Z")

</div>

could you find a solution?

---

<div class="post-metadata">

**Author:** ![jinzay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jinzay](https://forums.unrealengine.com/u/jinzay)\
**Post date:** [July 9, 2019, 11:35am UTC](https://forums.unrealengine.com/t/alpha-to-coverage-oculus-go/440460/3 "2019-07-09T11:35:58Z")

</div>

Here is code i found deep on the Oculus Dev Platforms that allows us to enable Alpha 2 Coverage for Android! So no credits for me please. I updated it for 4.22

Important to note that it increases the cost of masked materials! And there is a Qualcomm forced dithering. It still looks way better, so for some of you it could make sense.

MobileBasePassPixelShader.usf

```
Line 622
        OutColor.a = Opacity;

 Line 664     
        // CHANGE BEGIN
            #if MATERIALBLENDING_MASKED
                #if OUTPUT_MOBILE_HDR
                    if (GetHDR32bppEncodeMode() != HDR_ENCODE_NONE) // FP16 HDR stores Z in framebuffer alpha
                #endif
                {
                    OutColor.a = GetMaterialMaskInputRaw(PixelMaterialInputs);
                }
            #endif
        // CHANGE END

```

OpenGLCommands.ccp

```
Line 1430
            if (RenderTargetBlendState.bAlphaBlendEnable)
            {
                FOpenGL::EnableIndexed(GL_BLEND,RenderTargetIndex);
                glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); //CHANGE
            }
            else
            {
                FOpenGL::DisableIndexed(GL_BLEND,RenderTargetIndex);
                glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); //CHANGE

```

OpenGLDrv.cpp

```
Line 620
        // Intel HD4000 under <= 10.8.4 requires GL_DITHER disabled or dithering will occur on any channel < 8bits.
        // No other driver does this but we don't need GL_DITHER on anyway.
        glDisable(GL_DITHER);
        
        glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); //CHANGE
    
        if (FOpenGL::SupportsFramebufferSRGBEnable())
        {
```
