Screen Aligned UV + Camera Offset on mobile

Hi guys,

I am using an unlit material with both nodes for mobile (android). It is applied on a 10m. sphere around the camera, to use it as background still image. I need to move the camera around and have always a still image on the background, behind any object in the scene.

On the editor it works ok, but on the mobile it doesn’t work when both nodes are connected. The surprising thing is that ScreenAlignedUVs works fine on its own, the CameraOffset works fine too on its own, but when I use both at the same time only the offset works. Then the mesh doesn’t show the texture but a plain color, taken probably from the texture.

Is this a limitation of Mobile rendering? Any workaround?

Thanks a lot,

Best,
Alo.

Hi Nomte,

When I try this in 4.13, since I no longer have 4.12 installed, everything is working correctly for these nodes. The only issue I had was having to use a lower offset value. With a negative 50000 you’re likely seeing a limitation of mobile here. Try smaller values, as that worked for me. If it’s still a problem in 4.12 try 4.13 and see.

I used your same setup with an offset amount of -500 and also trying an offset value of 500. Also, depending on the device you’re deploying to, it could also be a limitation there, as I’m using a Nexus5 phone running Android 6.0.1.

-Tim

Thank you very much Tim!, I’ll try this weekend and let you know :slight_smile:
Unfortunately, even if it works on 4.13 I don’t want to upgrade right now. I am very close to release and the last time I upgraded and spend a lot of time just making the plugins and everything work again.
I’ll be back with news.

Hi again,

I think I am narrowing the issue. I tried 4.13 and it behaves exactly like you said. The same result in 4.12.

Here is the thing. I’ve notice that using ScreenAlignUV doesn’t show the texture from a certain distance on mobile (aprox. 20000 units/centimeters) please see image attached. From that distance it shows just a plain color. When adding the CameraOffset, that “Mobile max distance” works in addition of the CameraOffset, that is why combining both with a large offset makes everything looks a plain color. In other words, if the limit is 20000 units and I offset the camera more than 20000 units, no texture is shown. In PIE or PC everything works fine.

Is there a way to remove this mobile limit? I think it should not be about a hardware limitation, because on mobile I can see objects that are farther than 70000 units from camera.

Thanks a lot.

When I check this in on a Nexus 5 (Snapdragon chipset) I get the issue you have, however, when I check this on my Samsung S7 Edge (Exynos chipset) there isn’t any issue at the same distances laid out. When tested with an Ipad Mini 2 and Iphone 5s (both using A7 apple chipset), I get the same without issue.

Can you post your phones model number from your Device Settings > About Device section. I can test a few more devices here with different chipsets and see if this is possibly something related just to Snapdragon chipsets as a limitation or known issue.

Thank you very much Tim for all your efforts.

I’ve tried in several devices and these are the results:

Without issue:
LG G4S (LG-H735)
64bits - Qualcomm Snapdragon 615 MSM8939 (28nm)
GPU Adreno 405

With issue
LG G2 (LG-D802)
Qualcomm Snapdragon 800 MSM8974
GPU Adreno 330

Samsung Galaxy Tab 4 (SM-T530)
Qualcomm Snapdragon 400
GPU Adreno 305

Samsung S4 Mini
Qualcomm Snapdragon 400 MSM8930
GPU Adreno 305

If it is a hardware limitation, I better try another solution. Coming back to the root of the problem:
Is there any way to place a still image as background of the scene, with a moving camera?

Thanks a lot,
Alejandro

Hey Alejandro,

sorry for the delay. I’ve submitted a ticket for this one to be investigated. You can follow the status here: Unreal Engine Issues and Bug Tracker (UE-38923)

No worries, thanks for investigate!

Alejandro.

Hi, could you connect ScreenAlignedUVs to a Customized UV in a material and see if it helps? That way UV computation will be done in a vertex shader instead of pixel shader. And floating point precision is way better in vertex shader.

Sounds good! I’ll work on my game again this weekend, I’ll try and let you know.
Thanks a lot for the suggestion!!

Best,
Alejandro

Hi ddvlost,

Thanks for the solution. As you imagined, using the customized UV solved the issue with the distance to camera. Cheers for that!. Unfortunately, when looking around the edges of the sphere are visible since the little distortion created by the vertex mapping.

YOUTUBE TEST Customized UV

I am using a workaround for now. When the issue is solved I’ll apply it to my project again.
Thanks a lot for your help!

Best,
Alejandro

Since 4.13 materials have an option to “Use Full Precision” in a pixel shader on mobile. That should solve that.

Hi ddvlost,
Thanks for the suggestion. I tried but the issue persists.

Best,
Alejandro