Some extra information, these are the errors unity giving me:
Shader error in ‘Totems/UberTotem’: Unexpected identifier “SurfaceOutputStandardSpecular”. Expected one of: sampler sampler1D sampler2D sampler3D samplerCUBE sampler_state SamplerState SamplerComparisonState bool int uint half float double or a user-defined type at line 90
Shader error in ‘Totems/UberTotem’: Unexpected identifier “SurfaceOutputStandardSpecular”. Expected: ‘)’ at line 109
The shader looks like following:
Shader "Totems/UberTotem" {
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Normal Map", 2D) = "bump" {}
_SpecGlossMap("Specular", 2D) = "white" {}
_Glossiness("Smoothness", Range(0, 1)) = 1
_EmissionMap("Emission", 2D) = "white" {}
}
SubShader
{
Tags { "Queue" = "Geometry+1" "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf StandardSpecular fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _SpecGlossMap;
sampler2D _BumpMap;
sampler2D _EmissionMap;
fixed4 _Color;
half _Glossiness;
struct Input
{
float2 uv_MainTex;
};
//struct SurfaceOutputStandardSpecular
//{
// fixed3 Albedo; // diffuse color
// fixed3 Specular; // specular color
// fixed3 Normal; // tangent space normal, if written
// half3 Emission;
// half Smoothness; // 0=rough, 1=smooth
// half Occlusion; // occlusion (default 1)
// fixed Alpha; // alpha for transparencies
//};
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
fixed4 albedo = tex2D(_MainTex, IN.uv_MainTex);
fixed4 specular = tex2D(_SpecGlossMap, IN.uv_MainTex);
fixed4 normal = tex2D(_BumpMap, IN.uv_MainTex);
half3 emission = tex2D(_EmissionMap, IN.uv_MainTex).rgb;
o.Albedo = albedo.rgb * _Color.rgb;
o.Specular = specular.rgb * _Glossiness;
o.Emission = emission;
o.Smoothness = specular.a;
o.Normal = UnpackNormal(normal);
o.Alpha = albedo.a * _Color.a;
o.Occlusion = 0;
}
ENDCG
//Cull Front
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf CustomSpecular vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _SpecGlossMap;
sampler2D _BumpMap;
sampler2D _EmissionMap;
fixed4 _Color;
half _Glossiness;
struct Input
{
float2 uv_MainTex;
};
inline half4 LightingCustomSpecular(inout SurfaceOutputStandardSpecular s, half3 viewDir, UnityGI gi)
{
s.Normal = normalize(s.Normal);
// energy conservation
half oneMinusReflectivity;
s.Albedo = EnergyConservationBetweenDiffuseAndSpecular(s.Albedo, s.Specular, /*out*/ oneMinusReflectivity);
// shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
// this is necessary to handle transparency in physically correct way - only diffuse component gets affected by alpha
half outputAlpha;
s.Albedo = PreMultiplyAlpha(s.Albedo, s.Alpha, oneMinusReflectivity, /*out*/ outputAlpha);
half4 c = UNITY_BRDF_PBS(s.Albedo, s.Specular, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, gi.light, gi.indirect);
c.rgb += UNITY_BRDF_GI(s.Albedo, s.Specular, oneMinusReflectivity, s.Smoothness, s.Normal, viewDir, s.Occlusion, gi);
c.a = outputAlpha;
return c;
}
inline void LightingCustomSpecular_GI(SurfaceOutputStandardSpecular s, UnityGIInput data, inout UnityGI gi)
{
gi = UnityGlobalIllumination(data, s.Occlusion, s.Smoothness, s.Normal);
}
/*half4 LightingWrapLambert(inout SurfaceOutput s, half3 lightDir, half atten)
{
return half4(1, 1, 1, 1);
}*/
/*
float4 vertex : POSITION;
float4 tangent : TANGENT;
float3 normal : NORMAL;
float4 texcoord : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
fixed4 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
*/
void vert(inout appdata_full v)
{
v.vertex.xyz += v.normal * 0.1;
}
/*
struct SurfaceOutputStandardSpecular
{
fixed3 Albedo; // diffuse color
fixed3 Specular; // specular color
fixed3 Normal; // tangent space normal, if written
half3 Emission;
half Smoothness; // 0=rough, 1=smooth
half Occlusion; // occlusion (default 1)
fixed Alpha; // alpha for transparencies
}; */
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
fixed4 albedo = tex2D(_MainTex, IN.uv_MainTex);
fixed4 specular = tex2D(_SpecGlossMap, IN.uv_MainTex);
fixed4 normal = tex2D(_BumpMap, IN.uv_MainTex);
half3 emission = tex2D(_EmissionMap, IN.uv_MainTex).rgb;
o.Albedo = albedo.rgb * _Color.rgb;
o.Specular = specular.rgb * _Glossiness;
o.Emission = emission;
o.Normal = UnpackNormal(normal);
o.Alpha = albedo.a * _Color.a;
}
ENDCG
}
FallBack "Diffuse"
}