Incorrect Rendering with Metal enabled on iOS devices

Hi,

I found some artefacts with UE4 when rendering using metal. More specifically, look at the following screenshot:

https://forums.unrealengine.com/attachment.php?attachmentid=47748&d=1436818171

This is rendering on the device WITHOUT metal, and matches the mobile preview in the editor. The following, instead, is the same scene rendered on the device with metal enabled:

https://forums.unrealengine.com/attachment.php?attachmentid=47750&d=1436818472

As you can see, there seem to be a problem with texture coordinates, but I don’t understand why. I am using UE4 4.8.1 on Mac OS X Yosemite, and the
device is an iPhone 6 with IOS 8.4.

The material applied to the wall is quite simple:

https://forums.unrealengine.com/attachment.php?attachmentid=47753&d=1436818938

Also, everything looks fine on Desktop, mobile preview and even on the viewport with Metal preview.

Hi rranon -

Thank you for your report. We have assigned this issue to a member of our support staff, and they will begin investigation as soon as possible. If we are unable to reproduce the issue, or we need additional information, our staff member will comment here with additional questions. Otherwise, we will post an ‘Answer’ once we have logged the issue in our bug database or we have a solution for it.

In the meantime, please be sure to review our suggestions for how to report a
bug, and feel free to edit your post if you have additional information to provide:

Thank you -

Eric Ketchum

Hey rranon,

I have recreated your issue on Mac and then exported the project to IOS6.

First I was unable to recreate your UV stretching issue. This is likely due to the way you have your material set up. First theTextureCoordinate expression outputs UV texture coordinates in the form of a two-channel vector value allowing materials to use different UV channels, specify tiling, and otherwise operate on the UVs of a mesh. So if you have your TextureCoordinate node set to any value higher than one your Albedo Map coordinates are going to start tiling more than once across your mesh.

Second, Metal rendering is supported on IOS and this is an experimental feature so there are a couple of steps you need to take in order for it to be enabled.

1.) Enable Metal/High -end mobile rendering preview inside of Editor Preferences > Experimental
2.) Inside of your View Port go to Settings > Preview Rendering Level > High End Mobile/ Metal
a.) This is only enabled after Enabling Metal/ High End mobile rendering preview
3.) I would go to our wiki and check for the compatibility for metal and this feature for IOS. Much of the shine and metallic feature disappeared when played on I IOS device
4.) Putting texture coordinates on UV’s that are specifically unwrapped for a Mesh is going to give your strange results. My recommendation is not to do it. If you had just a tileable normal map and you wanted that sort of displacement all over your mode and you wanted to tile it smaller then the texturecoordinate node in this situation would be viable.

If you are wanting this result then disconnect the texture coordinate from everything that has it’s own UV coordinates specified for this Mesh and then experiment,

Thanks,
Logan

Thanks for the answer.
I’ve done all the suggested steps to enable metal preview on the editor, but I don’t see any issue there. The problem, as stated in my question, is only on the device.
I am not sure I understand your point 4. Are you suggesting I remove the TexCoord node from my material (whose purpose is to tile with a factor of 0.1 on both axes) and instead change the uv coordinates on the meshes?

Exactly,

On your base color at the very least. Think of it this way. You have wrapped a square box gift with a patterned wrapping paper. You tape the ends and bottom to make sure it doesn’t come apart. Assuming that the paper is still loose enough to move you shift it in any direction the pattern has shifted as well as the ends have shifted. This moves whatever you had to a new location. As soon as you change the texture coordinate the same affect will occur.

Assuming that you have unwrapped the UV’s for the wall you have created and given it a specific UV channel then the shift would cause a weird distortion because it’s trying to calculate negative space where you haven’t specified UV’s where there wasn’t any. If you take the same texture coordinate and plug that into a random texture, say in the starter content, you will see a tiled texture across your mesh because you are only tiling the tileable texture because it’s just a texture and has no precomputed UV coordinates. This doesn’t allow you for much control as the model itself still holds this information and you are not using the map specified to it’s geometry that you made upon unwrapping it.

Here is some material on unwrapping on our wiki. I hope this clarifies things a bit,

This material is unwrapping for lightmaps but much of it translates to UV mapping for textures and materials,

Logan

ok, as you put it is a modelling mistake. I will check and correct, but: why it renders ok in the editor, in the Mac version, in the Windows version, and on iOS without Metal rendering, but, when I enable Metal rendering, I see the problem on the device?

The screenshots are missing, but if the UVs are large, they will get stretched out in Metal. We’ve seen this on landscape, etc, but don’t have a fix yet.

But, to confirm, is it a large repeating texture?
Josh

Which screenshots are missing? I see three of them in my original question: a screenshot without the problem (taken on iOS device without Metal rendering enabled), a screenshot with the problem (taken on iOS device with Metal rendering enabled), and a screenshot of the material. Can you confirm you see three screenshots?

Yes, all textures (diffuse, normal, roughness, metal) are 2048x2048 textures that repeat along the outer walls of the building.

Hey rranon,

To better explain what we mean I have created a simple test with screenshots. The first is what happens when you create uv’s and it’s created on a 0-1 scale with 1 representing 100% of space used. This is an example of uv’s being used over the entire area of the space specified when unwrapping a mesh.

The second is duplicating what you have done with the texture coordinate. What you have done is said instead of being displayed over 100% of the space that could be used to represent this texture i want you to cram that down into 10% of that space.

Thanks again.
However, it is not always possible to proceed like you suggest, because one could not have complete control on 3D models … for example, the same issue exist with speedtree models (e.g. check the free mobile ue4 trees they make available on their website). In this case, we cannot change UV mapping as it is done inside speedtree. Btw, the same trees do not render at all without Metal rendering enabled, AFAIK because they use 8 uv channels. Would it be possible to add an option to the spedtree importer such that we can load only the first two UV channels, so we can use speedtree models on iOS devices?

It would be best to proceed with a feature request for that. It may become backlogged due to it pertaining to a third party software.

The easiest solution to this would be to purchase a copy of speed tree and then to adjust your UV’s there.

I will be moving this thread out of bug reports as it is a workflow issue as opposed to a bug with the engine.

Thanks,

Logan

Ok, thanks, I will make a feature request. From speedtree forums, it looks like you cannot change the UVs from the modeler, but I am not sure since I don’t own it.
p.s. excuse me, where do I enter a feature request?

It will be the same way that you made this post. Instead of posting under Rendering there is a section dedicated to feature requests.

Which one of these?

51812-tmp.png

Also, you might be right to move this question out of bug reports, but still there is a bug either in iOS metal rendering code, or the UE4 editor mobile metal preview. The two should render the same, and currently they aren’t.

I have looked into this matter. Speedtree has a function to export with settings that are specified for mobile development.

At this point this is a Speedtree issue and we really can’t help you any further.

Or, alternatively create your own trees and your own UV’s

Thanks,

Logan