0
Исправлен
Shader Forge can't reopen my file. (0.34)
Not able to reopen my shader (0.34). I've built a shader but when I tried to reopen it in shader forge I get a gray screen. Once again I'm using beta 0.34 here is my shader; https://www.dropbox.com/s/4olf6zrmt03zzds/testies.shade
Ответ
0
Ответ
Исправлен
Freya Holmér (Developer) 9 лет назад
This is now fixed in 1.17
Hi!
I have the same issue, cant open my createt File. I can open all other Files. Here my Shader:
Didn't change anything manually. Give me an email and i can send you the code.
I have the same issue, cant open my createt File. I can open all other Files. Here my Shader:
Didn't change anything manually. Give me an email and i can send you the code.
// 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.16;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,ufog:False,aust:True,igpj:False,qofs:0,qpre:2,rntp:3,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:3138,x:32719,y:32712,varname:node_3138,prsc:2|emission-9673-RGB,clip-9673-A,voffset-5242-OUT;n:type:ShaderForge.SFN_Tex2d,id:9673,x:32478,y:32818,ptovrint:False,ptlb:Billboard,ptin:_Billboard,varname:node_9673,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:6f0a8a16bdb4eca4282e840b4fd3cdeb,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Vector1,id:2570,x:32192,y:33437,varname:node_2570,prsc:2,v1:-1;n:type:ShaderForge.SFN_ArcSin,id:9177,x:32710,y:33223,varname:node_9177,prsc:2|IN-4950-B;n:type:ShaderForge.SFN_If,id:163,x:32923,y:33299,cmnt:alpha,varname:node_163,prsc:2|A-4950-R,B-9011-OUT,GT-9177-OUT,EQ-9177-OUT,LT-1642-OUT;n:type:ShaderForge.SFN_Vector1,id:9011,x:32912,y:33196,varname:node_9011,prsc:2,v1:0;n:type:ShaderForge.SFN_ArcSin,id:1073,x:32538,y:33417,varname:node_1073,prsc:2|IN-7194-OUT;n:type:ShaderForge.SFN_Multiply,id:7194,x:32368,y:33417,varname:node_7194,prsc:2|A-4950-B,B-2570-OUT;n:type:ShaderForge.SFN_Add,id:1642,x:32710,y:33417,varname:node_1642,prsc:2|A-1073-OUT,B-6104-OUT;n:type:ShaderForge.SFN_Pi,id:6104,x:32728,y:33575,varname:node_6104,prsc:2;n:type:ShaderForge.SFN_Sin,id:4333,x:32379,y:33741,cmnt:z - pi halbe,varname:node_4333,prsc:2|IN-7099-OUT;n:type:ShaderForge.SFN_Sin,id:7932,x:32378,y:34043,cmnt:z plus pi halbe,varname:node_7932,prsc:2|IN-6441-OUT;n:type:ShaderForge.SFN_Cos,id:5448,x:32380,y:33870,cmnt:x,varname:node_5448,prsc:2|IN-7099-OUT;n:type:ShaderForge.SFN_Cos,id:865,x:32381,y:34170,cmnt:x,varname:node_865,prsc:2|IN-6441-OUT;n:type:ShaderForge.SFN_Vector1,id:548,x:32549,y:33600,cmnt:Pi halbe,varname:node_548,prsc:2,v1:1.570796;n:type:ShaderForge.SFN_Subtract,id:7099,x:32196,y:33741,varname:node_7099,prsc:2|A-163-OUT,B-548-OUT;n:type:ShaderForge.SFN_Add,id:6441,x:32202,y:34043,varname:node_6441,prsc:2|A-163-OUT,B-548-OUT;n:type:ShaderForge.SFN_Append,id:4593,x:32728,y:33805,cmnt:Vector alpha minus pi halbe,varname:node_4593,prsc:2|A-1881-OUT,B-9011-OUT,C-8599-OUT;n:type:ShaderForge.SFN_Append,id:4396,x:32736,y:34076,cmnt:Vector alpha plus pi halbe,varname:node_4396,prsc:2|A-6391-OUT,B-9011-OUT,C-4529-OUT;n:type:ShaderForge.SFN_NormalVector,id:8844,x:32204,y:34340,prsc:2,pt:False;n:type:ShaderForge.SFN_Dot,id:9201,x:32381,y:34340,cmnt:Surface direction,varname:node_9201,prsc:2,dt:0|A-8844-OUT,B-7246-OUT;n:type:ShaderForge.SFN_FragmentPosition,id:3112,x:32201,y:34508,varname:node_3112,prsc:2;n:type:ShaderForge.SFN_ObjectPosition,id:1867,x:32202,y:34628,varname:node_1867,prsc:2;n:type:ShaderForge.SFN_Subtract,id:222,x:32381,y:34578,varname:node_222,prsc:2|A-3112-XYZ,B-1867-XYZ;n:type:ShaderForge.SFN_Dot,id:4578,x:32630,y:34578,cmnt:Rechts oder links gelegen,varname:node_4578,prsc:2,dt:0|A-222-OUT,B-4593-OUT;n:type:ShaderForge.SFN_Multiply,id:2282,x:32739,y:34366,varname:node_2282,prsc:2|A-9201-OUT,B-4578-OUT;n:type:ShaderForge.SFN_If,id:4422,x:33011,y:34366,cmnt:plus oder minus pi halbe,varname:node_4422,prsc:2|A-2282-OUT,B-9011-OUT,GT-4396-OUT,EQ-4396-OUT,LT-4593-OUT;n:type:ShaderForge.SFN_ObjectPosition,id:6172,x:33011,y:34170,varname:node_6172,prsc:2;n:type:ShaderForge.SFN_Add,id:1646,x:33229,y:34170,varname:node_1646,prsc:2|A-6172-XYZ,B-4422-OUT;n:type:ShaderForge.SFN_Subtract,id:3229,x:33508,y:34057,varname:node_3229,prsc:2|A-1646-OUT,B-1650-XYZ;n:type:ShaderForge.SFN_ViewPosition,id:7412,x:33010,y:34040,varname:node_7412,prsc:2;n:type:ShaderForge.SFN_Subtract,id:3500,x:33249,y:33893,varname:node_3500,prsc:2|A-6172-XYZ,B-7412-XYZ;n:type:ShaderForge.SFN_FragmentPosition,id:1650,x:33291,y:34039,varname:node_1650,prsc:2;n:type:ShaderForge.SFN_ValueProperty,id:729,x:31923,y:33926,ptovrint:False,ptlb:Radius,ptin:_Radius,varname:node_729,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:8599,x:32545,y:33741,varname:node_8599,prsc:2|A-4333-OUT,B-729-OUT;n:type:ShaderForge.SFN_Multiply,id:1881,x:32545,y:33870,varname:node_1881,prsc:2|A-5448-OUT,B-729-OUT;n:type:ShaderForge.SFN_Multiply,id:4529,x:32545,y:34043,varname:node_4529,prsc:2|A-7932-OUT,B-729-OUT;n:type:ShaderForge.SFN_Multiply,id:6391,x:32545,y:34170,varname:node_6391,prsc:2|A-865-OUT,B-729-OUT;n:type:ShaderForge.SFN_Append,id:5242,x:33953,y:34052,varname:node_5242,prsc:2|A-9878-R,B-9011-OUT,C-9878-B;n:type:ShaderForge.SFN_ComponentMask,id:9878,x:33737,y:34052,varname:node_9878,prsc:2,cc1:0,cc2:1,cc3:2,cc4:-1|IN-3229-OUT;n:type:ShaderForge.SFN_ComponentMask,id:592,x:31816,y:33228,varname:node_592,prsc:2,cc1:0,cc2:1,cc3:2,cc4:-1|IN-3500-OUT;n:type:ShaderForge.SFN_Append,id:9065,x:32015,y:33228,varname:node_9065,prsc:2|A-592-R,B-9011-OUT,C-592-B;n:type:ShaderForge.SFN_Normalize,id:7246,x:32194,y:33227,varname:node_7246,prsc:2|IN-9065-OUT;n:type:ShaderForge.SFN_ComponentMask,id:4950,x:32437,y:33225,varname:node_4950,prsc:2,cc1:0,cc2:1,cc3:2,cc4:-1|IN-7246-OUT;proporder:9673-729;pass:END;sub:END;*/
Shader "Shader Forge/Billboard Shader" {
Properties {
_Billboard ("Billboard", 2D) = "white" {}
_Radius ("Radius", Float ) = 0.5
[HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {
"Queue"="AlphaTest"
"RenderType"="TransparentCutout"
}
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDBASE
#include "UnityCG.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
#pragma target 3.0
uniform sampler2D _Billboard; uniform float4 _Billboard_ST;
uniform float _Radius;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float4 posWorld : TEXCOORD1;
float3 normalDir : TEXCOORD2;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.normalDir = UnityObjectToWorldNormal(v.normal);
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
float3 node_592 = (objPos.rgb-_WorldSpaceCameraPos).rgb;
float node_9011 = 0.0;
float3 node_9065 = float3(node_592.r,node_9011,node_592.b);
float3 node_7246 = normalize(node_9065);
float3 node_4950 = node_7246.rgb;
float node_163_if_leA = step(node_4950.r,node_9011);
float node_163_if_leB = step(node_9011,node_4950.r);
float node_2570 = (-1.0);
float node_9177 = asin(node_4950.b);
float node_163 = lerp((node_163_if_leA*(asin((node_4950.b*node_2570))+3.141592654))+(node_163_if_leB*node_9177),node_9177,node_163_if_leA*node_163_if_leB); // alpha
float node_548 = 1.570796; // Pi halbe
float node_7099 = (node_163-node_548);
float3 node_4593 = float3((cos(node_7099)*_Radius),node_9011,(sin(node_7099)*_Radius)); // Vector alpha minus pi halbe
float node_4422_if_leA = step((dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)),node_9011);
float node_4422_if_leB = step(node_9011,(dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)));
float node_6441 = (node_163+node_548);
float3 node_4396 = float3((cos(node_6441)*_Radius),node_9011,(sin(node_6441)*_Radius)); // Vector alpha plus pi halbe
float3 node_9878 = ((objPos.rgb+lerp((node_4422_if_leA*node_4593)+(node_4422_if_leB*node_4396),node_4396,node_4422_if_leA*node_4422_if_leB))-mul(_Object2World, v.vertex).rgb).rgb;
v.vertex.xyz += float3(node_9878.r,node_9011,node_9878.b);
o.posWorld = mul(_Object2World, v.vertex);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
float4 frag(VertexOutput i) : COLOR {
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
i.normalDir = normalize(i.normalDir);
/////// Vectors:
float3 normalDirection = i.normalDir;
float4 _Billboard_var = tex2D(_Billboard,TRANSFORM_TEX(i.uv0, _Billboard));
clip(_Billboard_var.a - 0.5);
////// Lighting:
////// Emissive:
float3 emissive = _Billboard_var.rgb;
float3 finalColor = emissive;
return fixed4(finalColor,1);
}
ENDCG
}
Pass {
Name "ShadowCaster"
Tags {
"LightMode"="ShadowCaster"
}
Offset 1, 1
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_SHADOWCASTER
#include "UnityCG.cginc"
#include "Lighting.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
#pragma target 3.0
uniform sampler2D _Billboard; uniform float4 _Billboard_ST;
uniform float _Radius;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
};
struct VertexOutput {
V2F_SHADOW_CASTER;
float2 uv0 : TEXCOORD1;
float4 posWorld : TEXCOORD2;
float3 normalDir : TEXCOORD3;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.normalDir = UnityObjectToWorldNormal(v.normal);
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
float3 node_592 = (objPos.rgb-_WorldSpaceCameraPos).rgb;
float node_9011 = 0.0;
float3 node_9065 = float3(node_592.r,node_9011,node_592.b);
float3 node_7246 = normalize(node_9065);
float3 node_4950 = node_7246.rgb;
float node_163_if_leA = step(node_4950.r,node_9011);
float node_163_if_leB = step(node_9011,node_4950.r);
float node_2570 = (-1.0);
float node_9177 = asin(node_4950.b);
float node_163 = lerp((node_163_if_leA*(asin((node_4950.b*node_2570))+3.141592654))+(node_163_if_leB*node_9177),node_9177,node_163_if_leA*node_163_if_leB); // alpha
float node_548 = 1.570796; // Pi halbe
float node_7099 = (node_163-node_548);
float3 node_4593 = float3((cos(node_7099)*_Radius),node_9011,(sin(node_7099)*_Radius)); // Vector alpha minus pi halbe
float node_4422_if_leA = step((dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)),node_9011);
float node_4422_if_leB = step(node_9011,(dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)));
float node_6441 = (node_163+node_548);
float3 node_4396 = float3((cos(node_6441)*_Radius),node_9011,(sin(node_6441)*_Radius)); // Vector alpha plus pi halbe
float3 node_9878 = ((objPos.rgb+lerp((node_4422_if_leA*node_4593)+(node_4422_if_leB*node_4396),node_4396,node_4422_if_leA*node_4422_if_leB))-mul(_Object2World, v.vertex).rgb).rgb;
v.vertex.xyz += float3(node_9878.r,node_9011,node_9878.b);
o.posWorld = mul(_Object2World, v.vertex);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
TRANSFER_SHADOW_CASTER(o)
return o;
}
float4 frag(VertexOutput i) : COLOR {
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
i.normalDir = normalize(i.normalDir);
/////// Vectors:
float3 normalDirection = i.normalDir;
float4 _Billboard_var = tex2D(_Billboard,TRANSFORM_TEX(i.uv0, _Billboard));
clip(_Billboard_var.a - 0.5);
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
}
FallBack "Diffuse"
CustomEditor "ShaderForgeMaterialInspector"
}
Unity Error Messages:
warning
Attempt to find input node of connector IN of Comp. Mask
UnityEngine.Debug:LogWarning(Object)
ShaderForge.SF_Node:GetInputData(String)
ShaderForge.SFN_ComponentMask:IsUniformOutput()
ShaderForge.SFN_If:IsUniformOutput()
error
NullReferenceException: Object reference not set to an instance of an object
ShaderForge.SF_Node.GetInputData (System.String id)
ShaderForge.SFN_ComponentMask.IsUniformOutput ()
ShaderForge.SFN_If.IsUniformOutput ()
ShaderForge.SF_NodePreview.Combine ()
the shader is not complete jet
// Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.16;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,ufog:False,aust:True,igpj:False,qofs:0,qpre:2,rntp:3,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:3138,x:32719,y:32712,varname:node_3138,prsc:2|emission-9673-RGB,clip-9673-A,voffset-5242-OUT;n:type:ShaderForge.SFN_Tex2d,id:9673,x:32478,y:32818,ptovrint:False,ptlb:Billboard,ptin:_Billboard,varname:node_9673,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:6f0a8a16bdb4eca4282e840b4fd3cdeb,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Vector1,id:2570,x:32192,y:33437,varname:node_2570,prsc:2,v1:-1;n:type:ShaderForge.SFN_ArcSin,id:9177,x:32710,y:33223,varname:node_9177,prsc:2|IN-4950-B;n:type:ShaderForge.SFN_If,id:163,x:32923,y:33299,cmnt:alpha,varname:node_163,prsc:2|A-4950-R,B-9011-OUT,GT-9177-OUT,EQ-9177-OUT,LT-1642-OUT;n:type:ShaderForge.SFN_Vector1,id:9011,x:32912,y:33196,varname:node_9011,prsc:2,v1:0;n:type:ShaderForge.SFN_ArcSin,id:1073,x:32538,y:33417,varname:node_1073,prsc:2|IN-7194-OUT;n:type:ShaderForge.SFN_Multiply,id:7194,x:32368,y:33417,varname:node_7194,prsc:2|A-4950-B,B-2570-OUT;n:type:ShaderForge.SFN_Add,id:1642,x:32710,y:33417,varname:node_1642,prsc:2|A-1073-OUT,B-6104-OUT;n:type:ShaderForge.SFN_Pi,id:6104,x:32728,y:33575,varname:node_6104,prsc:2;n:type:ShaderForge.SFN_Sin,id:4333,x:32379,y:33741,cmnt:z - pi halbe,varname:node_4333,prsc:2|IN-7099-OUT;n:type:ShaderForge.SFN_Sin,id:7932,x:32378,y:34043,cmnt:z plus pi halbe,varname:node_7932,prsc:2|IN-6441-OUT;n:type:ShaderForge.SFN_Cos,id:5448,x:32380,y:33870,cmnt:x,varname:node_5448,prsc:2|IN-7099-OUT;n:type:ShaderForge.SFN_Cos,id:865,x:32381,y:34170,cmnt:x,varname:node_865,prsc:2|IN-6441-OUT;n:type:ShaderForge.SFN_Vector1,id:548,x:32549,y:33600,cmnt:Pi halbe,varname:node_548,prsc:2,v1:1.570796;n:type:ShaderForge.SFN_Subtract,id:7099,x:32196,y:33741,varname:node_7099,prsc:2|A-163-OUT,B-548-OUT;n:type:ShaderForge.SFN_Add,id:6441,x:32202,y:34043,varname:node_6441,prsc:2|A-163-OUT,B-548-OUT;n:type:ShaderForge.SFN_Append,id:4593,x:32728,y:33805,cmnt:Vector alpha minus pi halbe,varname:node_4593,prsc:2|A-1881-OUT,B-9011-OUT,C-8599-OUT;n:type:ShaderForge.SFN_Append,id:4396,x:32736,y:34076,cmnt:Vector alpha plus pi halbe,varname:node_4396,prsc:2|A-6391-OUT,B-9011-OUT,C-4529-OUT;n:type:ShaderForge.SFN_NormalVector,id:8844,x:32204,y:34340,prsc:2,pt:False;n:type:ShaderForge.SFN_Dot,id:9201,x:32381,y:34340,cmnt:Surface direction,varname:node_9201,prsc:2,dt:0|A-8844-OUT,B-7246-OUT;n:type:ShaderForge.SFN_FragmentPosition,id:3112,x:32201,y:34508,varname:node_3112,prsc:2;n:type:ShaderForge.SFN_ObjectPosition,id:1867,x:32202,y:34628,varname:node_1867,prsc:2;n:type:ShaderForge.SFN_Subtract,id:222,x:32381,y:34578,varname:node_222,prsc:2|A-3112-XYZ,B-1867-XYZ;n:type:ShaderForge.SFN_Dot,id:4578,x:32630,y:34578,cmnt:Rechts oder links gelegen,varname:node_4578,prsc:2,dt:0|A-222-OUT,B-4593-OUT;n:type:ShaderForge.SFN_Multiply,id:2282,x:32739,y:34366,varname:node_2282,prsc:2|A-9201-OUT,B-4578-OUT;n:type:ShaderForge.SFN_If,id:4422,x:33011,y:34366,cmnt:plus oder minus pi halbe,varname:node_4422,prsc:2|A-2282-OUT,B-9011-OUT,GT-4396-OUT,EQ-4396-OUT,LT-4593-OUT;n:type:ShaderForge.SFN_ObjectPosition,id:6172,x:33011,y:34170,varname:node_6172,prsc:2;n:type:ShaderForge.SFN_Add,id:1646,x:33229,y:34170,varname:node_1646,prsc:2|A-6172-XYZ,B-4422-OUT;n:type:ShaderForge.SFN_Subtract,id:3229,x:33508,y:34057,varname:node_3229,prsc:2|A-1646-OUT,B-1650-XYZ;n:type:ShaderForge.SFN_ViewPosition,id:7412,x:33010,y:34040,varname:node_7412,prsc:2;n:type:ShaderForge.SFN_Subtract,id:3500,x:33249,y:33893,varname:node_3500,prsc:2|A-6172-XYZ,B-7412-XYZ;n:type:ShaderForge.SFN_FragmentPosition,id:1650,x:33291,y:34039,varname:node_1650,prsc:2;n:type:ShaderForge.SFN_ValueProperty,id:729,x:31923,y:33926,ptovrint:False,ptlb:Radius,ptin:_Radius,varname:node_729,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:8599,x:32545,y:33741,varname:node_8599,prsc:2|A-4333-OUT,B-729-OUT;n:type:ShaderForge.SFN_Multiply,id:1881,x:32545,y:33870,varname:node_1881,prsc:2|A-5448-OUT,B-729-OUT;n:type:ShaderForge.SFN_Multiply,id:4529,x:32545,y:34043,varname:node_4529,prsc:2|A-7932-OUT,B-729-OUT;n:type:ShaderForge.SFN_Multiply,id:6391,x:32545,y:34170,varname:node_6391,prsc:2|A-865-OUT,B-729-OUT;n:type:ShaderForge.SFN_Append,id:5242,x:33953,y:34052,varname:node_5242,prsc:2|A-9878-R,B-9011-OUT,C-9878-B;n:type:ShaderForge.SFN_ComponentMask,id:9878,x:33737,y:34052,varname:node_9878,prsc:2,cc1:0,cc2:1,cc3:2,cc4:-1|IN-3229-OUT;n:type:ShaderForge.SFN_ComponentMask,id:592,x:31816,y:33228,varname:node_592,prsc:2,cc1:0,cc2:1,cc3:2,cc4:-1|IN-3500-OUT;n:type:ShaderForge.SFN_Append,id:9065,x:32015,y:33228,varname:node_9065,prsc:2|A-592-R,B-9011-OUT,C-592-B;n:type:ShaderForge.SFN_Normalize,id:7246,x:32194,y:33227,varname:node_7246,prsc:2|IN-9065-OUT;n:type:ShaderForge.SFN_ComponentMask,id:4950,x:32437,y:33225,varname:node_4950,prsc:2,cc1:0,cc2:1,cc3:2,cc4:-1|IN-7246-OUT;proporder:9673-729;pass:END;sub:END;*/
Shader "Shader Forge/Billboard Shader" {
Properties {
_Billboard ("Billboard", 2D) = "white" {}
_Radius ("Radius", Float ) = 0.5
[HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {
"Queue"="AlphaTest"
"RenderType"="TransparentCutout"
}
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDBASE
#include "UnityCG.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
#pragma target 3.0
uniform sampler2D _Billboard; uniform float4 _Billboard_ST;
uniform float _Radius;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float4 posWorld : TEXCOORD1;
float3 normalDir : TEXCOORD2;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.normalDir = UnityObjectToWorldNormal(v.normal);
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
float3 node_592 = (objPos.rgb-_WorldSpaceCameraPos).rgb;
float node_9011 = 0.0;
float3 node_9065 = float3(node_592.r,node_9011,node_592.b);
float3 node_7246 = normalize(node_9065);
float3 node_4950 = node_7246.rgb;
float node_163_if_leA = step(node_4950.r,node_9011);
float node_163_if_leB = step(node_9011,node_4950.r);
float node_2570 = (-1.0);
float node_9177 = asin(node_4950.b);
float node_163 = lerp((node_163_if_leA*(asin((node_4950.b*node_2570))+3.141592654))+(node_163_if_leB*node_9177),node_9177,node_163_if_leA*node_163_if_leB); // alpha
float node_548 = 1.570796; // Pi halbe
float node_7099 = (node_163-node_548);
float3 node_4593 = float3((cos(node_7099)*_Radius),node_9011,(sin(node_7099)*_Radius)); // Vector alpha minus pi halbe
float node_4422_if_leA = step((dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)),node_9011);
float node_4422_if_leB = step(node_9011,(dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)));
float node_6441 = (node_163+node_548);
float3 node_4396 = float3((cos(node_6441)*_Radius),node_9011,(sin(node_6441)*_Radius)); // Vector alpha plus pi halbe
float3 node_9878 = ((objPos.rgb+lerp((node_4422_if_leA*node_4593)+(node_4422_if_leB*node_4396),node_4396,node_4422_if_leA*node_4422_if_leB))-mul(_Object2World, v.vertex).rgb).rgb;
v.vertex.xyz += float3(node_9878.r,node_9011,node_9878.b);
o.posWorld = mul(_Object2World, v.vertex);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
float4 frag(VertexOutput i) : COLOR {
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
i.normalDir = normalize(i.normalDir);
/////// Vectors:
float3 normalDirection = i.normalDir;
float4 _Billboard_var = tex2D(_Billboard,TRANSFORM_TEX(i.uv0, _Billboard));
clip(_Billboard_var.a - 0.5);
////// Lighting:
////// Emissive:
float3 emissive = _Billboard_var.rgb;
float3 finalColor = emissive;
return fixed4(finalColor,1);
}
ENDCG
}
Pass {
Name "ShadowCaster"
Tags {
"LightMode"="ShadowCaster"
}
Offset 1, 1
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_SHADOWCASTER
#include "UnityCG.cginc"
#include "Lighting.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
#pragma target 3.0
uniform sampler2D _Billboard; uniform float4 _Billboard_ST;
uniform float _Radius;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
};
struct VertexOutput {
V2F_SHADOW_CASTER;
float2 uv0 : TEXCOORD1;
float4 posWorld : TEXCOORD2;
float3 normalDir : TEXCOORD3;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.normalDir = UnityObjectToWorldNormal(v.normal);
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
float3 node_592 = (objPos.rgb-_WorldSpaceCameraPos).rgb;
float node_9011 = 0.0;
float3 node_9065 = float3(node_592.r,node_9011,node_592.b);
float3 node_7246 = normalize(node_9065);
float3 node_4950 = node_7246.rgb;
float node_163_if_leA = step(node_4950.r,node_9011);
float node_163_if_leB = step(node_9011,node_4950.r);
float node_2570 = (-1.0);
float node_9177 = asin(node_4950.b);
float node_163 = lerp((node_163_if_leA*(asin((node_4950.b*node_2570))+3.141592654))+(node_163_if_leB*node_9177),node_9177,node_163_if_leA*node_163_if_leB); // alpha
float node_548 = 1.570796; // Pi halbe
float node_7099 = (node_163-node_548);
float3 node_4593 = float3((cos(node_7099)*_Radius),node_9011,(sin(node_7099)*_Radius)); // Vector alpha minus pi halbe
float node_4422_if_leA = step((dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)),node_9011);
float node_4422_if_leB = step(node_9011,(dot(v.normal,node_7246)*dot((mul(_Object2World, v.vertex).rgb-objPos.rgb),node_4593)));
float node_6441 = (node_163+node_548);
float3 node_4396 = float3((cos(node_6441)*_Radius),node_9011,(sin(node_6441)*_Radius)); // Vector alpha plus pi halbe
float3 node_9878 = ((objPos.rgb+lerp((node_4422_if_leA*node_4593)+(node_4422_if_leB*node_4396),node_4396,node_4422_if_leA*node_4422_if_leB))-mul(_Object2World, v.vertex).rgb).rgb;
v.vertex.xyz += float3(node_9878.r,node_9011,node_9878.b);
o.posWorld = mul(_Object2World, v.vertex);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
TRANSFER_SHADOW_CASTER(o)
return o;
}
float4 frag(VertexOutput i) : COLOR {
float4 objPos = mul ( _Object2World, float4(0,0,0,1) );
i.normalDir = normalize(i.normalDir);
/////// Vectors:
float3 normalDirection = i.normalDir;
float4 _Billboard_var = tex2D(_Billboard,TRANSFORM_TEX(i.uv0, _Billboard));
clip(_Billboard_var.a - 0.5);
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
}
FallBack "Diffuse"
CustomEditor "ShaderForgeMaterialInspector"
}
Unity Error Messages:
warning
Attempt to find input node of connector IN of Comp. Mask
UnityEngine.Debug:LogWarning(Object)
ShaderForge.SF_Node:GetInputData(String)
ShaderForge.SFN_ComponentMask:IsUniformOutput()
ShaderForge.SFN_If:IsUniformOutput()
error
NullReferenceException: Object reference not set to an instance of an object
ShaderForge.SF_Node.GetInputData (System.String id)
ShaderForge.SFN_ComponentMask.IsUniformOutput ()
ShaderForge.SFN_If.IsUniformOutput ()
ShaderForge.SF_NodePreview.Combine ()
the shader is not complete jet
Ok, thank you very much. shader forge opened shader programming for me. its a really good tool. When will you release the new version? Or till then is there another solution to open it (like change a bit of code)?
There are some more little issues. When i connect view direction to vertex offset, everything gets pink an an error appears "view direction not defined". i run this shader in dx11 on dx10 gpu.
another thing is that shaderforge has problems to delete nodes. wen i have many nodes and i want to delete some of them it might happen, that it needs very long time or crashes. (haven't waitet more than 4 minutes).
thank you very much,
Andre
There are some more little issues. When i connect view direction to vertex offset, everything gets pink an an error appears "view direction not defined". i run this shader in dx11 on dx10 gpu.
another thing is that shaderforge has problems to delete nodes. wen i have many nodes and i want to delete some of them it might happen, that it needs very long time or crashes. (haven't waitet more than 4 minutes).
thank you very much,
Andre
The new version will most likely release on Monday.
The view direction issue is known, I'm not sure when/if that is going to be fixed.
The delete bug sounds odd though, you might want to make a separate thread about that, and explain the problem in-detail with a clear repro case
The view direction issue is known, I'm not sure when/if that is going to be fixed.
The delete bug sounds odd though, you might want to make a separate thread about that, and explain the problem in-detail with a clear repro case
Сервис поддержки клиентов работает на платформе UserEcho