# Render to Texture Bug When "Enable GPUScene on Mobile" is Active

**URL:** <https://forums.unrealengine.com/t/render-to-texture-bug-when-enable-gpuscene-on-mobile-is-active/1262786>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [August 16, 2023, 11:08am UTC](https://forums.unrealengine.com/t/render-to-texture-bug-when-enable-gpuscene-on-mobile-is-active/1262786 "2023-08-16T11:08:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cywater2000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cywater2000](https://forums.unrealengine.com/u/cywater2000)\
**Post date:** [August 16, 2023, 11:08am UTC](https://forums.unrealengine.com/t/render-to-texture-bug-when-enable-gpuscene-on-mobile-is-active/1262786/1 "2023-08-16T11:08:05Z")

</div>

Below is the Blueprint code demonstrating the bug:

 ![q1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/8/fb8a2cfa37e859ccf1d524875dfcd649242f698e.jpeg)

I have two Render Targets, A and B.

1. At the start of each frame, I first copy the contents of B to A (using `UKismetRenderingLibrary::DrawMaterialToRenderTarget`).
2. Then, I render a default texture (`DefaultTexture`) at the center position on A (using `UCanvas::K2_DrawTexture`).
3. Finally, I copy the contents of A to B (using `UKismetRenderingLibrary::DrawMaterialToRenderTarget`).

The Material used for copying simply offsets the Render Target’s coordinates slightly and then outputs the sampled pixel value to the Emissive Color.

 ![q3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/0/a7015c9a29d1cc78d022429b3a0ef5f191340006.png)  
The expected effect is that the `DefaultTexture` will tile diagonally across A and B.  
 ![q2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/c/e8cd4e7261ec3ffa3edd6877a9ab549075be3634.png)

It runs fine on the PC platform, achieving the expected result. If I change the platform preview to Android ES3\_1, it also works well. However, once I enable the “Enable GPUScene on Mobile” option, a bug appears on Android ES3\_1, while the PC remains correct.  
Under Android ES3\_1, you will find that only one `DefaultTexture` appears on both A and B.

 ![q4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/0/970cb5fc3ab2e57743404d5e46ed6eba8ce9768e.jpeg)

Further testing revealed that in the first step, i.e., the call where B is copied to A, the Render Target (B) read inside the Material has no data.

What could be the reason for this? Is this a bug in UE? It occurs in versions 5.0 to 5.2. Thank you.

---

<div class="post-metadata">

**Author:** ![cywater2000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cywater2000](https://forums.unrealengine.com/u/cywater2000)\
**Post date:** [August 18, 2023, 9:44am UTC](https://forums.unrealengine.com/t/render-to-texture-bug-when-enable-gpuscene-on-mobile-is-active/1262786/2 "2023-08-18T09:44:13Z")

</div>

Upon further investigation, I found that the Render Target (RT) is being cleared every frame, as demonstrated in the following Blueprint:

1. Every frame, data is written to the RT using `UKismetRenderingLibrary::DrawMaterialToRenderTarget`.  

2. The Material being used is a simple one, with a value of 0.1 connected to the Emissive Color. Additionally, the Blend Mode is set to Additive.  

3. On the PC platform and mobile platforms without GPUScene enabled, the RT’s color becomes white due to additive blending.  
 ![qq4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/1/0b17353d12bfaa50d6bfa2282bbd161c47f6edd1.png)

However, in the erroneous case (on mobile platforms with GPUScene enabled), the RT’s color remains gray (0.1).  
 ![qq3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/1/c/91c37d811bf5355f21b1aed3fa8fcf2259655383.png)

---

<div class="post-metadata">

**Author:** ![cywater2000](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cywater2000](https://forums.unrealengine.com/u/cywater2000)\
**Post date:** [August 21, 2023, 8:41am UTC](https://forums.unrealengine.com/t/render-to-texture-bug-when-enable-gpuscene-on-mobile-is-active/1262786/3 "2023-08-21T08:41:42Z")

</div>

I tested on UE4.27, and the same test case works correctly under the condition ‘r.Mobile.SupportGPUScene=1’. It seems to be a bug in UE5, indeed?

 ![q4.27](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/6/cc66dc6f642e4204e1789335c045e0509d19ce69.jpeg)
