All my objects are white when I build for IOS - ios

I recently started building a game for iOS using my iPhone 5s for testing.
However, recently I have decided to try my iPhone SE to see how it looks; all of the materials on all of the objects appear to be missing, but the color of the trails for the particle effects and the line renderers still have their color.

It could be a shader issue or a problem with the graphics API Unity is using. If you're not using the standard shader then make sure that you're shader is compatible with mobile devices. Also make sure that it's included in the project by creating a folder named Resources and moving your shader into that.
If you're using one of the standard shaders that comes with Unity then the issue is likely not a shader one but the Graphics API selected. It's likely using Metal which is causing that issue. Use OpenGL ES instead of Metal.
Disable Auto Graphics API then change iOS Graphics API to OpenGLES2 or OpenGLES3 in Unity's Player Settings.

Related

Is iOS 12 on the iPhone X rendering OpenGL ES on top of Metal? And is there any way to avoid it?

So I've got a weird issue. I'm porting a modern source port of an old game engine to iOS and tvOS. It was written using OpenGL and I found a fork of it that uses OpenGL ES and I've been able to Frankenstein combine the two to where it will actually now successfully run on iOS and tvOS devices.
Here's the weird part - parts of the game do not render correctly on my iPhone X but they do render correctly on my iPad Air 2 and Apple TV (4th gen).
I notice in the flurry of messages in the output window that the spot where the engine outputs renderer information, on the iPhone X it says
OpenGL version: OpenGL ES 2.0 Metal 58.4
whereas on, say, the iPad Air 2 it says
OpenGL version: OpenGL ES 2.0 A8X GPU - 130.1
"OpenGL ES Metal" sounds like "Jumbo Shrimp" to me since those are obviously not the same thing. If I were to guess, I'd say that on the iPhone X the OpenGL ES drivers are running on top of some sort of Metal translation layer, which may be Apple's long term plan for having some sort of future-proofing in the wake of the OpenGL ES deprecation.
But for whatever reason it's breaking my game engine and although I'm decent at making code work together, I don't know enough about graphics coding to know even where to look to change things to work.
Obviously the right answer is to fix whatever is causing the issue but as a short term fix I'm curious if there's any way to get a game on iOS to not use OpenGL ES on top of Metal? (if that is indeed what is happening)
So, like Brad Larson says below, the answers were: yes OpenGL ES is running on top of Metal and no, it can't be avoided. However for future reference if anyone else is running into this problem I solved the real underlying issue with the help of another SO answer:
WebGL GLSL fragment shader not working on iOS
Basically the floating point precision of the shaders need to be upgraded from lowp and mediump to highp
Yes, OpenGL ES is effectively an interface to Metal on recent iOS versions (since I believe 10, if I'm not mistaken).
From the Roblox Metal retrospective:
It is also worth noting that there is no GL driver on iOS 10 on the newest iPhones, apparently. GL is implemented on top of Metal, which means using OpenGL is only really saving you a bit of development effort – not that much, considering that the promise of “write once, run anywhere” that OpenGL has does not really work out on mobile.
You can verify this yourself by profiling OpenGL ES code on modern iOS versions:
In addition to the above, you'll see Metal-specific operations like -[MTLIOAccelCommandQueue submitCommandBuffers:count:] appearing in profiling of your OpenGL ES applications.
Near as I can tell, there's no way to circumvent this, it's how rendering is architected on modern iOS versions. That said, I've not seen this alter the behavior of my OpenGL ES code. I have seen different iOS GPUs produce slightly different rendering behavior due to their hardware, so it's possible you're encountering something that is device-specific.
Check for the usual suspects involving precision qualifiers, Z-fighting, division-by-zero in shaders, etc. and see if one of those is messing up your rendering. Those are all places where I've seen new device generations disrupt my rendering.

OpenGL deprecated in IOS 12, how to safely continue to use openGL on ios 12+ device?

Apple says that apps built using OpenGL ES will continue to run in iOS 12, but Open GL ES is deprecated in iOS 12. Games and graphics-intensive apps that previously used OpenGL ES should now adopt Metal.
But I don't want to migrate my app from OpenGL to Metal because it's the same code for Android and I don't want to create two separate branches, so what can I do to continue to use OpenGL in future iOS releases?
You more or less do not.
Apple has made it abundantly clear that they are not interested in supporting OpenGL ES further on any platform they control. In the future, you will use Metal or you will not have accelerated 3D graphics. Those will be your options.
There are projects that expose OpenGL ES on such platforms by implementing an ES layer on top of Metal. MoltenGL, for example, but that one isn't free apparently.
I use MetalANGLE, which is free and open-source with a non-viral license, in my commercial product, as an (almost) drop-in replacement for GLKit. I have had to make no changes at all to the part of my code that uses OpenGL ES, and only minor changes to the way my View and ViewController classes were initialised.
It is now six months since I moved from GLKit to MetalANGLE and the only problem that arose was one of scaling, which was really a bug in my app: in MetalANGLE I needed to retrieve the UI scale from the View's contentScaleFactor rather than [[UIScreen mainScreen] scale].
There have been no display glitches, crashes, slowdowns, or any problems whatever with the graphics rendering.
I can therefore see no reason to pay for MoltenGL instead of using the free MetalANGLE.
I recommend that OpenGL and Metal are developed together on iOS, and new features are used with Metal.

Unity3d - Objects turn invisible when built on iOS

I have a game that is fully ready for android, but during the process of getting it to work on iOS I noticed that the instantiated objects weren't visible in iOS. I can confirm they were there as they have colliders on them that send a game over signal when they collide and after a couple of seconds I do get gameover (when they collide). It's just that they're not visible. Also, this works fine in Unity. I only get the problem after building to iOS and I don't get the problem when I build to android.
EDIT
This is a 2d game so sprites are being rendered. Again the instantiated objects are there and functioning as they should just the sprites are not being shown on the screen
Within limited information provide in the question I can only answer to your problems is that: There are some limitation for iOS build which includes Graphic limit:
DXT texture compression is not supported; use PVRTC formats instead.
Please see the Texture2D Component page for more information.
Rectangular textures can not be compressed to PVRTC formats.
Movie Textures are not supported; use a full-screen streaming playback
instead. Please see the Movie playback page for more information.(More)
You should also need to check texture override in unity for iOS.
Remember: No one can answer with the limited information you can also do iOS Debugging yourself through this Guide.

Easiest way to create simple 3d ios app

I'm looking to create a simple iOS app (for a geometry class) where you can tap and drag around 3d figures (cylinders, cubes, triangular prisms, etc.). What would be the easiest way to do this? Note I don't know any Objective-C.
It's kind of early but check out cocos 3d. Cocos 2d is a popular 2D game platform. Cocos 3D should insulate you from OpenGL ES.
http://brenwill.com/cocos3d/
Both cocos3d and cocos2d are built on top of the OpenGL ES frameworks
that runs on all iOS devices, and both are written in the native
Objective-C familiar to all iOS developers. With cocos3d, you can
effortlessly create a full 3D game or application without getting into
the nitty-gritty needs of the OpenGL ES state machine, and without
having to switch over to C or C++, as required by most other 3D
frameworks.
There's a mashup sample project to illustrate how to use it's APIs.
... the cocos3d distribution contains a Demos folder, where you
can build and run the CC3DemoMashUp app, a more sophisticated sample
of what’s possible with cocos3d
Here's the programming guide:
http://brenwill.com/2011/cocos3d-programming-guide/
If you download before april 8 2012 you get a free version of unity 3d ios version (android too if you are interested)

glBlendFuncSeparate crashes on OpenGL1.1 on iOS

I'm trying to build code on an older iOS devices that have arm6 processors and support for only OpenGL ES 1.1. The function glBlendFuncSeparate crashes. I found this post on stackoverflow -
iPhone OpenGL ES missing functions should be there - glBlendFuncSeparate etc
So I added the OES to the end of the function and it still crashes. I've double checked to make sure I am including OpenGLES/ES1/glext.h and I am.
Does anyone know what the deal is with this? Is this function supported in OpenGLES 1.1 on iOS? If so, how do you use it?
After much research and work, I've found that glBlendFuncSeparate is not supported on OpenGLES 1.1 for iOS on older devices.
The easiest work around we found (though is does involve more draw calls) is to use glColorMask. You mask off the alpha and set your blend mode and draw once, then you mask off you color and set your alpha blend mode and draw again.
Hope this helps others with the same problem!

Resources