Lighting less intense on iOS

Hi all,

I’m trying to blow out some lighting on an object. This object is on its own layer is only affected by a single pixel light (priority: Important)

The light’s intensity should be about 3-3.5 to achieve the desired effect, and looks great in Editor (as it so often does). However, upon building to device it is as if the intensity is only 1, or maybe less. As a test I even took intensity all the way to 8, but same thing.

I have tried using built-in shaders, as well as my custom surface shader, but am not seeing any difference. I get the desired effect in the Editor, but on device it is as if intensity doesn’t do anything at all.

I have also set the color profile in XCode to RGBA8 to see if that had anything to do with it (I didn’t think it would) - no dice.

Am I missing something here?

[Edit 1]

I was informed by Aras that on GL ES Unity preferably uses fixed/lowp which has a range of -2 to +2. Is there a way then to force it to use half/mediump or float/highp?

[Edit 2] Lighting function snippet:

fixed diff = max (0, dot (s.Normal, lightDir));
fixed3 ramp = tex2D(_Ramp,fixed2(atten,.5)).rgb;
fixed4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (diff *(atten*2) );// * ramp;
c.rgb = ((c.rgb*2)*2)+c.rgb;
return c;

Many thanks


Is there a
way then to force it to use
half/mediump or float/highp?

Yes, but that’s slow. Rewrite the shader to utilize MAD. That is, multiply by two. Then, multiply by two and add the previous result. Repeat if necessary; the iterations get you 2x, 6x, 18x, etc. 6x should generally cut it. Not clamping the values for Graphics Emulation is a problem, but I don’t know how they’d solve it, as GLSL on the desktop doesn’t have precision modifiers. The max of 8 isn’t in any way appropriate for OpenGL ES, though.