Toon Shading and iOS / shader doesn't show in editor / Graphics Emulation

This drove us nuts for a good several hours so hopefully if you’re having this problem you’ll find this first.

We had applied toon shading to our model. It looks pretty sweet in the editor. We compiled it to iPad and the toon shading stopped happening in the editor. But then when the app installed on the iPad the toon shading looks fine on the iPad. After getting mad, recreating the project and following our steps it happens again. Apparently all we needed to do was set the “Graphics Emulation” to OpenGL ES2.0 in order to make it display properly in the editor!

so to clarify

  1. You can do toon shading with OpenGL ES2.0 devices.
  2. you MUST set the Graphics emulation mode to OpenGL ES2.0 to view it in the editor.

During our frustrations we searched the forums, found stuff about shading and iOS linked from the FAQ, but it’s mostly outdated posts that claim toon shading is not possible. Looking on the forums for solutions to iOS questions often i find things that do not apply to the new iPhones and iPads. Need a way to flag these posts.

Hi amir,

Thanks a lot for sharing this information, I can get the toon shading working in editor with GL ES2.0 graphic simulation, but when I build run the project onto my iPad the toon shading didn’t work.

Is there some hidden switch in xcode build setting to enable the GL ES2.0 framework?

Thanks!

@nantas: Go to the player settings and tell it to build armv7 + opengl es 2.0
otherwise it will run as ogl es 1.1 only

This is interesting…what devices support OpenGL ES2.0?

@dreamora

I already did, and in Xcode I can see in project setting it builds for armv7. Still no luck.
My iPad is using a beta version of iOS 4.2, is that a problem?

Thanks

jrricky: 3GS+, iPad
nantas: can’t say, I don’t use iOS 4.2 on ipad as I hate crashing apps and thats exactly what I expect due to only 256mb ram + iEatRAM 4.2

What you see on the xcode side has no importance for graphical aspects, it must be set to ARMV6+ARMV7 (the OpenGL ES 2.0 target) in the player settings in unity or the shader engine will not even be present in the build :slight_smile:
Also your shader must be written for mobile … the editor does a good job at emulating the environment but its not fully reflecting the state.

I was also stuck with this problem for a while.
What I just found out is that the Toon Shading package(the one came with Unity) will only work if you set the iOS device’s Default Orientation to Portrait.
I tried on my iPhone 4, 3Gs and iPad. Toon shading didn’t work in Landscape mode on all these device, but the Portrait mode work!!

sounds like the shader then might have expectations or alike.
though it makes no sense that it then works in the mode thats “counternatural” for desktop …

I am attempting to use a toon shader on iPhone 4g. In Landscape, only my textmeshes render. In portrait mode, the screen flashes as if switching between two cameras each update (or something).

I am quite behind on updates to Xcode and iOS as I like keeping my stuff backwards compatible.
So I am using Xcode 3.2.5 and releasing in 4.2. Did you guys notice how much smaller Xcode was back then?
Anyway, I am updating now. Perhaps that will fix it.

Edit - It looks like OpenGL ES 2.0 works on 3.0 and up, so if anyone has info, I would love to hear it.
Thanks in advance!