Hello every one. I'm pretty bad in writing code especially shaders... maybe someone of you wrote such a shader like this in splintercell on the iphone: I mean the character looks like normal vertexlit but he has some "light" glow around the edges (like look on his right leg) I've tryed to make something like this but it was a total disaster... if someone has wrote something similar could you please share this with us ? Thanks in advanced!! cheers
So that's either the shader doing it (usually called "rim lighting"), or actually just one extra per-vertex directional light, parented to the camera (almost looking into it), and affecting only the characters (via layer masks).
Is there any way to achieve this with the default unity shaders? as said - I'm really bad in writing shader (okok to call it simply - I can't it )
I found this shader but it won't work on Unity Iphone Advanced... it says that this graphic card don't support this... Code (csharp): Shader "RimLight" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _RimColor ("Rim Color", Color) = (1, 1, 1, 1) _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float3 normal : NORMAL; float2 texcoord : TEXCOORD0; }; struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; float3 color : COLOR; }; uniform float4 _MainTex_ST; uniform float4 _RimColor; v2f vert (appdata_base v) { v2f o; o.pos = mul (UNITY_MATRIX_MVP, v.vertex); float3 viewDir = normalize(ObjSpaceViewDir(v.vertex)); float dotProduct = 1 - dot(v.normal, viewDir); float rimWidth = 0.7; o.color = smoothstep(1 - rimWidth, 1.0, dotProduct); o.color *= _RimColor; o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } uniform sampler2D _MainTex; uniform float4 _Color; float4 frag(v2f i) : COLOR { float4 texcol = tex2D(_MainTex, i.uv); texcol *= _Color; texcol.rgb += i.color; return texcol; } ENDCG } } } any idea how to make this run on iphone? cheers
or let me ask the other way - can I fake this with any of the standard unity shader ??? hope you can help me thanks
Like Aras said, just add an extra directional light that only affects your main character. Attach it to the camera so that it is always coming from the right. From the look of the screen shot, they have a slightly darker, slightly bluer light coming from the left, too.