Download

Scene Textures in mobile devices

Hi. I have a post processing material using a SceneColor node.

But i got an error: “Node not supported in feature level ES2”. :frowning:

As far as i know, SceneTextures are not suported. Is there an alternative or we just can’t use full screen post processing effects?

//Ale

We’re on the same boat here. I just found out that SceneTexture won’t work on mobile. My game mechanic relies on a post processing effect, so I’m kinda screwed =/

Hey guys, this isn’t supported atm but iOS hardware does have the functionality. Most Android devices do not. I’m not sure when we’ll be able to work on this.

Any updates on this?

For a gameplay mechanic I need to be able to multiply a texture onto the rendered scene. Details here: Paper2D: Drawing primitives into a render texture - UE4 AnswerHub

Would it be a viable alternative to use a Scene Capture 2D instead of a Scene Texture node in a post processing material? I couldn’t do any tests yet, but that sounds expensive.

Thanks!

Scene Capture 2D is going to be very heavy, and there may be issues with resolution or aspect ratio to deal with. I doubt it would work well assuming scene captures are supported on mobile at all (I’ve never tested them).

The ideal solution is to extend SceneColor node to fall back to using a framebuffer fetch extension for mobile platforms that support it, and that is likely what DanielW was referring to. All iOS devices have supported it since iOS 3, and there are some Android devices that support it as well (notably Nvidia Tegras). It’s limited in that you can only sample the pixel you are writing too, but it is great for things like color grading or adding film grain. It is very fast and doesn’t require any memory for an extra render buffer. It’s *exactly *what you want to use if you just want to multiply a texture into the screen.

Post-processing optimizations and mobile optimizations are slated on the roadmap for next March so this area could be getting some attention soon. I’ve actually implemented “framebuffer_fetch” shaders (both Apple and Nvidia flavors) to do this in Unity so I might take a look at it. I have a pretty steep learning curve to get through understanding the source for UE4’s material nodes and rendering so don’t expect too much from me :). I would really like to have this feature available though.

Thanks for your input, Captain.

Yep, I suspected Scene Capturing would be too slow on mobile.

Implementing the node myself sounds like a daunting task though. I may be able to figure out the OpenGL parts, as I’ve done something like that before. But it’s the integration into UE that could be tough. I don’t know, maybe I’ll have a look at it tomorrow, but I’m not too confident.

Let’s hope the planned mobile and post-processing optimizations include post-processing on mobile.

I was just taking a look at the current promoted branch, and the OpenGL ES headers are checking for framebuffer_fetch extensions. It looks like right now it is being used for the sun depth of field in mobile post-processing so hopefully they will extend its use to the scene color node.

Yeah, the actual OpenGL shader code is relatively straight forward. The tricky part is the integration, and I’m not even sure where to look to find the code that defines how the Scene Color node works.

Quick update. Turns out there is a Multiplicative material blend mode, it’s just called Modulate. So I guess I can use that for my problem and I don’t need a post processing material.

Of course it would still be cool if it was supported, but after quite some digging through the material code base, I gave up for now on the idea of implementing that myself.

If you’re still trying, some of the relevant parts seem to be here:
MaterialExpressions.cpp#L4765
HLSLMaterialTranslator.h#L2294
MaterialTemplate.usf#L886

But you probably already found these.

Custom Post Process effects are really needed here in iOS world!

It looks like it’s supported with Metal. That would of course mean limiting your game to recent devices (5S or newer I think) or implement alternative effects for older ones.

thanks for the info. I really needed it for a frozen screen effect my game needs. Thanks!

Ah, yes, of course. I don’t know why I didn’t think of that. OpenGL always supports a small set of pre-defined blend functions, and “multiply” should definitely be supported. Frame buffer fetches are really only needed if you want to write more complicated custom blend functions.

Thanks! I was taking a look through some of this, and I’ll probably slowly work my way through the code. Adding custom material nodes with my own shader code is something that I’d really like to figure out.