- Home /
GPU skinning vs custom shader
Hi I'm writing my own shader in mobile, but was wondering if I will break the GPU skinning feature since it's using vertex shader also? My shader is as below:
Shader "Mobile Custom/Specular Map" {
Properties {
_ShininessColor("Shininess Color", Color) = (1,1,1,1)
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
_MainTex ("Base (RGB)", 2D) = "white" {}
_SpecMap ("Specular Map", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 250
Cull Back
CGPROGRAM
#pragma surface surf MobileBlinnPhong exclude_path:prepass nolightmap halfasview interpolateview noshadow nofog nometa nolppv noshadowmask
inline fixed4 LightingMobileBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 halfDir, fixed atten) {
fixed diff = max (0, dot (s.Normal, lightDir));
fixed nh = max (0, dot (s.Normal, halfDir));
fixed spec = pow (nh, s.Specular * 128) * s.Gloss;
fixed4 c;
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * spec) * atten;
UNITY_OPAQUE_ALPHA(c.a);
return c;
}
sampler2D _MainTex;
sampler2D _SpecMap;
uniform float4 _ShininessColor;
half _Shininess;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = tex.rgb;
o.Gloss = tex2D(_SpecMap, IN.uv_MainTex) * _ShininessColor;
o.Alpha = tex.a;
o.Specular = _Shininess;
}
ENDCG
}
FallBack "Mobile/VertexLit"
}
According to here, if using custom shader with instancing, we need to add the instancing shader in our custom shader. Does it apply for GPU skinning too?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612185456im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
High GPU cost of a color parameter 0 Answers
[Compute Shader] Porting an Image Effect Shader - Kuwahara Filter 2 Answers
Custom node for shader graph not allowing project to build. 1 Answer
Custom Terrain Shader not taking Textures 0 Answers
The objects with a custom shader become invisible when i activate the lightmap 0 Answers