Search Unity

Shader Forge - A visual, node-based shader editor

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

  1. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,202
    Yes. Tessellation works, I just don't know the best way to connect the nodes to use my normal map as a height map to give it some extra detail...
     
  2. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    You can't directly use a normal map as a height map. Normal maps contain normalized surface vectors in tangent space, not a height offset, in any of the channels, without deriving it somehow.
    Usually, where you got the normal map from, you can export heightmaps as well, usually into the alpha channel.
    For displacement, multiply a normal vector with the heightmap, and plug the normal map into the normal input of the main node, and it should work.
     
  3. mrBeam

    mrBeam

    Joined:
    Mar 17, 2014
    Posts:
    11
    Hi Ace and everyone!
    Is it possible to access Unitys texgenmode in SF?

    I want to project cloud shadows.
     
  4. Leanimal

    Leanimal

    Joined:
    Sep 1, 2013
    Posts:
    28
    Hi all! I've seen several people ask this, but no answers yet: has anyone done decals/projectors with SF?
     
  5. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I have a question. It's probably an error due to how little I know about shader programming, but I'm trying to move the verts closer to both sides of the screen down in Y using this Vertex Offset channel on the main node but I can't get it to work. I'm basically trying to move verts downward the closer they are to the screen. For example:

    If a vert is at the very edge of the screen, it is offset -1 in Y, while if it's at about 25% away from the edge of the screen, it's only moved down 0.5 in Y. Does this make sense? Is this possible to achieve with Shader Forge?
     
  6. PedroHN

    PedroHN

    Joined:
    Dec 8, 2012
    Posts:
    4
    $NT6qO6n.jpg
    Really liking Shader Forge, but I'm kind of a noob :p
    Is there any way to make a shader only do refraction on pixels that are located behind the object/below the plane with the shader? This knowledge would be really usefull when creating water shaders :)
     
  7. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Please, how can I make the reflection to distort with the normalmap??
    I am creating a shader and a C# script based on the unity water script.

    This way it doesnt distort.

    Thanks
    $reflect.jpg
     
    Last edited: May 12, 2014
  8. Hilxs

    Hilxs

    Joined:
    Oct 16, 2013
    Posts:
    32
    Hi

    he may have had the answer in the forum, but I have not seen. I have two chanel uv in my mesh, and let me know how to forge shader I can apply a texture on a chanel and another texture on the other. This is to make a lightmap.

    Sorry for m y English
     
  9. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I've never used the TexGen modes, so I'm not entirely sure what they are even. However, it says it doesn't work when using a custom vertex program, so I presume it has something to do with generating texture coordinates. You should be able to generate them manually though, using the nodes SF provides at the moment.

    Not sure what you mean by "the verts closer to both sides of the screen".
    But if you want to move verts down as they near the camera by depth, here's one way of doing it:
    Vector3(0, -1, 0) * ( 1 / Distance( viewPos, worldPos) )

    If you want to offset it in screen space, based on some edges of the screen, you can use the screen position node.


    Not sure if it's possible at the moment. The grab pass grabs all pixels, including the ones in front of the object itself

    You won't be able to get a 100% accurate reflection, but you may be able to make it a bit more plausible if you mask out RG from the normal map, multiply it by some low value such as 0.05 (this would be the refraction intensity), and add it to the scene UVs node before plugging it in

    It depends on how you want to apply it. I suggest reading up on UV coordinates and texture blending on the Wiki: http://acegikmo.com/shaderforge/wiki/index.php?title=Shader_Forge_Wiki
     
  10. Hilxs

    Hilxs

    Joined:
    Oct 16, 2013
    Posts:
    32
    i found
    thanks XD
     
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Is there a way to remove the orange light from the preview window (or change it's color)?

    Thanks!
     
  12. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Not at the moment no
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I often flip my lighting settings to single directional light while I work on a shader to get rid of that light, just remember to put it back when your done..
     
  14. P1st3ll1

    P1st3ll1

    Joined:
    Dec 13, 2012
    Posts:
    69
    So... Before Acegikmo beats me (too many PM XD), can some one help me invert the distance between the view pos and the world pos. for a tesselation ocean ?

    I need to get more tesselated in the close view and less tesselated in far view...

    Ace told me to do this:

    Just reverse it and clamp it, or inverse it and scale it.

    Clamp01(52-distance)

    But as I'm too dumb for writing shaders, I couldn't get it XD

    Can someone help me ? =(
     
  15. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    Inverting is usually done with normalized coordinates (0 to 1), so you'd do 1 - coordinate.
     
  16. Hilxs

    Hilxs

    Joined:
    Oct 16, 2013
    Posts:
    32
    Hi
    I am a noob in shader
    I wish to control the strength of the specular with a specular map in black and white. I have not found out how I could do that

    Thanks to help
     
  17. ok8596

    ok8596

    Joined:
    Feb 21, 2014
    Posts:
    40
    Hi, please teach me.
    I maid toon shader like this setting.
    $SF_normal.png

    Then, I set double sided faces to this shader. But it was a little wrong shading like this.
    $SF_odd.png

    I must use double sided with shader.
    What should I do to make true shading with double sided?
     
  18. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Just connect a texture node to the specular input of the main node

    There's no way of solving that at the moment.

    However, you can make the mesh itself double-sided, instead of the shader
     
  19. ok8596

    ok8596

    Joined:
    Feb 21, 2014
    Posts:
    40
    Oh, no way...
    I see. Thank you for your fast repling
     
  20. Hilxs

    Hilxs

    Joined:
    Oct 16, 2013
    Posts:
    32

    Thanks that was logique :s
     
  21. vivin

    vivin

    Joined:
    Jul 10, 2013
    Posts:
    15
    Hey all,

    Im trying to wrap my head around vertex offset for a foliage shader, is there anyway for the offset to be in world space not object space? for example to have grass all blowing in the same direction?

    cheers
     
  22. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Yeah, you can use the transform node to transform a direction from local space to world space. You can convert some of the properties to global variables, such as the Vector4 property, and then set it using this:
    Shader.SetGlobalVector(string propertyName, Vector4 vec)

    Hope it helps!
     
  23. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Hi Acegikmo,

    There are many people wondering why ShaderForge does not work with PSM for PSVita and i decided to give it a try. Debugging with Psvita I found a error concerning the UV coordinates. Every time I put 2d texture sample the shader goes black. Finally i have found a way to get console errors to debug and that was the result:

    This error is repeated about 20 times before initializing. And finally:

    This is the shader:

    $sf_psvita_5142014.png

    Without multiplying the Diffuse texture the shader works perfectly.

    Could i ask some possible solution to fix this?
     

    Attached Files:

    Last edited: May 14, 2014
  24. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Alright, perhaps you can help me out debugging this. Looks like the vita may be more picky with variable names.

    Open the shader source and you'll find a part where it says struct VertexInput { in your shader. Inside that one, change:

    float2 uv0 : TEXCOORD0;

    to:

    float2 texcoord0 : TEXCOORD0;

    And in all the functions called VertexOutput vert(VertexInput v), search for:

    o.uv0 = v.uv0;

    and change it to:

    o.uv0 = v.texcoord0;

    And see if it compiles / what errors you get
     
  25. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    I could use a little help. Hopefully a simple question.

    I am using a vertex offset to create waves on a water plane. I have all black verts and then several verts that are blue. I am tiling the plane that that is being deformed (separate objects). Is there a way to clamp the edges of the planes so they are not shifting up and down as well? They are painted black, so I am not sure what I should do in the shader to lock them down.

    I tried changing them to all red and then putting a 0x0 clamp on the red channel but that didn't seem to work.

    Any help would be appreciated.
     
  26. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Yes! That was the solution, now the shader works! There is some way to modify SF to do this automatically? if i do complex shaders, doing this will give me much problems.

    Also, thank you very much for your help, but if you can solve it you could put that SF has official support for PSVITA!
     
  27. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    This is now fixed in Beta 0.34
     
  28. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Thank you very much! Now i'm testing much more complex shaders with custom lightning ( fresnel, toon ramps, cubemaps for IBL, outline and outline color, specularity ) and all are working and compiling correctly. And performance is very good. Maybe parallax is supported in Vita thanks to SF!

    Beta 0.34! all PSM developers will enjoy SF!
     
  29. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hey Ace,

    any idea why using AlphaClip might cause shadows to render over the shadow caster itself although they should be occluded by the caster from the current point of view?
    I have an image attached for you to see the issue.

    $AlphaTest_ShadowSortingIssu.gif

    I have to admit though that the shader has been modified at code level to skip some unnecessary calculations when doing the actual clip() call ... but I made sure to repeat these steps inside both the shadowcollector and the shadowcaster passes.

    Sadly I cannot show the shader code publicly. So let me know if I can send you the code via pm.
     
  30. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Looks like you have deferred lighting on your game/camera without having enabled deferred passes in the shader
     
  31. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Thx, that fixed it. :)

    Edit: Have to speak with our programmers... switching to deferred secretly... tzz tzz tzz... :D
     
    Last edited: May 14, 2014
  32. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    How does SF differ in its use of alpha compared to a unity diffuse shader (and Lux shaders)? When using a Unity diffuse shader, the alpha will control the reflection intensity of the screen space reflections. But when you try to do this with a SF shader, even with a basic shader, the alpha has no control.

    Possibly needs to be tweaked?

    $SF_basic_material_007.jpg

    thanks!
     
  33. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Is there a way to create a self shadowing shader?
     
  34. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    That's because you haven't plugged the alpha channel of the Color node into anything. It's not used. Plug it into specular to control the specular intensity with it :)

    Not that I know of
     
  35. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    I quickly tried that out, but that isn't the solution. CandelaSSR is using the alpha in the diffuse slot for the screen space reflection intensity since it's a variable that doesn't affect anything else in the shader. The basic Unity diffuse shader has this working correctly when you adjust the alpha slider within the color picker window.

    For some reason this same method doesn't work in SF. Since now that you mention that the alpha wasn't plugged into anything, still no dice when I append the alpha to the rgb when plugging it into the diffuse slot.

    thanks
     
    Last edited: May 15, 2014
  36. GrumpyOldMan

    GrumpyOldMan

    Joined:
    Sep 29, 2011
    Posts:
    51
    Looking into Shader Forge for my next project, seems pretty awesome! I'm an artist, so a lot of this goes over my head, but the node based systems are familiar, being similar to Maya's interface.
    I'm trying to figure out if I can make a toon shader that displays another texture in the black part of the shadow area, like this:
    From this to this
     
  37. PsyKaw

    PsyKaw

    Joined:
    Aug 16, 2012
    Posts:
    102
    Like this :p ?
     

    Attached Files:

  38. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    Hi Ace,

    So LIVENDA got back to me about using Shader Forge with their CandelaSSR asset, here's what they said:

    Is it possible to update SF to be compliant with this by default?

    http://forum.unity3d.com/threads/20...Unity/page22?p=1629934&viewfull=1#post1629934

    cheers
     
  39. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Shader Forge Beta 0.34 is now released!
    • All nodes can now be created with hotkeys using a new quick-select menu!
    - Holding a letter on the keyboard will display a menu of all nodes starting with that letter
    - Scrolling the mouse wheel will move you through the list
    - Clicking will create the highlighted node
    • Fixed a bug where you couldn't use some vectors in the alpha clip input
    • Fixed an issue where deferred pre-pass shaders didn't handle gloss values of zero properly
    • Fixed a bug where you couldn't use the light direction node in the outline color input
    • Fixed a bug where fog didn't work on deferred pre-pass shaders
    • Fixed a bug where shaders using UV coordinates didn't compile on the PS Vita
    • Potentially fixed a bug where your locale would make shaders write commas as decimal separators rather than periods




    Possibly, but you don't always have a Color node named _Color in your shader, and you don't always use it in that way, so there's no way for SF to know when you want to use it or not. However, if it's just about plugging in an alpha, you should be able to simply uncheck auto-sorting in the blend settings, and then plug the alpha channel of the color into the Alpha input of the main node
     
  40. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    Hey Ace,

    As always - a great update to SF :D
    I'm digging the quick-select menu!

    re: the alpha issue - auto-sorting is disabled in Deferred render path. So I also haven't had access to Alpha slot. Even when I switch to Forward and play with the Alpha slot and the sorting, it's causing all kinds of strange things with the opacity of the objects with the shader.

    If I try and re-create a Unity diffuse shader: multiply a color texture 2d into the Diffuse, the alpha slider has no affect compared to when I use the Unity diffuse shader. In that case the alpha controls the reflection intensity of CandelaSSR
     
  41. GrumpyOldMan

    GrumpyOldMan

    Joined:
    Sep 29, 2011
    Posts:
    51
    Kinda, the two different textures between lit and unlit is correct, but I also want a hard edged shadow like a toon shader makes. Your example really clarified what the light direction and normal directions nodes for me though, thanks for showing me!
     
  42. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    Hi Grumpy,

    If u want a hard edge shadow you can use the posterize node. But if you want more control, you can use a ramp texture ( way better results ). Plug the "Dot product" node to an "append" node, plug a value of 0 in the same append node, plug the append node to the UV chanel of the ramp texture and finally plug the ramp texture to the lerp mask.
     
  43. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    @Acegikmo:
    I really like the new quick/scroll select view... awesome job.
    Also thx for fixing quite some useful stuff (like the external/geometry vectors for alpha clipping). :)
     
  44. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Why can't I activate Lightmap, lightprobe, and so on when in Unlit/Custom??
     
  45. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Because lightmaps and light probes all depend on what you have plugged into Diffuse/spec/gloss, which aren't available when doing custom lighting.

    I would like to change how custom lighting works in the future, but I have to do some restructuring of the internal code first. Here's my plan:

    1. Make a node for light probes
    2. Make a node for lightmap data
    3. Remove custom lighting as a lighting *mode*, and make the custom lighting input always be available. Custom lighting will then be added on top of the auto-lighting.
     
  46. Jebus

    Jebus

    Joined:
    Sep 17, 2011
    Posts:
    18
    Loving Shader Forge, it's the bees knees :)

    Any help with the following problem would be appreciated. I'm trying to achieve an effect like this. A shader that blends between 2 textures (grey texture to pink texture), but the blending needs to happen based on both the orientation of the object (think snow cover, top to bottom), and the normal map.

    Any tips or links to any similar directions?
     

    Attached Files:

    Last edited: May 19, 2014
  47. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Mask out the G channel from the normal vector. Be sure to check the perturbed checkbox so that it reads from the normal map's perturbed vector
     
  48. wsz

    wsz

    Joined:
    Oct 20, 2012
    Posts:
    19
    I cant use the new quick-select menu because I dont have scroll :(
    I use wacom tablet :)
     
  49. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Yeah it's hard to use without a scroll. In any case, you can still use the old RMB menu and the right side panel
     
  50. bcoyle

    bcoyle

    Joined:
    May 22, 2013
    Posts:
    57
    still puttering around with trying to get the alpha to function correctly work with the Candela asset.
    here's my attempt at mimicking the basic Unity diffuse shader with SF

    $shader_forge_image_03.jpg

    Code (csharp):
    1. // Shader created with Shader Forge Beta 0.34
    2. // Shader Forge (c) Joachim Holmer - http://www.acegikmo.com/shaderforge/
    3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    4. /*SF_DATA;ver:0.34;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:1,uamb:True,mssp:True,lmpd:False,lprd:False,enco:False,frtr:True,vitr:True,dbil:False,rmgx:True,rpth:0,hqsc:True,hqlp:False,blpr:1,bsrc:3,bdst:7,culm:0,dpts:2,wrdp:False,ufog:False,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,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:1,x:32761,y:32645|diff-44-OUT,alpha-46-A;n:type:ShaderForge.SFN_Tex2d,id:6,x:33448,y:32633,ptlb:MainTex,ptin:_MainTex,tex:b8c7bde184980a044b9e802624c50911,ntxv:2,isnm:False;n:type:ShaderForge.SFN_Multiply,id:44,x:33127,y:32547|A-46-RGB,B-6-RGB;n:type:ShaderForge.SFN_Color,id:46,x:33448,y:32467,ptlb:Color,ptin:_Color,glob:False,c1:1,c2:1,c3:1,c4:1;proporder:6-46;pass:END;sub:END;*/
    5.  
    6. Shader "Shader Forge/unlit_test_sf" {
    7.     Properties {
    8.         _MainTex ("MainTex", 2D) = "black" {}
    9.         _Color ("Color", Color) = (1,1,1,1)
    10.         [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    11.     }
    12.     SubShader {
    13.         Tags {
    14.             "IgnoreProjector"="True"
    15.             "Queue"="Transparent"
    16.             "RenderType"="Transparent"
    17.         }
    18.         Pass {
    19.             Name "ForwardBase"
    20.             Tags {
    21.                 "LightMode"="ForwardBase"
    22.             }
    23.             Blend SrcAlpha OneMinusSrcAlpha
    24.             ZWrite Off
    25.            
    26.             Fog {Mode Off}
    27.             CGPROGRAM
    28.             #pragma vertex vert
    29.             #pragma fragment frag
    30.             #define UNITY_PASS_FORWARDBASE
    31.             #include "UnityCG.cginc"
    32.             #pragma multi_compile_fwdbase
    33.             #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
    34.             #pragma target 3.0
    35.             uniform float4 _LightColor0;
    36.             uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
    37.             uniform float4 _Color;
    38.             struct VertexInput {
    39.                 float4 vertex : POSITION;
    40.                 float3 normal : NORMAL;
    41.                 float2 texcoord0 : TEXCOORD0;
    42.             };
    43.             struct VertexOutput {
    44.                 float4 pos : SV_POSITION;
    45.                 float2 uv0 : TEXCOORD0;
    46.                 float4 posWorld : TEXCOORD1;
    47.                 float3 normalDir : TEXCOORD2;
    48.             };
    49.             VertexOutput vert (VertexInput v) {
    50.                 VertexOutput o;
    51.                 o.uv0 = v.texcoord0;
    52.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    53.                 o.posWorld = mul(_Object2World, v.vertex);
    54.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    55.                 return o;
    56.             }
    57.             fixed4 frag(VertexOutput i) : COLOR {
    58.                 i.normalDir = normalize(i.normalDir);
    59. /////// Normals:
    60.                 float3 normalDirection =  i.normalDir;
    61.                 float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    62. ////// Lighting:
    63.                 float attenuation = 1;
    64.                 float3 attenColor = attenuation * _LightColor0.xyz;
    65. /////// Diffuse:
    66.                 float NdotL = dot( normalDirection, lightDirection );
    67.                 float3 diffuse = max( 0.0, NdotL) * attenColor + UNITY_LIGHTMODEL_AMBIENT.rgb;
    68.                 float3 finalColor = 0;
    69.                 float3 diffuseLight = diffuse;
    70.                 float2 node_70 = i.uv0;
    71.                 finalColor += diffuseLight * (_Color.rgb*tex2D(_MainTex,TRANSFORM_TEX(node_70.rg, _MainTex)).rgb);
    72. /// Final Color:
    73.                 return fixed4(finalColor,_Color.a);
    74.             }
    75.             ENDCG
    76.         }
    77.         Pass {
    78.             Name "ForwardAdd"
    79.             Tags {
    80.                 "LightMode"="ForwardAdd"
    81.             }
    82.             Blend One One
    83.             ZWrite Off
    84.            
    85.             Fog { Color (0,0,0,0) }
    86.             CGPROGRAM
    87.             #pragma vertex vert
    88.             #pragma fragment frag
    89.             #define UNITY_PASS_FORWARDADD
    90.             #include "UnityCG.cginc"
    91.             #include "AutoLight.cginc"
    92.             #pragma multi_compile_fwdadd
    93.             #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
    94.             #pragma target 3.0
    95.             uniform float4 _LightColor0;
    96.             uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
    97.             uniform float4 _Color;
    98.             struct VertexInput {
    99.                 float4 vertex : POSITION;
    100.                 float3 normal : NORMAL;
    101.                 float2 texcoord0 : TEXCOORD0;
    102.             };
    103.             struct VertexOutput {
    104.                 float4 pos : SV_POSITION;
    105.                 float2 uv0 : TEXCOORD0;
    106.                 float4 posWorld : TEXCOORD1;
    107.                 float3 normalDir : TEXCOORD2;
    108.                 LIGHTING_COORDS(3,4)
    109.             };
    110.             VertexOutput vert (VertexInput v) {
    111.                 VertexOutput o;
    112.                 o.uv0 = v.texcoord0;
    113.                 o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
    114.                 o.posWorld = mul(_Object2World, v.vertex);
    115.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    116.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    117.                 return o;
    118.             }
    119.             fixed4 frag(VertexOutput i) : COLOR {
    120.                 i.normalDir = normalize(i.normalDir);
    121. /////// Normals:
    122.                 float3 normalDirection =  i.normalDir;
    123.                 float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    124. ////// Lighting:
    125.                 float attenuation = LIGHT_ATTENUATION(i);
    126.                 float3 attenColor = attenuation * _LightColor0.xyz;
    127. /////// Diffuse:
    128.                 float NdotL = dot( normalDirection, lightDirection );
    129.                 float3 diffuse = max( 0.0, NdotL) * attenColor;
    130.                 float3 finalColor = 0;
    131.                 float3 diffuseLight = diffuse;
    132.                 float2 node_71 = i.uv0;
    133.                 finalColor += diffuseLight * (_Color.rgb*tex2D(_MainTex,TRANSFORM_TEX(node_71.rg, _MainTex)).rgb);
    134. /// Final Color:
    135.                 return fixed4(finalColor * _Color.a,0);
    136.             }
    137.             ENDCG
    138.         }
    139.     }
    140.     FallBack "Diffuse"
    141.     CustomEditor "ShaderForgeMaterialInspector"
    142. }
    143.  
    Is there anyway to implement use of the alpha from the Color node (alpha slider)?
    $color_picker.jpg

    I can only use the alpha slider if I pipe the A channel into the Alpha of the shader - but then it starts to control the overall opacity of the material (which I don't want). Would it make sense to disable the Blending blend mode? Somehow include the alpha for internal control, but maintain an opaque shader...
     

    Attached Files: