- Home /
Rim light shader doesn't work on iPad??
Hi, I am new to Unity 3D. I used the following rim light shader code, which is almost the same with the code written in Unity document.
Shader "Custom/glowShader" {
Properties {
_MainColor ("Main Color", Color) = (0.3, 0.3, 0.3, 1.0)
_RimColor ("Rim Color", Color) = (0.6, 0.6, 0.6, 1.0)
_RimPower ("Rim Power", Range(0.5,8.0)) = 1.0
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float4 color : COLOR;
float3 viewDir;
};
float4 _MainColor;
float4 _RimColor;
float _RimPower;
void surf (Input IN, inout SurfaceOutput o) {
half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
o.Albedo = (0,0,0,0);
o.Emission = _RimColor.rgb * pow(rim, _RimPower);
}
ENDCG
}
Fallback "Diffuse"
}
As for Albedo, I set the o.Albedo black to see the effect of rim light.
This works fine on the screen view of Unity as follows.
However, the iOS build shows the whole gray circle.
Do I need some special settings for the shader working fine, like some Playersettings? Or iPad does not support some shader function?
I am using Unity 3D 4.6.1, iPad Air 2 and iOS 8.1.2.
Many thanks.
Answer by kakushi_52 · Jan 14, 2015 at 04:10 PM
I solved the problem by myself... The cause was the Rendering Path setting. Differed Lighting does not read the shader correctly, whereas Forward interprets it fine.
http://docs.unity3d.com/Manual/RenderTech-DeferredLighting.html
The above document says "The only lighting model available with deferred rendering is Blinn-Phong."
Your answer
Follow this Question
Related Questions
Playing fullscreen video when starting the ipad-app? 3 Answers
iOS: Initializing Unity engine multiple times 1 Answer
rotated GUI behaving differently on iphone and ipad 1 Answer
does the iPad have a max FPS 2 Answers
memory consumption ios 0 Answers