Search Unity

Shader Forge - A visual, node-based shader editor

Discussion in 'Assets and Asset Store' started by Acegikmo, Jan 11, 2014.

  1. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    chelnok likes this.
  2. Sayentify

    Sayentify

    Joined:
    Nov 8, 2017
    Posts:
    4
    I have following problem: I downloaded the ShaderForge from github, extracted the .zip file into my project folder and started unity. But unity didnt even realise i changed anything at my project, there is no ShaderForge in my "Windows" tab and i have no idea what to do now. Any ideas?
     
  3. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,025
    Did you put it in the top level of the project folder, or in the Assets directory within that? It needs to be inside Assets.
     
  4. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    86
    How to Replicate the Unity Skybox/Panoramic Shader:

    I need to replicate the Unity Skybox/Panoramic Shader. However I cant seem to get the texture's X direction (Y in world space) to map correctly. Any ideas what I am doing wrong?

    Thanks for any help.

    Here is the uv portion of the shader:

    uv_shaderforge.jpg
     
    Last edited: Sep 22, 2018
  5. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    272
    How to get the Perturbed "Bitangent Direction" and "Tangent Direction" just like the Perturbed Normal ?

    upload_2018-9-25_11-26-51.png
     
    Last edited: Sep 25, 2018
  6. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    61
    Hi,

    Sorry for a newbie question but I am caught by this question for few hours.
    I am making a simple pixel effect shader and I would like to manipulate the tiling number x and y separately in the editor (and maybe in runtime as well).
    Someone please tell me how I can expose each value of Vector2, or any workaround is very welcome.
    2018-09-29 (1).png

    [SOLVED]
    Yeah, I am so stupid! I totally forgot I could do it Editor...
     
    Last edited: Sep 29, 2018
  7. DimaFedotov

    DimaFedotov

    Joined:
    Jun 22, 2017
    Posts:
    5
    Hello! Can someone tell me please where to find a version for unity 4.7? The version on git hub works with 5 unity, but I need 4.7, and 4.7 does not work.
     
  8. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    86
    Does shader forge work for anyone in 2018.3? I've tried the version that's supposed to work in 2018.x but I can't get it to work.
     
  9. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    Yes I guess they changed some UI stuff in 2018.3, and the version on the wiki was compiled against 2018.1. Someone would need to check into the source and fix the issue.
     
  10. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    540
    There are forks that may have fixed it, check pull requests to find them.
     
  11. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    222
    I saw someone on twitter made it compatible, not sure where it is though.
     
  12. PJRM

    PJRM

    Joined:
    Mar 4, 2013
    Posts:
    290
    Does Joachim Holmer intends to continue the tool? I mean, Now unity have it's own native visual shader tool and from now on Unity will always update it.

    I bought SF when Holmer release it and it helped me alot. I don't regret it however, now i don't see reason i'd use SF if there is a native one.
     
  13. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    222
    She doesn't work on it anymore which is why it's open source now.
     
  14. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    540
    Everyone is either on Aplify Shader or Shadergraph now
     
  15. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    My personal advice: leave Shader Forge, it has no longer support since a long time.
    And ASE is loosing grip too
     
  16. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    86
    Yeah, it just sucks to re-do all of my shaders in a new node editor. Days of work probably.
     
  17. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    I've been there too but ShaderForge is over. I'm struggling to port my ASE ones to Shaders Graph and it seems to be a dead end at the moment so I'll stick with 2018.2 for a while. Also Amplify impostors are still a no go on 2018.3. it's a tough moment in the shaders world right now Porting from SF to ASE it's easy antway just really boring and time consuming.
     
  18. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    I see why it broke in 2018.3:


    She was using an internal function to draw the preview, and Unity removed it. Always a danger in using something internal. I wouldn't know what could be used to replace that function. If anyone has ideas, I'm open to them because it would be a trivial fix if there was a replacement function.

    Edit: I tried using Internal_DrawCamera, and it works in 2018.3, but as you see the preview draws every mesh in the scene, not just the one you are editing:



    So that's the problem that would have to be solved, how to make it only draw the preview mesh...
     
    Last edited: Mar 12, 2019
    Jesus likes this.
  19. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
  20. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    540
  21. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    the download is the source. I am too lazy to fork or even compile it lol. (I'd rather run an uncompiled version anyway, easier to mod when you need to)
     
  22. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,615
    eh?? what is the issue with ASE... I been using since a release, far from dead... also many other shaders like CTS made with ASE, and works great. so confused by this statement that ASE is dead...Now SF, yes sadly is dead. I used it since beta.. and used her tool before SF. back in Unity 3. even so changes happen.... Now that Unity has a native one, great...but I wouldn't count out ASE.... ASE is always advancing.... Unity is always behind on things. SUBSTANCE support don't happen most of the time.. Unreal no issues, Cry no issues, other engines no issues, but Unity always issues. so I would stick with ASE..personally.... for awhile... we have a ton of support for SUbstance, Mega Splats , CTS, and many others....
     
    Fenixake likes this.
  23. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    484

    I think the reference to ASE is that it's now got direct competition from a Unity first-party system.

    The expectation there is that the Unity SGE will stay up to date with the very latest SRP releases, version / lighting model changes, etc. The reality may not be that it's a cutting-edge software all there right now, but I think everyone believes it's only a matter of time and version updates.
     
  24. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    403
    Hi, this is a shader created by Cactus_on_Fire, Can anybody add instancing support to this shader?

    Code (CSharp):
    1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
    2. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
    3. // Shader created with Shader Forge v1.26
    4. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
    5. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    6. /*SF_DATA;ver:1.26;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:2,bsrc:3,bdst:7,dpts:2,wrdp:True,dith:0,rfrpo:False,rfrpn:Refraction,coma:15,ufog:False,aust:False,igpj:False,qofs:0,qpre:0,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.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:4013,x:33745,y:32674,varname:node_4013,prsc:2|emission-9552-OUT,difocc-2251-R,alpha-2625-OUT,clip-7845-OUT;n:type:ShaderForge.SFN_Tex2d,id:2251,x:32294,y:32701,ptovrint:False,ptlb:Diffuse,ptin:_Diffuse,varname:node_2251,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_LightAttenuation,id:5187,x:32294,y:32864,varname:node_5187,prsc:2;n:type:ShaderForge.SFN_Multiply,id:1282,x:32575,y:32706,varname:node_1282,prsc:2|A-2251-RGB,B-5187-OUT,C-3867-OUT,D-8908-OUT;n:type:ShaderForge.SFN_Slider,id:3867,x:32137,y:33017,ptovrint:False,ptlb:Diffuse Light,ptin:_DiffuseLight,varname:node_3867,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:3;n:type:ShaderForge.SFN_AmbientLight,id:2159,x:32294,y:33198,varname:node_2159,prsc:2;n:type:ShaderForge.SFN_Multiply,id:685,x:32575,y:32829,varname:node_685,prsc:2|A-2251-RGB,B-2159-RGB,C-5616-OUT,D-1549-OUT,E-3217-OUT;n:type:ShaderForge.SFN_Add,id:6622,x:32805,y:32753,varname:node_6622,prsc:2|A-1282-OUT,B-685-OUT,C-9424-OUT;n:type:ShaderForge.SFN_Vector1,id:1549,x:32575,y:32965,varname:node_1549,prsc:2,v1:3;n:type:ShaderForge.SFN_Slider,id:5616,x:32137,y:33118,ptovrint:False,ptlb:Ambient Light,ptin:_AmbientLight,varname:_DiffuseLight_copy,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:5;n:type:ShaderForge.SFN_RemapRange,id:6141,x:32575,y:33045,varname:node_6141,prsc:2,frmn:0,frmx:1,tomn:-0.5,tomx:2.5|IN-2251-A;n:type:ShaderForge.SFN_Clamp01,id:7983,x:32736,y:33045,varname:node_7983,prsc:2|IN-6141-OUT;n:type:ShaderForge.SFN_RemapRange,id:7845,x:32901,y:33045,varname:node_7845,prsc:2,frmn:0,frmx:1,tomn:0,tomx:5|IN-7983-OUT;n:type:ShaderForge.SFN_RemapRange,id:2625,x:32901,y:32890,varname:node_2625,prsc:2,frmn:0,frmx:1,tomn:0,tomx:1.5|IN-2251-A;n:type:ShaderForge.SFN_NormalVector,id:1402,x:32294,y:32531,prsc:2,pt:False;n:type:ShaderForge.SFN_LightVector,id:5076,x:32294,y:32408,varname:node_5076,prsc:2;n:type:ShaderForge.SFN_Dot,id:8774,x:32532,y:32454,varname:node_8774,prsc:2,dt:1|A-5076-OUT,B-1402-OUT;n:type:ShaderForge.SFN_RemapRange,id:2611,x:32882,y:32454,varname:node_2611,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.65|IN-9118-OUT;n:type:ShaderForge.SFN_Clamp01,id:9118,x:32706,y:32454,varname:node_9118,prsc:2|IN-8774-OUT;n:type:ShaderForge.SFN_Multiply,id:9424,x:33067,y:32454,varname:node_9424,prsc:2|A-2611-OUT,B-7551-OUT,C-2251-RGB;n:type:ShaderForge.SFN_Vector3,id:7551,x:33067,y:32361,varname:node_7551,prsc:2,v1:0.4587727,v2:0.8014706,v3:0;n:type:ShaderForge.SFN_ObjectPosition,id:3820,x:32294,y:32234,varname:node_3820,prsc:2;n:type:ShaderForge.SFN_Frac,id:2272,x:32470,y:32234,varname:node_2272,prsc:2|IN-3820-XYZ;n:type:ShaderForge.SFN_Multiply,id:9790,x:32993,y:32753,varname:node_9790,prsc:2|A-6622-OUT,B-5425-OUT,C-4135-RGB;n:type:ShaderForge.SFN_RemapRange,id:3642,x:32647,y:32234,varname:node_3642,prsc:2,frmn:0,frmx:1,tomn:0.3,tomx:1.2|IN-2272-OUT;n:type:ShaderForge.SFN_Desaturate,id:2026,x:32838,y:32234,varname:node_2026,prsc:2|COL-3642-OUT,DES-6471-OUT;n:type:ShaderForge.SFN_Vector1,id:6471,x:32838,y:32163,varname:node_6471,prsc:2,v1:0.8;n:type:ShaderForge.SFN_FragmentPosition,id:1307,x:32294,y:32092,varname:node_1307,prsc:2;n:type:ShaderForge.SFN_LightColor,id:4135,x:32993,y:32623,varname:node_4135,prsc:2;n:type:ShaderForge.SFN_FragmentPosition,id:9250,x:31703,y:32645,varname:node_9250,prsc:2;n:type:ShaderForge.SFN_Clamp01,id:3217,x:31933,y:32645,varname:node_3217,prsc:2|IN-6931-OUT;n:type:ShaderForge.SFN_RemapRange,id:6931,x:31703,y:32820,varname:node_6931,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.1|IN-9250-Y;n:type:ShaderForge.SFN_Blend,id:7043,x:33232,y:32684,varname:node_7043,prsc:2,blmd:10,clmp:True|SRC-9790-OUT,DST-9790-OUT;n:type:ShaderForge.SFN_Blend,id:1845,x:33403,y:32684,varname:node_1845,prsc:2,blmd:10,clmp:True|SRC-7043-OUT,DST-7043-OUT;n:type:ShaderForge.SFN_Lerp,id:9552,x:33403,y:32872,varname:node_9552,prsc:2|A-1845-OUT,B-9790-OUT,T-937-OUT;n:type:ShaderForge.SFN_Vector1,id:937,x:33403,y:32999,varname:node_937,prsc:2,v1:0.8;n:type:ShaderForge.SFN_RemapRange,id:8908,x:31933,y:32820,varname:node_8908,prsc:2,frmn:0,frmx:1,tomn:0.5,tomx:1|IN-3217-OUT;n:type:ShaderForge.SFN_Vector1,id:5425,x:33121,y:32909,varname:node_5425,prsc:2,v1:1;proporder:2251-3867-5616;pass:END;sub:END;*/
    7. Shader "Shader Forge/Foliage Flat" {
    8.     Properties {
    9.         _Diffuse ("Diffuse", 2D) = "white" {}
    10.         _DiffuseLight ("Diffuse Light", Range(0, 3)) = 0
    11.         _AmbientLight ("Ambient Light", Range(0, 5)) = 0
    12.         [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    13.     }
    14.     SubShader {
    15.         Tags {
    16.             "Queue"="Background"
    17.             "RenderType"="Opaque"
    18.         }
    19.         Pass {
    20.             Name "FORWARD"
    21.             Tags {
    22.                 "LightMode"="ForwardBase"
    23.             }
    24.             Blend SrcAlpha OneMinusSrcAlpha
    25.             Cull Off
    26.          
    27.          
    28.             CGPROGRAM
    29.          
    30.             #pragma vertex vert
    31.             #pragma fragment frag
    32.             #define UNITY_PASS_FORWARDBASE
    33.             #include "UnityCG.cginc"
    34.             #include "AutoLight.cginc"
    35.             #include "Lighting.cginc"
    36.             #pragma multi_compile_fwdbase_fullshadows
    37.             #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
    38.             #pragma target 3.0
    39.             uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST;
    40.             uniform float _DiffuseLight;
    41.             uniform float _AmbientLight;
    42.             struct VertexInput {
    43.                 float4 vertex : POSITION;
    44.                 float3 normal : NORMAL;
    45.                 float2 texcoord0 : TEXCOORD0;
    46.             };
    47.             struct VertexOutput {
    48.                 float4 pos : SV_POSITION;
    49.                 float2 uv0 : TEXCOORD0;
    50.                 float4 posWorld : TEXCOORD1;
    51.                 float3 normalDir : TEXCOORD2;
    52.                 LIGHTING_COORDS(3,4)
    53.             };
    54.             VertexOutput vert (VertexInput v) {
    55.                 VertexOutput o = (VertexOutput)0;
    56.                 o.uv0 = v.texcoord0;
    57.                 o.normalDir = UnityObjectToWorldNormal(v.normal);
    58.                 o.posWorld = mul(unity_ObjectToWorld, v.vertex);
    59.                 float3 lightColor = _LightColor0.rgb;
    60.                 o.pos = UnityObjectToClipPos(v.vertex );
    61.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    62.                 return o;
    63.             }
    64.             float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
    65.                 float isFrontFace = ( facing >= 0 ? 1 : 0 );
    66.                 float faceSign = ( facing >= 0 ? 1 : -1 );
    67.                 i.normalDir = normalize(i.normalDir);
    68.                 i.normalDir *= faceSign;
    69.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    70.                 float3 normalDirection = i.normalDir;
    71.                 float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
    72.                 clip((saturate((_Diffuse_var.a*3.0+-0.5))*5.0+0.0) - 0.5);
    73.                 float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    74.                 float3 lightColor = _LightColor0.rgb;
    75. ////// Lighting:
    76.                 float attenuation = LIGHT_ATTENUATION(i);
    77.                 float3 attenColor = attenuation * _LightColor0.xyz;
    78. ////// Emissive:
    79.                 float node_3217 = saturate((i.posWorld.g*0.1+0.0));
    80.                 float3 node_9790 = (((_Diffuse_var.rgb*attenuation*_DiffuseLight*(node_3217*0.5+0.5))+(_Diffuse_var.rgb*UNITY_LIGHTMODEL_AMBIENT.rgb*_AmbientLight*3.0*node_3217)+((saturate(max(0,dot(lightDirection,i.normalDir)))*0.65+0.0)*float3(0.4587727,0.8014706,0)*_Diffuse_var.rgb))*1.0*_LightColor0.rgb);
    81.                 float3 node_7043 = saturate(( node_9790 > 0.5 ? (1.0-(1.0-2.0*(node_9790-0.5))*(1.0-node_9790)) : (2.0*node_9790*node_9790) ));
    82.                 float3 emissive = lerp(saturate(( node_7043 > 0.5 ? (1.0-(1.0-2.0*(node_7043-0.5))*(1.0-node_7043)) : (2.0*node_7043*node_7043) )),node_9790,0.8);
    83.                 float3 finalColor = emissive;
    84.                 return fixed4(finalColor,(_Diffuse_var.a*1.5+0.0));
    85.             }
    86.             ENDCG
    87.         }
    88.         Pass {
    89.             Name "FORWARD_DELTA"
    90.             Tags {
    91.                 "LightMode"="ForwardAdd"
    92.             }
    93.             Blend One One
    94.             Cull Off
    95.          
    96.          
    97.             CGPROGRAM
    98.             #pragma vertex vert
    99.             #pragma fragment frag
    100.             #define UNITY_PASS_FORWARDADD
    101.             #include "UnityCG.cginc"
    102.             #include "AutoLight.cginc"
    103.             #include "Lighting.cginc"
    104.             #pragma multi_compile_fwdadd_fullshadows
    105.             #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
    106.             #pragma target 3.0
    107.             uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST;
    108.             uniform float _DiffuseLight;
    109.             uniform float _AmbientLight;
    110.             struct VertexInput {
    111.                 float4 vertex : POSITION;
    112.                 float3 normal : NORMAL;
    113.                 float2 texcoord0 : TEXCOORD0;
    114.             };
    115.             struct VertexOutput {
    116.                 float4 pos : SV_POSITION;
    117.                 float2 uv0 : TEXCOORD0;
    118.                 float4 posWorld : TEXCOORD1;
    119.                 float3 normalDir : TEXCOORD2;
    120.                 LIGHTING_COORDS(3,4)
    121.             };
    122.             VertexOutput vert (VertexInput v) {
    123.                 VertexOutput o = (VertexOutput)0;
    124.                 o.uv0 = v.texcoord0;
    125.                 o.normalDir = UnityObjectToWorldNormal(v.normal);
    126.                 o.posWorld = mul(unity_ObjectToWorld, v.vertex);
    127.                 float3 lightColor = _LightColor0.rgb;
    128.                 o.pos = UnityObjectToClipPos(v.vertex );
    129.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    130.                 return o;
    131.             }
    132.             float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
    133.                 float isFrontFace = ( facing >= 0 ? 1 : 0 );
    134.                 float faceSign = ( facing >= 0 ? 1 : -1 );
    135.                 i.normalDir = normalize(i.normalDir);
    136.                 i.normalDir *= faceSign;
    137.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    138.                 float3 normalDirection = i.normalDir;
    139.                 float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
    140.                 clip((saturate((_Diffuse_var.a*3.0+-0.5))*5.0+0.0) - 0.5);
    141.                 float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    142.                 float3 lightColor = _LightColor0.rgb;
    143. ////// Lighting:
    144.                 float attenuation = LIGHT_ATTENUATION(i);
    145.                 float3 attenColor = attenuation * _LightColor0.xyz;
    146.                 float3 finalColor = 0;
    147.                 return fixed4(finalColor * (_Diffuse_var.a*1.5+0.0),0);
    148.             }
    149.             ENDCG
    150.         }
    151.         Pass {
    152.             Name "ShadowCaster"
    153.             Tags {
    154.                 "LightMode"="ShadowCaster"
    155.             }
    156.             Offset 1, 1
    157.          
    158.             CGPROGRAM
    159.             #pragma vertex vert
    160.             #pragma fragment frag
    161.             #define UNITY_PASS_SHADOWCASTER
    162.             #include "UnityCG.cginc"
    163.             #include "Lighting.cginc"
    164.             #pragma fragmentoption ARB_precision_hint_fastest
    165.             #pragma multi_compile_shadowcaster
    166.             #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
    167.             #pragma target 3.0
    168.             uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST;
    169.             struct VertexInput {
    170.                 float4 vertex : POSITION;
    171.                 float2 texcoord0 : TEXCOORD0;
    172.             };
    173.             struct VertexOutput {
    174.                 V2F_SHADOW_CASTER;
    175.                 float2 uv0 : TEXCOORD1;
    176.             };
    177.             VertexOutput vert (VertexInput v) {
    178.                 VertexOutput o = (VertexOutput)0;
    179.                 o.uv0 = v.texcoord0;
    180.                 o.pos = UnityObjectToClipPos(v.vertex );
    181.                 TRANSFER_SHADOW_CASTER(o)
    182.                 return o;
    183.             }
    184.             float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
    185.                 float isFrontFace = ( facing >= 0 ? 1 : 0 );
    186.                 float faceSign = ( facing >= 0 ? 1 : -1 );
    187.                 float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
    188.                 clip((saturate((_Diffuse_var.a*3.0+-0.5))*5.0+0.0) - 0.5);
    189.                 SHADOW_CASTER_FRAGMENT(i)
    190.             }
    191.             ENDCG
    192.         }
    193.     }
    194.     FallBack "Diffuse"
    195.     CustomEditor "ShaderForgeMaterialInspector"
    196. }
    197.  
     
  25. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397


    I just pasted it in unmodified, seems to already have it.
     
    Crossway likes this.
  26. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    403
    It doesn't work at all! :eek:
     
  27. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    Yeah on closer inspection you're correct. I guess Shaderforge's editor doesn't have the ability to remove the checkbox if the shader doesn't support it, like Unity's default does.

    But to the request, I can't find that Shaderforge eve has Instancing support, it would have to be added manually. Best to find a good shader engineer and hire them.
     
    Crossway likes this.
  28. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    225
    What'll be the best way to change rapidly between three textures? I thought lerp might do the trick, but I've only seen examples of it blending textures, as opposed to just hard changing in-between them. Trying to do an animated sketch effect that uses textures as frames.
     
  29. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
  30. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    225
    Edit: nvm I got to work really well! Thanks! Anyway I can edit the shader to not have a fade transition?


    Is there no way to achieve this in SF? There are some other things I'd like to add such as screenspace texture.
     
    Last edited: Jan 20, 2019
  31. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    you could do it in Shaderforge, sure. I just couldn't find a shaderforge version handy. But if you're learning shaderforge, you could probably look at that shader, and re-create it in shaderforge. The shaderforge blocks just do the same things it's doing.

    As for the fading, that's from the 'Lerp' Function at the very end. You can see in the comments they have a version for not lerping:
    Code (CSharp):
    1.  
    2.                 // not lerping to next frame
    3.                 // return shot(_MainTex, i.uv, dx, dy, current) * _Color;
    4.                 int next = floor(fmod(frame + 1, frames));
    5.                 return lerp(shot(_MainTex, i.uv, dx, dy, current), shot(_MainTex, i.uv, dx, dy, next), frame - current) * _Color;
    Just uncomment that line, and comment the two lines after it.
     
  32. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    225
    Awesome. Got the transition I was looking. Thanks.
     
  33. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    I hope someone can help me, every shader that I create in shader forge isn't affected with directional lights while the object with the mesh is marked as static :S upload_2019-1-30_16-46-30.png upload_2019-1-30_16-46-51.png
     
  34. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    Objects marked static get baked lighting, this isn't a shaderforge thing.
     
  35. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    Even baking the lights they look dark, I can create 2 same objects and just change the shader of one of them, the one using the default material gets baked perfectly while I'm getting this strange result in the other

    In this picture every object has the same configuration and just the one using the shaders forge shader is failing (the 2 dark cubes are using it too)
    upload_2019-1-30_22-2-11.png
     
  36. TheBricktop

    TheBricktop

    Joined:
    Sep 3, 2012
    Posts:
    27
    updating shaderforge is really much better option now than relying on halfbroken lwrp and shadergraph, as much as I regret to admit it.
     
  37. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    You can't even use lightmaps in shader forge shaders :S at least I can't as you can see, I would appreciate help
     
  38. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,066
    After reading this... I'm sure it has to work somehow, I'm not a shader expert but I made a shader and it works with realtime gi but it fails on static. Have you tried using light probes and reflection probes? What version of unity are you using?
     
    Phoenix116 likes this.
  39. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    I'm using unity 2018.2.6f1, I think we have the same problem, when I mark an object like static and gets baked it turns black only if has a shader forge shader, I haven't tried light probes and reflection probes yet, I'll tell you if it works properly later, thanks for the help ;)

    BTW I'm using a PBR shader
     
  40. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,066
    Same as me, tbh I tried the static lighting baking and it works but it does weird stuff sometimes for some reason, I don't get it. I'm just not good at making shaders. Btw have you tried using the real time /baked emmision button on the material? Also do add light probes and have light probes enabled in your shader options. Aside from this weirdness I see no other problem with having shaders done in shader forge (if it's a simple pbr shader with extra functions, they work as intended, perhaps we're just doing something wrong.
     
  41. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    I have never been able to make my static baking work on shader forge, I seriously think it's a bug or at least it wasn't never implemented
    Idk where is the emission button on the material, sorry :S, in the image bellow you can see my shader configuration
    upload_2019-2-17_11-35-51.png

    I have tried reflection probes right now, they work perfectly fine, just the sun isn't reflected for some reason, but it's unimportant
    Everything in my shaders work fine, realtime ilumination and shadows work has intended, it's just this really strange problem :/

    Here you have my shader code: https://pastebin.com/LfRsvjwH
     
  42. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,066
    That button, you have a baked option there, also here's proof that the forge shaders work with baked this one time, still don't understand why. Ițm starting to think it's a Unity bug.

    I'll look in the shader when I have time, I need to fix my shader as well. So far yes real time works just fine. Btw there is this tree shader I'm using from the asset store (non shader forge) and it doesn't work with bakes as well.
     

    Attached Files:

    Phoenix116 likes this.
  43. Phoenix116

    Phoenix116

    Joined:
    Jun 30, 2016
    Posts:
    39
    I have tried using my shaders in 2.6 and 3.0 but they don't work in neither of the two
    Sometimes I get an error when I bake objects that says "invalid subscript shadow coord" and refers to my shader, I think the problem comes from the new versions of unity that probably changed how the lightmap works or something, we have to remember that shader forge isn't officially being updated
     
    florianalexandru05 likes this.
  44. Polygonmaker

    Polygonmaker

    Joined:
    Nov 18, 2013
    Posts:
    38
    I wouldnt mind to pay for an upgraded version of Shader Forge...I am struggling for some time since Shader forge was abandoned.
    The shader graph sucks and only work with those render pipelines.
    I really miss this awesome tool!
     
    florianalexandru05 likes this.
  45. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    801
    I mean, just get amplify shader editor. It takes a tiny bit of getting used to but within a day you'll be back at it.
     
    petey likes this.
  46. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,304
    Hey @Polygonmaker, you should check out Amplify Shader Editor, it's really good and it supports standard pipe plus LW and HD.
     
  47. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    241
    Can you explain why you think shader graph sucks? For new projects starting in 2019 (HDRP) is it better to use Amplify or Shader Graph?
     
  48. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    122
    Can't answer for Polygonmaker, but if you want my opinion:
    It's still in preview. I'm pretty sure it's going to be nice one day, but right now, it gets really, really slow when making shaders even of medium complexity (in my case because of updating the preview, even though I've closed the nodes), quality of life features like commenting or framing are missing (which can make even simple graphs look complicated), some things are buggy (editor, certain nodes like converting the space, etc.).
    So while it shows potential, it's just not there yet. (Which also makes sense, since Shader Forge oder Amplify Shader just have a bit more experience.) Since the whole HDRP thing is still in preview and thus not fully recommended for production, that's fine.
    As for what to use, it's hard to say without knowing what you need. There's no harm in just trying out Shader Graph. Maybe it already works for you. If not, you can always add Amplify Shader on top later.

    Edit: My opinion is based on Shader Graph in 2018.3. 2019.1 states that it's "production-ready", so maybe things got better.
     
    Last edited: May 3, 2019
    Vagabond_ likes this.
  49. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    The Shader Graph's interface it's slow for some reason as well for me ( stars to lag at some point after adding some nodes ) . I noticed that some time ago and it is still valid ! I kinda like the UI stile but interface is slow !
    Haven't worked with it that much because of that lag !

    Amplify Shader Editor's UI, in other hand it's so fast and smooth.
     
    Last edited: May 3, 2019
  50. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    780
    Is shader forge not supported any more?
     
unityunity