# Draw Material To Render Target node has inverted alpha

**URL:** <https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244>\
**Category:** Rendering\
**Tags:** UE4-13, unreal-engine, bug-report, Rendering, Blueprint, question\
**Created:** [August 5, 2016, 3:59pm UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244 "2016-08-05T15:59:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![astonish](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@astonish](https://forums.unrealengine.com/u/astonish)\
**Post date:** [August 5, 2016, 3:59pm UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/1 "2016-08-05T15:59:08Z")

</div>

I was trying the new Draw Material To Render Target node in 4.13 Preview 1 and it seems that its default behaviour produces inverted alpha in the render target.

Here is my test setup using a blank C++ project:

Import a PNG with alpha as a texture

Right click the texture asset and make a material. Set the material to Translucent Unlit. Wire it up with emissive/opacity:

![101626-basic_mat.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/8/658a474599863115a25d627fda697a6f90b89a7b.png)

Make a pass through material to draw your Render texture to a static mesh. Again make it Translucent Unlit.

![101627-passthrough.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/8/0d85fe500c2b6cb2bfd1b8dd4d07f944c0ebbdca.png)

Create the following BP. Add a static mesh (I used starter cube) and assign its material to the passthrough mat. Next the BP creates a canvas RT and draws the alpha texture material to it. Set the RT to the texture param of the passthrough mat.

 ![101630-blueprint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/e/21e852e5df4423ef278f7ad83a06ecc4b306f39e.png)

Place the actor in the world and I get the following result.

 ![101628-outcome.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/6/f66c65ec43d139b3f408ecde339af97c471b0339.png)

If I add a 1-x node from the InTex texture parameter to the material opacity output for the passthrough material I get the expected results:

 ![101629-ue413.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/7/ab7ced14b590d7f084f5a79645262a31061371fd.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6e7b421a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6e7b421a](https://forums.unrealengine.com/u/anonymous_user_6e7b421a)\
**Post date:** [August 5, 2016, 8:43pm UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/2 "2016-08-05T20:43:34Z")

</div>

Hey astonish,

I was able to reproduce this issue on my end and have gone ahead and entered a bug report for this issue, UE-34314. You can track this report on our new Known Issues tracker **[here](https://issues.unrealengine.com/issue/UE-34314).**

Let me know if you have further questions or need additional assistance.

Cheers,

---

<div class="post-metadata">

**Author:** ![Spoondog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spoondog](https://forums.unrealengine.com/u/Spoondog)\
**Post date:** [August 10, 2016, 2:56am UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/3 "2016-08-10T02:56:02Z")

</div>

You may want to add to the issue that this isn’t limited to the new DrawMaterial function - the alpha is also inverted now on translucent objects being rendered by a SceneCapture2D actor (but I’m guessing it’s the same cause).

In the below screenshot I am using a SceneCapture2D off-screen to capture some falling leaves (so that I can use the rendered falling leaves texture in UMG to “wipe away” my loading screen). Note the inverted alpha (it works as expected in 4.11):

 ![102228-inverted_alpha.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/7/ea76b7d4b7613ae0ac0506b9cbffa7301fc3bc9a.png)

(Hoping this can be fixed for the full 4.13 release)

---

<div class="post-metadata">

**Author:** ![astonish](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@astonish](https://forums.unrealengine.com/u/astonish)\
**Post date:** [August 10, 2016, 2:07pm UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/4 "2016-08-10T14:07:13Z")

</div>

Yep, I do some custom rendering of a material to UCanvasRenderTarget2D’s in C++ for our project. In 4.11 transparency was straight up broken and I had to render the alpha to a separate RT, in 4.12 I can do it to a single target, but the alpha is inverted as it is in 4.13. If you invert the alpha in the source material the color channels come out black in 4.12

---

<div class="post-metadata">

**Author:** ![astonish](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@astonish](https://forums.unrealengine.com/u/astonish)\
**Post date:** [August 11, 2016, 1:27am UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/6 "2016-08-11T01:27:48Z")

</div>

Thanks for the explanation DanielW. I haven’t had any trouble working with the feature as is, but having code to loop through a TArray to val.A = 255 - val.A; made me shiver a bit on large buffers so I was hoping to gain a bit of perf.

---

<div class="post-metadata">

**Author:** ![Spoondog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spoondog](https://forums.unrealengine.com/u/Spoondog)\
**Post date:** [August 16, 2016, 12:17am UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/7 "2016-08-16T00:17:44Z")

</div>

I’ve un-one-minused my material so it’s fixed on PC - but on **mobile** ES2 now it is backwards (so it’s inverted on one platform and not the other) - I can get around this with a platform switch, but they should probably be brought to parity?

---

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [October 21, 2017, 7:54pm UTC](https://forums.unrealengine.com/t/draw-material-to-render-target-node-has-inverted-alpha/366244/8 "2017-10-21T19:54:11Z")

</div>

## In 4.17 my workaround is:

- Set draw material to AlphaComposite blend mode;
- Use standard Alpha (not inverted) on draw material;
- Set the passthrough material to use inverted alpha output from RenderTexture (OneMinus node);
- Clear RenderTexture to (0, 0, 0, 1) before drawing.
