Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Shader Forge - A visual, node-based shader editor

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

  1. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    @Martin_H - I actually just tried that but it doesn't work right. I need accurate world space coordinates that do not change depending on view angle. The goal is to extract the Y value and use it to control an underwater fog value.
     
  2. milaoshu

    milaoshu

    Joined:
    Sep 9, 2016
    Posts:
    1
    There are 2 kinds of Ambient Source in the Unity's scene lighting mod: color, witch is only a single color, and Gradient, witch have 3 colors.I've made some shaders with SF,when i use single color as ambient source, it performs perfect,but when i turn the ambient source to gradient, only sky color of the 3 colors will affect the objects using shaders made by SF ,any way to fix this?
     
  3. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
    Shaderforge_preview_error_remapUV.png

    Been bringing the Utility Shaders to Unity 5.5, good fun to get back into it. Hundreds of shaders, brought all the way from as far back as 4.1. But, found a problem with the SF preview. All 3 remap nodes are mapping the UV coords from 0-1 to -1 to 2 (yes, I know there's scale math problems, I didn't need to subtract the 1), but see how the simple node gets it right but the adv nodes show it as scaled too small? (see the blue circled nodes on the right)

    I plugged all 3 into the UV slot for a texture and they all look right (the same) and correct when viewed. Just this is a mild panic when I'm looking at nodes and my brain's telling me uv_math.dll is encountering a problem.
     
  4. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    317
    thanks for the help!! :)
     
  5. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,202
    Get Errors with Shaderforge shaders on Unity 5.5.0f3:

    "Invalid subscript 'boxMax' at line 135 (on d3d11)"
     
  6. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    181
    Hey Joachim,
    Just an FYI it seems that double sided shaders render inside out on PS4 with Unity 5.5.0p1.
    Cheers,
    Colton
     
  7. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
    Utility Shaders are coming to Unity 5.5!

    Each firework explosion, including the smoke, is a single unmoving, unscaling particle. This is the normal quality setting - 3 colours.
    5 types shown (red, green, cream) (red white blue) (gold yellow white) (pink blue cyan) (pink green gold) fireworks_normal_720.png

    Using Unity default sky, and the New PostProcessing Stack. Deferred, HDR, etc, 1.6km view distance.

    EDIT: Obviously made with shader forge. dx9, dx11 compatible.
     
  8. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    570
    Working on order independant stochastic transparency. It creates translucent objects that light diffuses inside like actual volumetric subsurface scattering. The cloud is just 50 quads stacked on top of each other that uses default cutout alpha clipping so it's incredibly cheap, although the camera uses color accumulation to multisample the frames. The clouds don't use normalmaps, the shadow shading is created by the actual volume. And since it's all order independant, you can add any other transparent or opaque objects in there without having to worry about sorting.

     
  9. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
  10. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,742
    Has anyone got a billboard shader working on multi-sprite textures?

    Its easy to flip the UV, but it inverts the whole texture while the sprite slices take place at the same UV coordinates so it looks like mayhem.
     
  11. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    570
    Here's the video version of it.

     
    yusefkerr and Malbers like this.
  12. Artaani

    Artaani

    Joined:
    Aug 5, 2012
    Posts:
    419
    Hello.
    I am considering to buy this tool and I have a couple of questions:

    1. How much control available for "Noise Node"? It have only one Perlin Noise algorithm, or several different algorithms? Can I control the next parameters?
    - Frequency
    - Octaves
    - XYZ Offset
    - Persistence
    - Lacunarity

    2. Is there a "Grayscale to Normal map" node?

    I am working on GPU procedural generated full scale planets and I need somehow to turn my procedural generated height map into normal map to achieve relief mountains like on the image below.



    But if it is possible to generate entire noise using this tool, it would be even better!

    Thanks.
     
  13. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    109
    Lightmaps and Mix Mode Direct Lights Broken (Unity 5.5)
    It appears that lightmaped surfaces are receiving double light from the "Mixed" Directional light.

    We are making this game:
    https://www.oculus.com/experiences/rift/809977902464604/

    Can I get a conformation that this is indeed a bug in Unity 5.5???

    Anyone willing to fix my shader so that I can continue development?

    Thanks,
    Super Ultra Hyper!

    Steps to Reproduce:

    1) Create a new scene.

    2) Set the Directional Light to "Mixed"

    3) Create a Plane and mark as static

    4) Create a Box and mark as static

    5) Create a Sphere and position it such that it casts shadows on the plane and box.

    6) Create a new Shader.

    6B)Assign a Color to the Diffuse

    7)Create a material and assign to all game objects.

    8)Bake Lighting
     

    Attached Files:

    Last edited: Dec 15, 2016
  14. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    119
    I created an effect for my player character in Shader Forge, and now I'm trying to transfer over some effects from my original shader. One of them is a sprite occlusion system that uses the stencil buffer, based on this example: http://blog.prime31.com/using-the-stencil-buffer-for-sprite-occlusion/

    Here's my current Blending menu:



    With these settings, the shader successfully renders only the pixels that aren't occluded by my other object... but it throws out the rest.

    Is there any way to use the pixels that are "thrown out" by the stencil comparison (i.e. turn them black for the silhouette effect)? Can I just create a second pass with a second stencil comparison like in the example linked above?
     
  15. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    wip_38.jpg @Martin_H - The technique worked, it was just my implementation of it, and my not quite understanding the depth blend node correctly. Finally got it working, so now I have accurate world space info from the depth blend node. I have now setup a light penetration function that mimics the way that light wavelengths fall off underwater, ie - Red first, then Green, then Blue. My ocean shader is coming along nicely now
     
  16. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,187
    That looks awesome! Good job and thanks for sharing!
     
  17. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Well thanks for the info! Worked like a charm!
     
    antoripa and Martin_H like this.
  18. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
    Quick update to the creature generator - it can now generate hybrid pattern types.

    From the (bottom base pattern), it can adjust for sharp corner edges, circular edge loops, wavy stripes and radial stripes.

    I'll have to get some more pictures up, but with its scaling and aspect controls for base, noise and distortion it can replicate zebras, cheetahs, tigers, hyenas, and pandas. As well as, presumably, house cats and those koi goldfish things.

    If you're interested in seeing more (I won't spam too much here, and nothing that isn't SF-made) would it be OK if in the future I link to a creature creator with ANSEL so people can try out the shader? And as always, likes and shares for the project page would be most appreciated (clicky)

    wolf_patterntest_A5.png
     
  19. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    Are you going to update to the new shaders for 5.5?
     
  20. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
    Since everyone seemed to like the fireworks, I'll post some more.

    Only 4 types this time - and this is the 'low quality' shader, 3 colours, but removed the smoke normalmap, combined some of the adjustments (into tail strength, which is now 1 instead of 2 parameters), and cut a bunch of operations from scaling, speed, etc while retaining what I think is 90% of the quality.

    And don't worry, the RGB firework in the top right makes my eyes hurt too. As does the red/orange/yellow one in the top right. Blue/Purple/Silver looks good, and the orange/lime/sandy one is OK too.

    fireworks_low_4types.png

    Using Unity default sky, and the New PostProcessing Stack. Deferred, HDR, etc, 1.6km view distance.
    Obviously made with shader forge. dx9, dx11 compatible.

    I'm having trouble coming up with colour combinations though, if you have any ideas for 2-3-4 colour sets, let me know what you'd like to see. I can also change trail colour to be different from flare colour on the HIGH and ULTRA shaders.

    Some preview of the High fireworks. Because the trail colour is adjustable independently, you can get better shades of flares as the compounds burn off; notice especially the primary colours (red, greens, blues) fireworks_high_coloredtails.png
    :
     
    Last edited: Dec 19, 2016
  21. jvetulani

    jvetulani

    Joined:
    Dec 20, 2016
    Posts:
    43
    Hi!

    We had to move to Unity 5.5 at work, and Shader Forge stopped working. From what I can read the issue has been fixed in Shader Forge 1.30, but we're stuck at 1.28 and 1.30 won't download from the Asset store. Tried removing the downloaded packages from the Unity folder, but no matter what I do Unity always downloads the 1.28 version....... Is this some sort of licensing matter? Additionally when I import a 1.28 shader made on Unity 5.4 to 5.5 I get errors about a lack of vertex shader?
     
  22. RussellFincher

    RussellFincher

    Joined:
    Sep 30, 2012
    Posts:
    57
    Trying to do something fairly simple but it's not working out. Hoping someone can spot my problem. I'm creating a post effect that will tweak the individual color channels of the Scene Colors.

    Here it separates them, creating a UV coordinate of a gradient texture that should replace each pixel with a new value. All I'm getting is a white screen, though:

     
  23. RussellFincher

    RussellFincher

    Joined:
    Sep 30, 2012
    Posts:
    57
    Seems like my biggest problem is that I'm not getting what I expected out of Scene Color. Replacing it with a Texture2D and putting a screengrab in that node shows me that it's basically doing what I expected, just not inputting the scene like I expected.
     
  24. Team-Beachbum

    Team-Beachbum

    Joined:
    Mar 20, 2013
    Posts:
    6
    I'm having "boxMax" issues too after upgrading to 5.5.0p3. Did this actually work for you? It didn't work for me and I still have magenta objects. I've posted it on Shader Forge forums too. In fact, if I fire up Shader Forge, make a PBR(lit) shader from the template and don't modify it, it's still magenta with the boxMax issue.
     
  25. joeconstable97

    joeconstable97

    Joined:
    Jul 30, 2013
    Posts:
    33
    Maybe this isn't the right place to ask this but I'm kinda desperate at this point.

    Basically I'm trying (and failing) to achieve two separate effects.

    First I guess some context is needed, I'm creating a skybox shader that uses cubemaps for the day sky, night sky, etc.

    What I want is for the day sky cubemap to follow the Light Dir on the Y axis, as well as giving the user the ability to offset the night sky on all axis.

    I've figured out that I would use the DIR property to do this but that's as far as I've got.

    Any help would be appreciated.
     
  26. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    109
    @Anyone that can help:
    We are making Ultrawings for Rift (UltrawingsGame) and want to release at the end of the month.
    However Unity 5.5 breaks our water shader.

    The issues is detailed here:
    http://shaderforge.userecho.com/topics/1272-lightmaps-and-mix-mode-direct-lights-broken-unity-55/

    Attached is the shader. Does anyone know how to fix this?


    @iiTZJOEY
    He said it was fixed in this thread / version 1.31
    http://shaderforge.userecho.com/topics/1270-unity-55-and-the-patch-breaks-reflection-probe-support/
     

    Attached Files:

  27. joeconstable97

    joeconstable97

    Joined:
    Jul 30, 2013
    Posts:
    33
    Don't think you meant to tag me in that given I didn't say anything about reflection probes in my question.
     
  28. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Hello i have an error from Shaderforge. I have my build settings set to Android and when i try and create a shader i get this error, infact even if i try and open one of the example shaders.

    Shader error in 'Shader Forge/Examples/Refraction': invalid subscript 'boxMax' at line 119 (on d3d11)

    Compiling Vertex program with DIRECTIONAL
    Platform defines: UNITY_NO_SCREENSPACE_SHADOWS UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA


    Not sure what this means and wondering if some one could help out..

    Cheers

    Daniel
     
  29. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    109
    Yeah... Whoops... I meant to tag @Team-Beachbum. Its that issue that is fixed.
     
    Last edited: Jan 3, 2017
  30. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    317
    we got new update in 2017, i haven't tried it on unity 5.5 yet, but unity 5.6 shaders after compile totally not appearing at all!
    in previous version it have similar issue as 5.5, now it's not showing up. and this after trying recompile my previous shaders.. new ones showing up fine!
     
  31. KhenaB

    KhenaB

    Joined:
    Aug 21, 2014
    Posts:
    273
    Hey,

    Made a shader that needs to function even when timescale is at 0, using a panner node with time, in Unity there is Time.unscaledTime, is there a way to do it in shaderforge?

    Thanks
     
  32. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,187
    A workaround would be just feeding in the Time.unscaledTime as a float value with a script each frame.
     
    KhenaB likes this.
  33. KhenaB

    KhenaB

    Joined:
    Aug 21, 2014
    Posts:
    273
    How exactly do i send values to Shaderforge?
     
  34. KhenaB

    KhenaB

    Joined:
    Aug 21, 2014
    Posts:
    273
    Well i figured it out, for anyone who's wondering,

    I added a Value node and called it UnscalledTime, replaced the Time node with it.

    Made a script and added it to my UI Image with the shader:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class UnscaledTime : MonoBehaviour
    5. {
    6.     public Image image;
    7.  
    8.     void Update ()
    9.     {
    10.         image.material.SetFloat("_UnscaledTime", Time.unscaledTime);
    11.     }
    12. }
     
    Last edited: Jan 4, 2017
    Martin_H likes this.
  35. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    131
    I'm trying to make a color replacement shader that replaces one color in a texture with another based on a lookup texture.

    I've got a simple setup working in the SF nodes, but whenever I attach this to the Diffuse slot on the Main node I only get the original texture without the color replacement.

    In the attached image, you can see that SF previews the gray square in the MainTex node changed to blue in the LookupTex node and in the Multiply node (this is what I want). But then when that's attached to Diffuse, the preview sphere renders the original MainTex with gray, not blue, and multiplied by the Color property (which I've tinted blue, just to show that the Color property IS making a contribution, but that none of the other nodes other than MainTex are).

    I think I'm missing something obvious here, but am stumped.

    Thanks!

    ColorSwapBasicLit.png
     
  36. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,455
    Hi there,
    Not sure whether this is related but I'm having trouble getting a lot of things to work with shader forge in 5.5. It's actually unusable :(
    Here's a basic example -

    Shouldn't that shader be red? Also emission and spec seem to be broken...
    Not sure what's going on there but I hope it's something simple breaking things.
    P.
     
  37. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
    There was an update to SF recently that changed (I think) some things with Unity 5.5, are you guys using that version or an older version?
     
  38. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,455
    Yeah that's the version I'm on (1.31).
     
  39. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Made some more progress on my ocean shader. Now just have to work on the shore line effect . . . Shader Forge is awesome!
    wip_39.jpg
     
    antoripa, ftejada, Valak and 5 others like this.
  40. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    131
    @Jesus Yep, I'm on v1.31 in Unity 5.5 too.
     
  41. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    131
  42. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,455
    Ahh yes that sounds good!
     
    Last edited: Jan 6, 2017
  43. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Annnnd, finally got the shore effect working correctly. I think I'm done with this ocean shader for now, on to the next thinggy ...
     
    junaid109, antoripa, yohami and 6 others like this.
  44. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    7,239
    Do you plan on selling this? Because it's a pretty fantastic looking ocean shader.
     
  45. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,455
    Man that's awesome! I wanna swim there! :)
     
  46. SwitchXS

    SwitchXS

    Joined:
    Jan 8, 2017
    Posts:
    1
    I have an issue using Shader Forge with atlased 2D sprites (Sprite renderer)

    I have created a shader that uses the UV co-ordinates to drive the Vertex Offset of my sprite. The UVs are used as a black to white gradient that masks my Vertex Offset animation. The vertex animation gives a 'blowing in the wind' effect used on vegetation sprites, where the base is not affected, and the top is.

    On a normal sprite derived from a single texture this works great, and works as expected, but when I apply it to a sprite from a multiple sprite atlas it does not work. I think I know why, it's because the UV co-ordinates creating my gradient are being derived from the whole sprite atlas, and not from the individual sprite I am using from it. So, if my individual sprite is near the top of my sprite atlas, it'll be covered by the white area of my gradient and affects all verts, and if it's a sprite at the bottom of my atlas it'll be covered by the black area of the gradient and nothing happens.

    Now, I can potentially solve it by manually adjusting the gradient so it starts and ends in the right place, but then it'll be a manual setup per sprite which is not efficient.

    Does anyone know a way around this? How can I apply a gradient mask local to each sprite on my atlas within Shader Forge?

    Regards
    Switch

    Edit - just noticed someone has experienced the same issue and posted on the feedback center - https://shaderforge.userecho.com/to...with-multiple-texturessprites-using-an-atlas/
     
    Last edited: Jan 8, 2017
  47. HenriqueGomez

    HenriqueGomez

    Joined:
    Dec 13, 2012
    Posts:
    69
    Guys, how can I create a outline shader in deferred rendering? :(
     
  48. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    @ Murgilod
    Ehhh, probably not. I wouldn't mind selling it but there is a lot that goes into making an asset robust enough for general use. My shader works great in my scene, but it might not perform well in other peoples setups. Plus trying to make sure it runs good on mobile, plus every other combination of setups anyone could be using turns into a huge pain.
     
    Martin_H likes this.
  49. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    488
    I think the one thing that blindsides most ocean shader developers that put their stuff on the asset store is people asking for buoyancy support. There's oceans that have it and look 'meh' and there's oceans that don't and look fantastic, but very rarely will you see one that does both.
     
    Martin_H and Fishypants like this.
  50. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,250
    Do you have Shader Forge and are you running into some kind of problem? Because if I remember correctly, a basic outline function was one of the easiest things to add to a shader.
     
    Martin_H likes this.
unityunity