Shader error: too little data in type constructor
Posted: Wed Feb 07, 2018 6:36 pm
Shader error in 'Skin': too little data in type constructor at line 73 (on d3d9)
If I drag from this node to the debug node no errors are thrown.
https://imgur.com/KTkOIn1
But If I connect this node to the debug node errors are thrown. So it has to be something to do with the add node, right?
https://imgur.com/JVLGCIQ
If I drag from this node to the debug node no errors are thrown.
https://imgur.com/KTkOIn1
But If I connect this node to the debug node errors are thrown. So it has to be something to do with the add node, right?
https://imgur.com/JVLGCIQ
- Code: Select all
Shader "Skin"
{
Properties
{
_MainTexture("Albedo", 2D) = "white" {}
_TextureSample0("NormalMap", 2D) = "bump" {}
_AOStrength("AO Strength", Range( 0 , 1)) = 0
_AO("AO", 2D) = "white" {}
_SSAmbient("SS Ambient", Color) = (0,0,0,1)
_SSThickness("SS Thickness", 2D) = "white" {}
_Power("Power", Range( 0.001 , 50)) = 0
_Scale("Scale", Range( 0 , 10)) = 1
_Attenuation("Attenuation", Range( 0 , 10)) = 1
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[HideInInspector] __dirty( "", Int ) = 1
}
SubShader
{
Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
Cull Back
CGINCLUDE
#include "UnityCG.cginc"
#include "UnityPBSLighting.cginc"
#include "Lighting.cginc"
#pragma target 4.6
#ifdef UNITY_PASS_SHADOWCASTER
#undef INTERNAL_DATA
#undef WorldReflectionVector
#undef WorldNormalVector
#define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
#define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
#define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
#endif
struct Input
{
float2 uv_texcoord;
float3 worldPos;
float3 worldNormal;
INTERNAL_DATA
};
uniform sampler2D _TextureSample0;
uniform float4 _TextureSample0_ST;
uniform sampler2D _MainTexture;
uniform float4 _MainTexture_ST;
uniform float _Attenuation;
uniform float4 _SSAmbient;
uniform float _Power;
uniform float _Scale;
uniform sampler2D _SSThickness;
uniform float4 _SSThickness_ST;
uniform sampler2D _AO;
uniform float4 _AO_ST;
uniform float _AOStrength;
void surf( Input i , inout SurfaceOutputStandard o )
{
float2 uv_TextureSample0 = i.uv_texcoord * _TextureSample0_ST.xy + _TextureSample0_ST.zw;
o.Normal = UnpackNormal( tex2D( _TextureSample0, uv_TextureSample0 ) );
float2 uv_MainTexture = i.uv_texcoord * _MainTexture_ST.xy + _MainTexture_ST.zw;
o.Albedo = tex2D( _MainTexture, uv_MainTexture ).rgb;
float3 ase_worldPos = i.worldPos;
float3 ase_worldViewDir = normalize( UnityWorldSpaceViewDir( ase_worldPos ) );
float3 ase_worldlightDir = normalize( UnityWorldSpaceLightDir( ase_worldPos ) );
float3 ase_worldNormal = WorldNormalVector( i, float3( 0, 0, 1 ) );
float dotResult140 = dot( ase_worldViewDir , -( 0.0 * ( ase_worldlightDir + ase_worldNormal ) ) );
float3 temp_cast_1 = (_Power).xxx;
float2 uv_SSThickness = i.uv_texcoord * _SSThickness_ST.xy + _SSThickness_ST.zw;
o.Emission = ( ( _Attenuation * ( _SSAmbient + float4( ( pow( saturate( dotResult140 ) , temp_cast_1 ) * _Scale ) , 0.0 ) ) ) * tex2D( _SSThickness, uv_SSThickness ) ).xyz;
float2 uv_AO = i.uv_texcoord * _AO_ST.xy + _AO_ST.zw;
o.Occlusion = ( tex2D( _AO, uv_AO ).r * _AOStrength );
o.Alpha = 1;
}
ENDCG
CGPROGRAM
#pragma surface surf Standard keepalpha fullforwardshadows
ENDCG
Pass
{
Name "ShadowCaster"
Tags{ "LightMode" = "ShadowCaster" }
ZWrite On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 4.6
#pragma multi_compile_shadowcaster
#pragma multi_compile UNITY_PASS_SHADOWCASTER
#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
#include "HLSLSupport.cginc"
#if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
#define CAN_SKIP_VPOS
#endif
#include "UnityCG.cginc"
#include "Lighting.cginc"
#include "UnityPBSLighting.cginc"
struct v2f
{
V2F_SHADOW_CASTER;
float2 customPack1 : TEXCOORD1;
float4 tSpace0 : TEXCOORD2;
float4 tSpace1 : TEXCOORD3;
float4 tSpace2 : TEXCOORD4;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
v2f vert( appdata_full v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID( v );
UNITY_INITIALIZE_OUTPUT( v2f, o );
UNITY_TRANSFER_INSTANCE_ID( v, o );
Input customInputData;
float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
fixed3 worldNormal = UnityObjectToWorldNormal( v.normal );
fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
o.customPack1.xy = customInputData.uv_texcoord;
o.customPack1.xy = v.texcoord;
TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
return o;
}
fixed4 frag( v2f IN
#if !defined( CAN_SKIP_VPOS )
, UNITY_VPOS_TYPE vpos : VPOS
#endif
) : SV_Target
{
UNITY_SETUP_INSTANCE_ID( IN );
Input surfIN;
UNITY_INITIALIZE_OUTPUT( Input, surfIN );
surfIN.uv_texcoord = IN.customPack1.xy;
float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
surfIN.worldPos = worldPos;
surfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );
surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
SurfaceOutputStandard o;
UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
surf( surfIN, o );
#if defined( CAN_SKIP_VPOS )
float2 vpos = IN.pos;
#endif
SHADOW_CASTER_FRAGMENT( IN )
}
ENDCG
}
}
Fallback "Diffuse"
CustomEditor "ASEMaterialInspector"
}