Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shader Forge - A visual, node-based shader editor

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

  1. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    You can create a particle system that fades in and out around the same area with the same light color from the light source to fake as if the smoke is lit by the light above it.

     
  2. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    I found this post, but the image is super small.
    http://blog.cokane.com/post/123433881355/lit-particles-in-unity-with-shader-forge

    Does anyone know how exactly this method is achieved, it seems to work quite well?
     
  3. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    hopeful likes this.
  4. jermaineatl

    jermaineatl

    Joined:
    May 4, 2014
    Posts:
    9
    sweet are you using vertex offsets to do the grass animations?
     
  5. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Nope, but it's easily doable.
     
  6. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    please i really need to know how to make a very very veeeery basic volumetric cube in shader forge :(
     
  7. Deleted User

    Deleted User

    Guest

    Sorry for my delay in answering, I'm logged only today. However for make volumetric clouds i have overlying multiple quad (you can make this with a script), with a noise connected to alpha (for give softening) and alpha clip (for shadow). After this I have create this tree nodes, for give a rounded shape to clouds :) :



    P.S = Can I know how have you created your ocean? :D
     
    Last edited by a moderator: Dec 29, 2015
    looki666 likes this.
  8. Deleted User

    Deleted User

    Guest

    Not exactly. I search more a noise like that, but with randomness of step a >= b (like a cloud if you understand what i mean).
     
  9. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Sorry to be annoying but I really need help with this. Kind of stuck with this problem.

    Thanks
     
  10. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey All,

    I am having a similar problem in VR. The leaves on my trees (simple billboard shader) roll when i tilt my head. Is there a way to only rotate the billboard on the Y axis? I can see this being a problem in the future also as more VR games get developed. I am fairly certain the answer is a matrix that I need to multiply in code but not 100% sure.

    Cheers,
    Colton
     
  11. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I think it would only be possible if SF allowed multiple passes and if could use the previous passes.
     
  12. Deleted User

    Deleted User

    Guest

    Not necessarily in this case.
     
  13. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I can get the separate passes then compose it with SF by subtracting the front face depths from the back face depths, and another pass reads whatevers inside it to occlude the objects within. But when I tried it in SF, it doesn't subtract the depths no matter what even though they are numerical values.I think this is because it tries the read both faces at the same time which prevents it to read the front_back depths and operate on them.
     
    Last edited: Dec 29, 2015
  14. Deleted User

    Deleted User

    Guest

    How I have said before, you can obtain a volumetric object in another way, similar to a implementation into my previous project (glowmap if your remember). So said in a few words, the only thing you must do is add a some quads to the scene, with different Y position.

    It is less performant than multiple pass, but it is anyway a good alternative.
     
  15. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Yeah I did my clouds like that as well. But I think he wants to cover the entire ocean with a volume object. Calculating the depth would be more efficient and accurate. I made a good example but I can't post it because my Unity started to crash at startup :(
     
    Deleted User likes this.
  16. Deleted User

    Deleted User

    Guest

    If him want this, so yes.

    P.S = Also my installation of units has started to give me problems ( occasional blocks ). I do not know if because of SF.
     
  17. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Got my Unity back :)
    Here's what I was talking about. It's a physically accurate volume shader that does the calculations by rendering the inside thickness of a mesh with the method I mentioned above. Although I tried the same thing with just a single SF shader and couldn't get it to work.

     
    Gekigengar and Deleted User like this.
  18. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    On the topic of volumetric effects, I found a good way to hack it in for some cases was abusing the parallax mapping repeatedly. I use it on planet rendering, for the clouds. As long as you're not in the atmosphere (that close) you can effectively get what looks like layered, 3d clouds rendered on a sphere, with what looks like correct, soft self-shadowing.
     
  19. Deleted User

    Deleted User

    Guest

    Notable. However under this point of view SF is still incomplete. And unfortunately we must wait at least 1 year and half, for know if Unity will buy SF for implement own editor or not.
     
  20. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    Hi! and thanks for your answers, my goal was to make a 50x50x50 volumetric cube and make it follow you in the X,Z axis when you are underwater, so thats why i want some "real" volumetric because you will be inside the object, for the moment i have it done just by scripting but i wish i could make it through SF :(
     
  21. barker_s

    barker_s

    Joined:
    Jul 17, 2012
    Posts:
    29
    Hi guys. I'm new to Shader Forge (even though I bought it a while ago) and to shaders in general, so I thought I could get some help here.

    I have created some simple voxel terrain and I'd like to create a shader that would allow me to see through the terrain mesh down to a certain level.

    Here's what I have so far:

    Original terrain:


    And with my shader:


    I used the following nodes:


    So far so good, but there are two problems I can't seem to wrap my head around:

    1. Parts of the mesh that are affected by the opacity clip no longer cast shadows. Is it possible, using Shader Forge, to have my transparent mesh interact with light? I want to be able to see the tunnels/caves inside the mountain but not have them affected by sunlight.

    2. As you can see from the screenshots, the mesh is simply cut at a certain level so you can see right through it. Is it possible to fill the resulting gaps with a texture or solid color (in-shader of course)?
     
  22. Studio_Akiba

    Studio_Akiba

    Joined:
    Mar 3, 2014
    Posts:
    1,421
    What happened to the Shader Forge editor?
    Before putting this shader into a new project, the preview wasn't black, the texture in the Albedo slot is NOT black but a light brown wood, what has happened?
    sf_standardshader_12302015.png
     
  23. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    @Cactus_on_Fire can you share your shader that makes a nice glow to objetcs? would be nice :D
     
  24. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Much Fillrate

    Such Overdraw

    WOW

    1/ For stylistic reasons, and possibly practical ones, have you tried dithering? Think of a chequered flag, and making the white squares invisible over that height you set. Also, because every second pixel will be solid, you should get some form of shadowing from them.

    2/ Have you seen the depth blend node? I think that's that it's called. You usually use it to blend particles where they intersect with geometry. BUT, what they actually do is test how far behind (the object) another object is. So, in this case, you're testing the surface to see if there's another cave system x meters behind that pixel, and if not, making the surface (doesn't really matter, since there's nothing behind it in this case) a solid color.
     
  25. barker_s

    barker_s

    Joined:
    Jul 17, 2012
    Posts:
    29
    Thanks for the reply Jesus. While using dithering might be aestethically pleasing and might alleviate my problem to some extent, I think it would be much clearer for the player if I used full transparency in this case.

    As for the blend node - I haven't tried it yet, thank you for pointing it out. I don't know if that's what I'm looking for, but I'll read up on it and see if I can somehow make it work (I'm still basically a total noob when it comes to shaders).

    If you have any other advice, please let me know :) .

    BTW, I found what I was looking for in this thread - http://forum.unity3d.com/threads/simple-cross-section-shader.34508/ . Deciphering it and transtlating it to SF might take me some time.

    Edit:

    Okay, so I played a bit with Depth Blend and I don't think I'll be able to use it for my purposes (according to my limited knowledge, at least). I might not be able to use the shaders from the topic I linked to either, because my terrain is not a single enclosed mesh, but a series of chunks.

    My best idea so far is to have a big plane with a separate shader that would only render parts of said plane that are within the terrain. The problem is, I don't even know if it's even doable. Perhaps I could somehow retrieve the nearest vertex or quad and set the plane's transparency accordingly? Is any of it possible, or am I talking outta my butt?
     
    Last edited: Dec 31, 2015
  26. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    why PBL is broken in unity 5.3 ???? anyway to fix this?
     
  27. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Make sure you have the latest SF version, and then reopen your broken shaders in SF, and it should fix itself
     
  28. Ravrav

    Ravrav

    Joined:
    Aug 10, 2013
    Posts:
    5
    hello. does the rotater node work properly with normal maps? when I rotate a normal map the shading does not get updated and seems to get wrongfully rotated. here are some screenshots:

    1.png
    no rotation, the shading of the quad with the normal map to the right works correctly. the sphere to the left is just there for reference

    2.png
    180° rotation, the shading of the quad is not correct

    3.png
    no rotation here, but I rotated the quad mesh 180° to show that the normal map itself works correctly and how the second image should look like

    thanks in advance.
     
    Last edited: Jan 2, 2016
  29. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    It works, but not like you expect it to.
    The issue is that you're rotating the normal map in UV space, but the normal map data itself is still in tangent space, and the tangent space remains fixed. You need to rotate your normal vectors as well.
     
  30. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    i am interested in this too. how do you do that?
     
  31. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    sf_newshader_122016.png
     
    Cactus_on_Fire, hopeful and stationx like this.
  32. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    amazing! Never could have found this solution at this time of writing!
     
  33. Ravrav

    Ravrav

    Joined:
    Aug 10, 2013
    Posts:
    5
    cloud.gif

    works like a charm. thanks a lot!
     
  34. barker_s

    barker_s

    Joined:
    Jul 17, 2012
    Posts:
    29
    Ok, so instead of an all-shader approach I combined it with good old scripting and I'm generating a mesh on the fly to mask the resulting hole. It's still rough around the edges, but there's no noticeable performance impact, so I think I'll stick to this solution.



    This leaves me with one last problem. is there a way to have Opacity Clipped mesh that still casts shadows (even the transparent parts)?
     
  35. t2alra00

    t2alra00

    Joined:
    Jan 4, 2016
    Posts:
    1
    Hello! Have you already fixed this shader somehow, because I cant seem to get reflections to work properly with that code? I've been trying this for too long and in many separate ways..

    By using mirror reflection script, I have had the most accurate reflection on plane so far, but I don't understand how to produce those distortion and reflection properly?

    Does anyone have a clue how to do this?
     
  36. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey Ace,

    Any word on this problem (Locking billboard shaders to axis)? I have been looking for an answer on the forums for the last week and it looks like this is a problem for a lot of people. It seems like the only solution is the advanced foliage shader on the asset store, but I was hoping to use shader forge instead :)

    Cheers,
    Colton
     
  37. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Actually you may be able to do it with shader forge.

    If you model the tree so that all the (applicable) leaf planes are a vertical quad, with the UVs all being the same (black bottom left, red bottom right, yellow top right, then you can use the UV axis of U=0.5 to rotate around.

    You should be able to get their normal direction in worldspace (likely +Z if you're using LH coords), and compare it to the direction the camera is facing on the ZX plane (Y only rotation).

    You will then have to move the vertices around (U=0 for the ones on the left, U = 1 for the ones on the right) the vertical axis of U=0.5 (from above). You will need to trigonometry the S*** out of this, as well as adjust the normals (because otherwise the face normals will still be showing as +Z even though they're facing another way).

    That will get you vertical billboards easily enough. Beyond that you will need to remap and re-rotate, otherwise you'll have just one leaf texture that is always facing the same direction instead of pointing off in all different directions.
     
  38. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Thanks for the reply Jesus! Ill look into and post my findings :)
     
  39. games_lam

    games_lam

    Joined:
    Nov 2, 2015
    Posts:
    8
    Baldinoboy likes this.
  40. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
  41. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    Am I the only one who thinks that the sharpness of the specular highlights is not matching the sharpness of cubemaps at all with unitys pbr implementation? is there a way how I can add a fudge factor to JUST the specular without effecting the cubemap result with shader forge? ... I looked and couldn't find one :/



    my question from unity answers: http://answers.unity3d.com/questions/1122423/why-are-cubemaps-and-specular-highlights-not-equal.html I used the standard shader as an example there but the issue is just the same with all my shaderforge materials.
     
  42. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
  43. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    why the global fog script does not catch my shaders, maybe it is because they are alpha blended?? ._.
     
  44. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Probably.

    The global fog post effect lerps between what you usually see and the fog color based on the depth of the scene from the camera, that only catches the things that write to Z.

    What you can do is you can lerp in the shader between your (inputs for albedo, spec, etc and 0) and (0 and fog color) based on fog intensity (you may need to set the fog distance/density on a per-material basis here)

    Though, I think, if you set the fog on in the lighting inspector, it should add it to the transparent objects automagically, because it renders those in forward still (right?). The other thing to check is in each shader they should be set to receive fog under the blending panel.
     
  45. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Is there any way to get this blur shader to work as a Code inside SF ?



    Code (CSharp):
    1. Shader "Custom/Blur_Simple" {
    2.     Properties {
    3.         _Color ("Main Color", Color) = (1,1,1,1)
    4.         _BumpAmt  ("Distortion", Range (0,128)) = 10
    5.         _MainTex ("Tint Color (RGB)", 2D) = "white" {}
    6.         _BumpMap ("Normalmap", 2D) = "bump" {}
    7.         _Size ("Size", Range(0, 20)) = 1
    8.     }
    9.  
    10.     Category {
    11.  
    12.         // We must be transparent, so other objects are drawn before this one.
    13.         Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Opaque" }
    14.  
    15.  
    16.         SubShader {
    17.      
    18.             // Horizontal blur
    19.             GrabPass {                    
    20.                 Tags { "LightMode" = "Always" }
    21.             }
    22.             Pass {
    23.                 Tags { "LightMode" = "Always" }
    24.              
    25.                 CGPROGRAM
    26.                 #pragma vertex vert
    27.                 #pragma fragment frag
    28.                 #pragma fragmentoption ARB_precision_hint_fastest
    29.                 #include "UnityCG.cginc"
    30.              
    31.                 struct appdata_t {
    32.                     float4 vertex : POSITION;
    33.                     float2 texcoord: TEXCOORD0;
    34.                 };
    35.              
    36.                 struct v2f {
    37.                     float4 vertex : POSITION;
    38.                     float4 uvgrab : TEXCOORD0;
    39.                 };
    40.              
    41.                 v2f vert (appdata_t v) {
    42.                     v2f o;
    43.                     o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    44.                     #if UNITY_UV_STARTS_AT_TOP
    45.                     float scale = -1.0;
    46.                     #else
    47.                     float scale = 1.0;
    48.                     #endif
    49.                     o.uvgrab.xy = (float2(o.vertex.x, o.vertex.y*scale) + o.vertex.w) * 0.5;
    50.                     o.uvgrab.zw = o.vertex.zw;
    51.                     return o;
    52.                 }
    53.              
    54.                 sampler2D _GrabTexture;
    55.                 float4 _GrabTexture_TexelSize;
    56.                 float _Size;
    57.              
    58.                 half4 frag( v2f i ) : COLOR {
    59. //                  half4 col = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(i.uvgrab));
    60. //                  return col;
    61.                  
    62.                     half4 sum = half4(0,0,0,0);
    63.                     #define GRABPIXEL(weight,kernelx) tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(float4(i.uvgrab.x + _GrabTexture_TexelSize.x * kernelx*_Size, i.uvgrab.y, i.uvgrab.z, i.uvgrab.w))) * weight
    64.                     sum += GRABPIXEL(0.05, -4.0);
    65.                     sum += GRABPIXEL(0.09, -3.0);
    66.                     sum += GRABPIXEL(0.12, -2.0);
    67.                     sum += GRABPIXEL(0.15, -1.0);
    68.                     sum += GRABPIXEL(0.18,  0.0);
    69.                     sum += GRABPIXEL(0.15, +1.0);
    70.                     sum += GRABPIXEL(0.12, +2.0);
    71.                     sum += GRABPIXEL(0.09, +3.0);
    72.                     sum += GRABPIXEL(0.05, +4.0);
    73.                  
    74.                     return sum;
    75.                 }
    76.                 ENDCG
    77.             }
    78.             // Vertical blur
    79.             GrabPass {                        
    80.                 Tags { "LightMode" = "Always" }
    81.             }
    82.             Pass {
    83.                 Tags { "LightMode" = "Always" }
    84.              
    85.                 CGPROGRAM
    86.                 #pragma vertex vert
    87.                 #pragma fragment frag
    88.                 #pragma fragmentoption ARB_precision_hint_fastest
    89.                 #include "UnityCG.cginc"
    90.              
    91.                 struct appdata_t {
    92.                     float4 vertex : POSITION;
    93.                     float2 texcoord: TEXCOORD0;
    94.                 };
    95.              
    96.                 struct v2f {
    97.                     float4 vertex : POSITION;
    98.                     float4 uvgrab : TEXCOORD0;
    99.                 };
    100.              
    101.                 v2f vert (appdata_t v) {
    102.                     v2f o;
    103.                     o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    104.                     #if UNITY_UV_STARTS_AT_TOP
    105.                     float scale = -1.0;
    106.                     #else
    107.                     float scale = 1.0;
    108.                     #endif
    109.                     o.uvgrab.xy = (float2(o.vertex.x, o.vertex.y*scale) + o.vertex.w) * 0.5;
    110.                     o.uvgrab.zw = o.vertex.zw;
    111.                     return o;
    112.                 }
    113.              
    114.                 sampler2D _GrabTexture;
    115.                 float4 _GrabTexture_TexelSize;
    116.                 float _Size;
    117.              
    118.                 half4 frag( v2f i ) : COLOR {
    119. //                  half4 col = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(i.uvgrab));
    120. //                  return col;
    121.                  
    122.                     half4 sum = half4(0,0,0,0);
    123.                     #define GRABPIXEL(weight,kernely) tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(float4(i.uvgrab.x, i.uvgrab.y + _GrabTexture_TexelSize.y * kernely*_Size, i.uvgrab.z, i.uvgrab.w))) * weight
    124.                     //G(X) = (1/(sqrt(2*PI*deviation*deviation))) * exp(-(x*x / (2*deviation*deviation)))
    125.                  
    126.                     sum += GRABPIXEL(0.05, -4.0);
    127.                     sum += GRABPIXEL(0.09, -3.0);
    128.                     sum += GRABPIXEL(0.12, -2.0);
    129.                     sum += GRABPIXEL(0.15, -1.0);
    130.                     sum += GRABPIXEL(0.18,  0.0);
    131.                     sum += GRABPIXEL(0.15, +1.0);
    132.                     sum += GRABPIXEL(0.12, +2.0);
    133.                     sum += GRABPIXEL(0.09, +3.0);
    134.                     sum += GRABPIXEL(0.05, +4.0);
    135.                  
    136.                     return sum;
    137.                 }
    138.                 ENDCG
    139.             }
    140.          
    141.             // Distortion
    142.             GrabPass {                        
    143.                 Tags { "LightMode" = "Always" }
    144.             }
    145.             Pass {
    146.                 Tags { "LightMode" = "Always" }
    147.              
    148.                 CGPROGRAM
    149.                 #pragma vertex vert
    150.                 #pragma fragment frag
    151.                 #pragma fragmentoption ARB_precision_hint_fastest
    152.                 #include "UnityCG.cginc"
    153.              
    154.                 struct appdata_t {
    155.                     float4 vertex : POSITION;
    156.                     float2 texcoord: TEXCOORD0;
    157.                 };
    158.              
    159.                 struct v2f {
    160.                     float4 vertex : POSITION;
    161.                     float4 uvgrab : TEXCOORD0;
    162.                     float2 uvbump : TEXCOORD1;
    163.                     float2 uvmain : TEXCOORD2;
    164.                 };
    165.              
    166.                 float _BumpAmt;
    167.                 float4 _BumpMap_ST;
    168.                 float4 _MainTex_ST;
    169.              
    170.                 v2f vert (appdata_t v) {
    171.                     v2f o;
    172.                     o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
    173.                     #if UNITY_UV_STARTS_AT_TOP
    174.                     float scale = -1.0;
    175.                     #else
    176.                     float scale = 1.0;
    177.                     #endif
    178.                     o.uvgrab.xy = (float2(o.vertex.x, o.vertex.y*scale) + o.vertex.w) * 0.5;
    179.                     o.uvgrab.zw = o.vertex.zw;
    180.                     o.uvbump = TRANSFORM_TEX( v.texcoord, _BumpMap );
    181.                     o.uvmain = TRANSFORM_TEX( v.texcoord, _MainTex );
    182.                     return o;
    183.                 }
    184.              
    185.                 fixed4 _Color;
    186.                 sampler2D _GrabTexture;
    187.                 float4 _GrabTexture_TexelSize;
    188.                 sampler2D _BumpMap;
    189.                 sampler2D _MainTex;
    190.              
    191.                 half4 frag( v2f i ) : COLOR {
    192.                     // calculate perturbed coordinates
    193.                     half2 bump = UnpackNormal(tex2D( _BumpMap, i.uvbump )).rg; // we could optimize this by just reading the x  y without reconstructing the Z
    194.                     float2 offset = bump * _BumpAmt * _GrabTexture_TexelSize.xy;
    195.                     i.uvgrab.xy = offset * i.uvgrab.z + i.uvgrab.xy;
    196.                  
    197.                     half4 col = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(i.uvgrab));
    198.                     half4 tint = tex2D( _MainTex, i.uvmain ) * _Color;
    199.                  
    200.                     return col * tint;
    201.                 }
    202.                 ENDCG
    203.             }
    204.         }
    205.     }
    206. }
     
  46. Deleted User

    Deleted User

    Guest

    If anyone is interested, this is a script for apply the post-effect shaders on camera (I think that someone have searched this in a previous pages).

    P.S = Just to remind: this script also work with Shader Forge, but only with unlit/custom shaders and a Texture2D node with name "MainTex".
     

    Attached Files:

    Last edited by a moderator: Jan 7, 2016
    Jesus likes this.
  47. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Is there a known but in the current version of Shaderforge regarding PBL and Metal on iOS? We've noticed that gloss values above 0.95 result in a pitch black shadow being cast on part of the mesh facing away from the light source. This only happens with the Metal renderer (Not reproducable in OpenGL 2/3 or DirectX). The standard unity shader looks fine (in both the normal and specular variants look fine).

    Also, we've noticed that certain things (like plugging in a value into the specular ambient input) results in a pitch-black result on OpenGLES 3.1 renderers (Some Android devices use '3.1' when OpenGLES3 is selected). The Galaxy Edge uses 3.1, for example, and it is a fairly popular phone!

    Thanks :) I will try and get a repo of the 3.1 issue, but the PBL + Metal issue is really easy to reproduce - just create a PBL shader in shaderforge using the creation dialog and build to iOS. If you set the glossiness to something above 0.95 (Just set it to 1), you will see pitch black shading on the side facing away from your directional light. (You might need to enable shadows on your directional light? I am not in the office right now so I can't test if that was a requirement for the repo though I am pretty sure I had shadows enabled)
     
  48. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Cactus, that requires a second pass as an optimization step. I have got a SF blur up on the UAS though, but I was only able to go up to 5x5, but with a trick to make it effectively 10 times that (50x50 pixel blur). You have to plug in the texture size in the material though, so it knows how to do it.


    Radial blur, box blur, gauss blur, directional blur, zoom, etc (down the left side). PM me if you're interested, can give demo maybe.

    H92, sweet, will definitely use that. Out of interest, what does it spit out if you output depth, normals, etc to emission? does it give the right effect that you'd expect?

    Prodigga can you check if spec is remapped from 0-1 to 0-128 or something? It's in the lighting tab. Thats the only thing I can think of off the bat that might cause funny spec results near a value of 1. Also check any reflection probes, maybe.
     
  49. Deleted User

    Deleted User

    Guest

    Sorry, I didn't try it.
     
  50. Adam-Sowinski

    Adam-Sowinski

    Joined:
    Oct 25, 2013
    Posts:
    129
    Can't download v1.26 - when I click Open in Unity I can see only v1.25. There is no Upgrade button. I can only download v1.25. How to fix that?
     

    Attached Files: