Scene Capture 2D on Mobile

I have a pawn with a Scene Capture 2D component. It throws the result into a render target which is then used in a material. It all works fine on pc, even in mobile preview mode, but the material ends up black on mobile.

Am I doing something wrong? Is there a reason for it not being supported by Unreal?

me too, do you find any solution?

me too, but not only the scene Capture 2D.
Set material to widget image on mobile has the same problem.
My sony xperia sp and tablet z1 has same problem too.

Hey guys,

I have a few questions which you can answer to help narrow down the cause of the issue.

  • Which engine version are you using?
  • What device are you deploying to? (Be specific)
  • Would you mind providing me with some screenshots of your material for your render target image?
  • Are you using translucency within your material anywhere?

Let me know if you have questions.

Thanks,

  • I will try it in a later version soon. Since the last time I worked on a mobile game in Unreal it was still 4.5/4.6. So it might be fixed already, can’t check it right now.
  • Device: OnePlus: One A0001
  • Don’t have the project laying around anymore, but the final test was a opaque unlit material with the texture directly hooked into the emissive input.

Just FYI, the cube renderer was also not working. I wanted to update it once when the game was loading to decrease downloading size of the app, but could not get it to work either.

Since the scene capture was important I did not end up using Unreal to make the project, it would be cool if I can use Unreal for my next mobile project though :slight_smile:

I’m having the same problem on iOS on 4.9.2. I have a SceneCapture2D attached to a camera and a UMG image that displays the capture render target through an opaque material. On PC and mobile preview everything works fine, but on iOS the SceneCapture2D result is always black.

My project uses mobile HDR off, BTW.

EDIT:
The camera seems to be rendering, since the “stat initViews” data shows two views being rendered both on mobile and PC. No idea why the result is black, however. All my materials are unlit.

I managed to perform a GPU frame capture on Xcode. The cause of the problem is clear: the color attachment dimensions don’t match the depth attachment dimensions, resulting in an GL_INVALID_FRAMEBUFFER_OPERATION error.

It seems UE4 “recycles” the main depth buffer when updating sceneCaptures but OpenGL specifications require both color and depth/stencil buffers to have the same dimensions, which means the current SceneCapture implementation is violating OpenGL specifications. It might be that previous iOS versions ignored the error and thus it seemed to work.

BTW, there’s also a crash in FOpenGLDynamicRHI::RHISetRenderTargetsAndClear() when you use SceneCapture with development or debug builds in iOS and mobile HDR off.

I’m a bit bummed that this sort of thing isn’t part of automated tests.

Hey manoelneto,

Thank you for taking the time to investigate this issue and report your findings on the potential cause. For the crash issue, could you please create a new post with some reproducible steps and as much information that you can provide so we can get a fix for that implemented?

If you need help in regards to the information we will ask for when reporting a crash, we have a helpful guide on our Forums about How to Report a Bug

In regards to the issue of the Scene Capture 2D on Mobile, it seems you have found a solution, and you sound tech savy enough to enter a Git Hub pull request for the fix. I suggest taking this route as it is usually faster to get a fix into the engine when the fix in the code is provided by the user. Let me know if you are unsure how to generate a pull request and I will provide some instructions.

Cheers,

Hi Andew,

I just managed to come with a solution for both issues, yes. I could use some help in creating pull requests. I have both changes in our company branch, but I’m not sure how to create a pull request with only those changes (github tries to push the entire branch - I’m more of a SVN person so I’m probably not using GIT as it should be used).

I personally don’t know a whole lot on generating a pull request, but I am good at finding the information on how to do so :slight_smile: Use the documentation below, but let me know if you have other questions and I can direct them to someone who is a bit more experienced with generating pull requests on GitHub.

Creating a Pull Request

https://help.github.com/articles/creating-a-pull-request/

Merging a Pull Request

https://help.github.com/articles/merging-a-pull-request/

Merging Branches

https://help.github.com/desktop/guides/contributing/syncing-your-branch/

Cheers,

Thanks!

Here it is, I hope I did everything correctly:

https://github.com/EpicGames/UnrealEngine/pull/1731

I’m sorry to revamp this post but I had a very similar problem and I’ve resolved only in part:

this is how I’ve set the material, multiplying the captured scene a lot in base color and a bit in emissive

this is the appearance at first sight: a bit too dark but quite good
BUT
if I move myself to look outside through the mirror I’m hugely flashed

I multiplyed the captured scene because otherwise it would be all black: even if I don’t connect the captured scene to the emissive node and use a higher multiply on the base color I got… it’s difficult to describe, imagine to add brigthness to an image in Photoshop until it’s completely burnt and then make it semi-transparent on a full-black layer! but on the other hand I multiplied just a bit on the emissive and I’ve already got this huge flash! And I’ve set the bloom of the “scene capture 2d” to 0 to try to avoid the flash problem but it seems it has no effect!
I’m working on a 4.10 for iOS too (iPad Pro in my case)
Could this be helpful? or is it just a problem for me because the problem posted here was already fixed?

Hey Hainzgrimmer,

I appreciate the detailed explanation and screenshots you have provided. I think what could be the issue is that you aren’t looking through the SceneCapture2D camera in your last screenshot, but rather the active player camera. You need to be sure to disable ‘bloom’ on the camera component inside of your character blueprint.

You could also add a Post Process Volume to the scene and disable bloom that way as well. Let me know if either suggestion resolved your issue, or if you need further assistance.

Cheers,

Great intuition! I disabled it from the player camera and now I’m not flashed!
Now the problems are just related to the fact that the “reflect” is from a camera, so even adjusting the field of view will however be quite irrealistic, and that looking at the mirror too sided you see the mirror itself reflected or, even worse, behind the wall of the mirror!

any news on make a mirror using a Box Reflection Capture with a chrome material? -big smile-

It is all going to just take some tweaking and a bit of magic to fake the reflection. Using a real reflection on a flat surface won’t produce the results you expect because reflections work best on surfaces with varying normals and roughness.

“a bit of magic” uh? I’m finding hard to believe it! xD
From a noob view it’s kinda hard to find a realistic reflection with just the field of view to set, but I promise to continue working on it: for now it should be easier to have a realistic result without objects near the mirror or mirror surfaces too big, isn’t it?

Thanks A LOT for everything Andrew! =)

Yeah, at certain angles you will have issues. Game design is all about using the techniques you know in order to achieve the affect you are going for. Not everything is going to be realistic in terms of set up, and more often than not, you will have to find ways to fake effects.

You are quite welcome in any case :slight_smile:

Hey, I am having this same issue. My SceneCapture2D works fine on PC but it is coming up black on my mobile Android Phones.

Is there any easy solution to this? I am willing to change engine code if anyone has super clear instructions.

Hey, I am having this same issue. My SceneCapture2D works fine on PC but it is coming up black on my mobile Android Phones.

Is there any easy solution to this? I am willing to change engine code if anyone has super clear instructions.

Could you please make a new AnswerHub post pertaining to your issue. This one was resolved and for tracking purposes we want to make sure issues do not get conflated.

Post it in either Bug Reports or Packaging and Deployment, with a description of your issue, how you reached that point, and your system specs. Once this is done, either myself or a team member will assist you.

Thank you,