Hello,
I’m trying to use a toon shader with a skinned mesh and for a single model (53k tris), it makes my framerate goes down from 60 to ~35fps (on iOs, iPad3).
I got 60 fps with the shader when selecting Rig > Animation type > none
I got 60 fps with the animation with a diffuse shader
And here’s my shader code (a simplified version of the toon shader from the Standard Assets) :
Shader "Toon/Basic Outline" {
Properties {
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline width", Range (.002, 0.03)) = .005
_MainTex ("Base (RGB)", 2D) = "white" { }
}
CGINCLUDE
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : POSITION;
float4 color : COLOR;
};
uniform float _Outline;
uniform float4 _OutlineColor;
v2f vert(appdata v) {
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = TransformViewToProjection(norm.xy);
o.pos.xy += offset * o.pos.z * _Outline;
o.color = _OutlineColor;
return o;
}
ENDCG
SubShader {
Tags { "RenderType"="Opaque" }
Pass {
Name "BASE"
Cull Off
SetTexture [_MainTex]
}
Pass {
Name "OUTLINE"
Tags { "LightMode" = "Always" }
Cull Front
ZWrite On
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(v2f i) :COLOR { return i.color; }
ENDCG
}
}
Fallback "Toon/Basic"
}
Is there something specific in the shader code that could be the reason? Or is it using a vertex shader + skinned meshes in general?
A fallback could be to use a post-processing effect, but I don’t have Unity Pro (yet).
Thanks ![]()