0
Fixed

Previous version shaders no longer compile after update

Doug Holder vor 9 Jahren aktualisiert vor 9 Jahren 5
I created some shaders in 1.2 and some in 1.4 and after upgrading to 1.5 they no longer compile. New shader created will compile fine but all others throw this error and I'm not sure how to fix it. I have tried deleting the entire shader forge dir from my project and redownloading and reimporting but nothing has worked.

NullReferenceException: Object reference not set to an instance of an objectShaderForge.SFN_Tex2d.SerializeSpecialData ()
ShaderForge.SF_Node.Serialize (Boolean skipExternalLinks, Boolean useSuffixPrefix)
ShaderForge.SF_EditorNodeView.GetNodeDataSerialized ()
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.DrawPreviewPanel (Rect r)
ShaderForge.SF_Editor.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)



Here is the entire shader as well.

// Shader created with Shader Forge v1.12 // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.12;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,nrsp:0,limd:3,spmd:1,grmd:1,uamb:True,mssp:True,bkdf:False,rprd:False,enco:False,rmgx:True,rpth:0,hqsc:True,hqlp:False,tesm:0,blpr:0,bsrc:0,bdst:1,culm:0,dpts:2,wrdp:True,dith:0,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.02,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:2584,x:33201,y:32851,varname:node_2584,prsc:2|diff-2891-OUT,spec-408-OUT,gloss-5221-OUT,olwid-227-OUT,olcol-1857-OUT;n:type:ShaderForge.SFN_VertexColor,id:5796,x:32665,y:32840,varname:node_5796,prsc:2;n:type:ShaderForge.SFN_Multiply,id:611,x:32232,y:32781,varname:node_611,prsc:2|A-1887-RGB,B-279-RGB;n:type:ShaderForge.SFN_Cubemap,id:7301,x:32051,y:32258,ptovrint:False,ptlb:CubeMap,ptin:_CubeMap,varname:node_7301,prsc:2,cube:d93582096ddd9a148aadde659f1470ee,pvfc:2|DIR-9284-OUT;n:type:ShaderForge.SFN_Tex2d,id:279,x:31949,y:32948,varname:node_279,prsc:2,tex:284d68c1289554166852d168b6f359cd,ntxv:0,isnm:False|TEX-5095-TEX;n:type:ShaderForge.SFN_ViewReflectionVector,id:9284,x:31880,y:32258,varname:node_9284,prsc:2;n:type:ShaderForge.SFN_Color,id:6760,x:32051,y:32423,ptovrint:False,ptlb:Reflectioon Color,ptin:_ReflectioonColor,varname:node_6760,prsc:2,glob:False,c1:0.5,c2:0.5,c3:0.5,c4:1;n:type:ShaderForge.SFN_Multiply,id:6409,x:32276,y:32322,varname:node_6409,prsc:2|A-7301-RGB,B-6760-RGB;n:type:ShaderForge.SFN_ValueProperty,id:1818,x:32276,y:32494,ptovrint:False,ptlb:Reflection Intensity,ptin:_ReflectionIntensity,varname:node_1818,prsc:2,glob:False,v1:1;n:type:ShaderForge.SFN_Multiply,id:2947,x:32460,y:32395,varname:node_2947,prsc:2|A-6409-OUT,B-1818-OUT;n:type:ShaderForge.SFN_Color,id:1887,x:31949,y:32762,ptovrint:False,ptlb:Color Mult,ptin:_ColorMult,varname:node_1887,prsc:2,glob:False,c1:1,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_Tex2dAsset,id:5095,x:31768,y:32985,ptovrint:False,ptlb:Color Texture,ptin:_ColorTexture,varname:node_5095,tex:284d68c1289554166852d168b6f359cd,ntxv:0,isnm:False;n:type:ShaderForge.SFN_ValueProperty,id:1004,x:32232,y:32660,ptovrint:False,ptlb:Color Intensity,ptin:_ColorIntensity,varname:node_1004,prsc:2,glob:False,v1:1;n:type:ShaderForge.SFN_Multiply,id:5597,x:32413,y:32703,varname:node_5597,prsc:2|A-1004-OUT,B-611-OUT;n:type:ShaderForge.SFN_Add,id:4823,x:32690,y:32601,varname:node_4823,prsc:2|A-2947-OUT,B-5597-OUT;n:type:ShaderForge.SFN_Multiply,id:2891,x:32889,y:32749,varname:node_2891,prsc:2|A-4823-OUT,B-5796-RGB;n:type:ShaderForge.SFN_ValueProperty,id:408,x:32893,y:32936,ptovrint:False,ptlb:Metallic,ptin:_Metallic,varname:node_408,prsc:2,glob:False,v1:0.1;n:type:ShaderForge.SFN_ValueProperty,id:5221,x:32889,y:33015,ptovrint:False,ptlb:Roughness,ptin:_Roughness,varname:node_5221,prsc:2,glob:False,v1:0.75;n:type:ShaderForge.SFN_ValueProperty,id:227,x:32889,y:33177,ptovrint:False,ptlb:Outline Width,ptin:_OutlineWidth,varname:node_227,prsc:2,glob:False,v1:0.05;n:type:ShaderForge.SFN_Color,id:621,x:32672,y:33309,ptovrint:False,ptlb:Outline Color,ptin:_OutlineColor,varname:node_621,prsc:2,glob:False,c1:1,c2:0.4478453,c3:0.02352941,c4:1;n:type:ShaderForge.SFN_ValueProperty,id:6699,x:32672,y:33493,ptovrint:False,ptlb:Outline Intensity,ptin:_OutlineIntensity,varname:node_6699,prsc:2,glob:False,v1:1;n:type:ShaderForge.SFN_Multiply,id:1857,x:32920,y:33392,varname:node_1857,prsc:2|A-621-RGB,B-6699-OUT;proporder:7301-6760-1818-5095-1887-1004-408-5221-621-227-6699;pass:END;sub:END;*/

Shader "Custom/DiffuseReflectiveOutline" {
Properties {
_CubeMap ("CubeMap", Cube) = "_Skybox" {}
_ReflectioonColor ("Reflectioon Color", Color) = (0.5,0.5,0.5,1)
_ReflectionIntensity ("Reflection Intensity", Float ) = 1
_ColorTexture ("Color Texture", 2D) = "white" {}
_ColorMult ("Color Mult", Color) = (1,1,1,1)
_ColorIntensity ("Color Intensity", Float ) = 1
_Metallic ("Metallic", Float ) = 0.1
_Roughness ("Roughness", Float ) = 0.75
_OutlineColor ("Outline Color", Color) = (1,0.4478453,0.02352941,1)
_OutlineWidth ("Outline Width", Float ) = 0.05
_OutlineIntensity ("Outline Intensity", Float ) = 1
}
SubShader {
Tags {
"RenderType"="Opaque"
}
Pass {
Name "Outline"
Tags {
}
Cull Front

CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform float _OutlineWidth;
uniform float4 _OutlineColor;
uniform float _OutlineIntensity;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct VertexOutput {
float4 pos : SV_POSITION;
UNITY_FOG_COORDS(0)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.pos = mul(UNITY_MATRIX_MVP, float4(v.vertex.xyz + v.normal*_OutlineWidth,1));
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
float4 frag(VertexOutput i) : COLOR {
/////// Vectors:
return fixed4((_OutlineColor.rgb*_OutlineIntensity),0);
}
ENDCG
}
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}


CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDBASE
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform samplerCUBE _CubeMap;
uniform float4 _ReflectioonColor;
uniform float _ReflectionIntensity;
uniform float4 _ColorMult;
uniform sampler2D _ColorTexture; uniform float4 _ColorTexture_ST;
uniform float _ColorIntensity;
uniform float _Metallic;
uniform float _Roughness;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float4 posWorld : TEXCOORD1;
float3 normalDir : TEXCOORD2;
float4 vertexColor : COLOR;
LIGHTING_COORDS(3,4)
UNITY_FOG_COORDS(5)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.vertexColor = v.vertexColor;
o.normalDir = UnityObjectToWorldNormal(v.normal);
o.posWorld = mul(_Object2World, v.vertex);
float3 lightColor = _LightColor0.rgb;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
UNITY_TRANSFER_FOG(o,o.pos);
TRANSFER_VERTEX_TO_FRAGMENT(o)
return o;
}
float4 frag(VertexOutput i) : COLOR {
i.normalDir = normalize(i.normalDir);
/////// Vectors:
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
float3 viewReflectDirection = reflect( -viewDirection, normalDirection );
float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
float3 lightColor = _LightColor0.rgb;
float3 halfDirection = normalize(viewDirection+lightDirection);
////// Lighting:
float attenuation = LIGHT_ATTENUATION(i);
float3 attenColor = attenuation * _LightColor0.xyz;
float Pi = 3.141592654;
float InvPi = 0.31830988618;
///////// Gloss:
float gloss = 1.0 - _Roughness; // Convert roughness to gloss
float specPow = exp2( gloss * 10.0+1.0);
/////// GI Data:
UnityLight light;
#ifdef LIGHTMAP_OFF
light.color = lightColor;
light.dir = lightDirection;
light.ndotl = LambertTerm (normalDirection, light.dir);
#else
light.color = half3(0.f, 0.f, 0.f);
light.ndotl = 0.0f;
light.dir = half3(0.f, 0.f, 0.f);
#endif
UnityGIInput d;
d.light = light;
d.worldPos = i.posWorld.xyz;
d.worldViewDir = viewDirection;
d.atten = attenuation;
UnityGI gi = UnityGlobalIllumination (d, 1, gloss, normalDirection);
lightDirection = gi.light.dir;
lightColor = gi.light.color;
////// Specular:
float NdotL = max(0, dot( normalDirection, lightDirection ));
float LdotH = max(0.0,dot(lightDirection, halfDirection));
float4 node_279 = tex2D(_ColorTexture,TRANSFORM_TEX(i.uv0, _ColorTexture));
float3 diffuseColor = ((((texCUBE(_CubeMap,viewReflectDirection).rgb*_ReflectioonColor.rgb)*_ReflectionIntensity)+(_ColorIntensity*(_ColorMult.rgb*node_279.rgb)))*i.vertexColor.rgb); // Need this for specular when using metallic
float specularMonochrome;
float3 specularColor;
diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, _Metallic, specularColor, specularMonochrome );
specularMonochrome = 1-specularMonochrome;
float NdotV = max(0.0,dot( normalDirection, viewDirection ));
float NdotH = max(0.0,dot( normalDirection, halfDirection ));
float VdotH = max(0.0,dot( viewDirection, halfDirection ));
float visTerm = SmithBeckmannVisibilityTerm( NdotL, NdotV, 1.0-gloss );
float normTerm = max(0.0, NDFBlinnPhongNormalizedTerm(NdotH, RoughnessToSpecPower(1.0-gloss)));
float specularPBL = max(0, (NdotL*visTerm*normTerm) * unity_LightGammaCorrectionConsts_PIDiv4 );
float3 directSpecular = (floor(attenuation) * _LightColor0.xyz) * pow(max(0,dot(halfDirection,normalDirection)),specPow)*specularPBL*lightColor*FresnelTerm(specularColor, LdotH);
float3 specular = directSpecular;
/////// Diffuse:
NdotL = max(0.0,dot( normalDirection, lightDirection ));
half fd90 = 0.5 + 2 * LdotH * LdotH * (1-gloss);
float3 directDiffuse = ((1 +(fd90 - 1)*pow((1.00001-NdotL), 5)) * (1 + (fd90 - 1)*pow((1.00001-NdotV), 5)) * NdotL) * attenColor;
float3 indirectDiffuse = float3(0,0,0);
indirectDiffuse += UNITY_LIGHTMODEL_AMBIENT.rgb; // Ambient Light
float3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor;
/// Final Color:
float3 finalColor = diffuse + specular;
fixed4 finalRGBA = fixed4(finalColor,1);
UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
return finalRGBA;
}
ENDCG
}
Pass {
Name "FORWARD_DELTA"
Tags {
"LightMode"="ForwardAdd"
}
Blend One One


CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDADD
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#pragma multi_compile_fwdadd_fullshadows
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform samplerCUBE _CubeMap;
uniform float4 _ReflectioonColor;
uniform float _ReflectionIntensity;
uniform float4 _ColorMult;
uniform sampler2D _ColorTexture; uniform float4 _ColorTexture_ST;
uniform float _ColorIntensity;
uniform float _Metallic;
uniform float _Roughness;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float4 posWorld : TEXCOORD1;
float3 normalDir : TEXCOORD2;
float4 vertexColor : COLOR;
LIGHTING_COORDS(3,4)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.vertexColor = v.vertexColor;
o.normalDir = UnityObjectToWorldNormal(v.normal);
o.posWorld = mul(_Object2World, v.vertex);
float3 lightColor = _LightColor0.rgb;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
TRANSFER_VERTEX_TO_FRAGMENT(o)
return o;
}
float4 frag(VertexOutput i) : COLOR {
i.normalDir = normalize(i.normalDir);
/////// Vectors:
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
float3 viewReflectDirection = reflect( -viewDirection, normalDirection );
float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
float3 lightColor = _LightColor0.rgb;
float3 halfDirection = normalize(viewDirection+lightDirection);
////// Lighting:
float attenuation = LIGHT_ATTENUATION(i);
float3 attenColor = attenuation * _LightColor0.xyz;
float Pi = 3.141592654;
float InvPi = 0.31830988618;
///////// Gloss:
float gloss = 1.0 - _Roughness; // Convert roughness to gloss
float specPow = exp2( gloss * 10.0+1.0);
////// Specular:
float NdotL = max(0, dot( normalDirection, lightDirection ));
float LdotH = max(0.0,dot(lightDirection, halfDirection));
float4 node_279 = tex2D(_ColorTexture,TRANSFORM_TEX(i.uv0, _ColorTexture));
float3 diffuseColor = ((((texCUBE(_CubeMap,viewReflectDirection).rgb*_ReflectioonColor.rgb)*_ReflectionIntensity)+(_ColorIntensity*(_ColorMult.rgb*node_279.rgb)))*i.vertexColor.rgb); // Need this for specular when using metallic
float specularMonochrome;
float3 specularColor;
diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, _Metallic, specularColor, specularMonochrome );
specularMonochrome = 1-specularMonochrome;
float NdotV = max(0.0,dot( normalDirection, viewDirection ));
float NdotH = max(0.0,dot( normalDirection, halfDirection ));
float VdotH = max(0.0,dot( viewDirection, halfDirection ));
float visTerm = SmithBeckmannVisibilityTerm( NdotL, NdotV, 1.0-gloss );
float normTerm = max(0.0, NDFBlinnPhongNormalizedTerm(NdotH, RoughnessToSpecPower(1.0-gloss)));
float specularPBL = max(0, (NdotL*visTerm*normTerm) * unity_LightGammaCorrectionConsts_PIDiv4 );
float3 directSpecular = attenColor * pow(max(0,dot(halfDirection,normalDirection)),specPow)*specularPBL*lightColor*FresnelTerm(specularColor, LdotH);
float3 specular = directSpecular;
/////// Diffuse:
NdotL = max(0.0,dot( normalDirection, lightDirection ));
half fd90 = 0.5 + 2 * LdotH * LdotH * (1-gloss);
float3 directDiffuse = ((1 +(fd90 - 1)*pow((1.00001-NdotL), 5)) * (1 + (fd90 - 1)*pow((1.00001-NdotV), 5)) * NdotL) * attenColor;
float3 diffuse = directDiffuse * diffuseColor;
/// Final Color:
float3 finalColor = diffuse + specular;
return fixed4(finalColor * 1,0);
}
ENDCG
}
}
FallBack "Diffuse"
CustomEditor "ShaderForgeMaterialInspector"
}


Antwort

Antwort
Fixed
This has now been fixed in 1.16, which is releasing soon. Currently struggling with 5.1 changes :)
has far I tested it out version 1.15 having problems with compiling the Texture Asset node
Antwort
Fixed
This has now been fixed in 1.16, which is releasing soon. Currently struggling with 5.1 changes :)
Is there an ETA on the release of 1.16 or maybe a workaround I can use in the interim?
It was released about 3 minutes ago :)
Holy crap! I would say you're the best but then that would devalue how best you are. You are bestest? Yea. Bestest.