Search Unity

Shader Forge - A visual, node-based shader editor

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

  1. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Try this: http://acegikmo.com/shaderforge/faq/?Q=erroronnewversion#erroronnewversion
     
  2. EricColossal

    EricColossal

    Joined:
    Sep 7, 2013
    Posts:
    6
    That worked, thank you! Sorry for not checking the FAQ first
     
  3. Yamo

    Yamo

    Joined:
    Nov 18, 2012
    Posts:
    18
    Can anyone point me towards a simple terrain shader with normals example? All I can seem to find are splat map shaders that lack normals :(
     
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,139
    Will the dithering happen in screen space or world space? Like, will I be able to have a dither that always appears pixelated as it faces the camera or will I still need to do some screen coord stuff like I'm doing now?
     
  5. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    The wealth of shaders the more regular posters in this thread are creating is actually remarkable and if anyone feels like selling anything, they definitely should! I'd be happy to buy a lot of the work, and i'm convinced many others would too, and should it need more exposure, i think Shader Forge would enjoy its name popping up in the asset store on such a regular basis. I love making things with it and i especially love being able to take something and easly make an ton of variations depending on needs easily, which is something i dont really enjoy the freedom of with the more traditional 'lump of impregnable code' format shaders from the asset store usually take to me, and i do not have the time on top of everything else i have on the plate to reach my own answers with it a lot of the time, especially when i'm not entirely sure what I want aside from 'novel'

    So yes, definitely a call to some of the ability in here, i'd not really automatically expect your efforts to appear on the wiki (although i think some of the subjects in more red hued colours could do with filling in), but would definitely like to see, if nothing else, some of the shaders at work in here or a section of the wiki even under the heading 'Inspiration'
     
    IFL and Acegikmo like this.
  6. The-Rizzler

    The-Rizzler

    Joined:
    Nov 20, 2012
    Posts:
    19
    I'm ultra new to shaders let alone shaderforge, and i'm trying to make literally the most simple Diffuse/Normal/Transparent shader that works with light probes, but the normals aren't displaying (they do in unlit mode though)
    I'm sure I'm completely missing something here
    I have a non shader forge 'bumped probe' shader that supports normal maps and light probes but it doesn't have transparency support
    Any help?

    edit: On a side note, where do you go to learn shader stuff? Looking back through the thread there's some seriously impressive work, I never realised how powerful shaders could be
     
    Last edited: Jan 4, 2015
    IFL likes this.
  7. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Screen space, so, it's simply a checkbox when you're using alpha clip :)

    Not sure what could go wrong. Did you mark the texture as a normal map in the texture inspector?
     
  8. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    @Acegikmo - Can you take a look at context menu positioning on nodes when zoomed? Kind of annoying for commenting, but not a big deal.
     
  9. The-Rizzler

    The-Rizzler

    Joined:
    Nov 20, 2012
    Posts:
    19
    It was marked as a normal map yeah
    I might not have explained myself properly - here's two planes both with the shader i'm trying to use
    The left one is marked static and has been lightmapped, the right one is non-static and is using light probes
    The shader has lightmap and light probe support ticked, here's the settings - it seems to display fine in the preview
    Is there a way to get the light probed one to show its normals like the static one?

    Edit: A point light reveals the normals on the right one, so they must be working in some way
     
  10. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    It sounds like your Probes might be the problem. Do other light-probed, diffuse-only objects receive light at the same location as the planes?


    Does anyone know why this shader has the distance measuring differently for geometry that is closer to the camera? Trying to do distance stuff in screen-space... I know that I have to be overlooking something.
    SF_SSPointProblem01.jpg
    SF_SSPointProblem02.jpg

    [EDIT::] The above graph works perfectly for an orthographic camera, but still not working for the perspective camera. Not sure if that's good news...
     
    Last edited: Jan 6, 2015
  11. Deleted User

    Deleted User

    Guest

    @Acegikmo

    If i connect a texture node to a switch node and light color, this is the result when texture is enabled (however i'm work in custom light mode).

    It's a very annoying bug :(

     
  12. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    I suspect this is because you think custom lighting is working in a way it doesn't. Custom lighting is run multiple times, once for every light source affecting it, and then renders additively on top, which might cause things to be overblown like this.
     
  13. Deleted User

    Deleted User

    Guest

    No problem with light if i connect only texture to custom light, this problem occur only with switch
     
  14. Deleted User

    Deleted User

    Guest

    The evolution of Glow+ is completed, a bunch of new features are included (fur for example) :D :D :D

     
    Last edited by a moderator: Jan 6, 2015
  15. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,139
    Could you use an offset instead of that vector4? Because I THINK this does what you want? I'm not sure what you're going for though:



     
  16. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Thanks, but I had to have the Vector4 for world positioning. Your way is the usual way to do it though. I came up with another route. It's not as perfect, but it works. I really appreciate you trying to help with it though - hopefully your graph helps someone out. ;)

    This is the result:
    SF_woah_it_worked.jpg
    (who wants flat portals when you could have spherical ones?)

    EDIT:: Should I have just passed the offset into the shader as a parameter calculated from script....? Guh.

    EDIT2:: The Unity5 frame debugger is really handy for figuring out what is happening in the pipeline. Awesome tool...
    output_73cvtP.gif
     
    Last edited: Jan 7, 2015
    Superflat and Gekigengar like this.
  17. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Hi.
    Are they able to include shader made in shader forge in an asset of Assetstore and sell it?
     
  18. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Yes, there are several already available on the Asset Store.
     
  19. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Thanks!
     
  20. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,139
    Oh that is swanky. Is it all rendertexture based or are you slapping some sort of stencil stuff in there after building it?
     
  21. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    It's just render textures. The hard part, aside from transforms, was figuring out how to set up the render order to have forward/deferred mixed with transparency. It's fun stuff though.
     
  22. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I've had a lovely time today setting up some of the (but not nearly all) base shaders for my new thing, shader forge is just the kind of thing that's making this stuff very exciting - i'm prepared to live without it for now, but one shader i was moving over used the MainTex_TexelSize and the neighbour uv functions supplied by Unity for doing a very attractive texture smooth which went well with quantization - i dont think this would go in Shaderforge as it lacks a vertex shader stage at the very least, but i was wondering if there was a way of blurring a texture that wasn't horrendously slow, given i can't use ddx or ddy because of the target platform. I was looking at iq's bilateral filtering on shadertoy/his site but my mind wouldn't make the bits match up, am i barking up the wrong tree?
     
  23. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    With 1.0.3, is it possible to simulate the Unity5 b18 standard shader?
    As a start I would need only white diffuse + EnvironmentLighting + Realtime GI.
     
  24. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Did you try the Mip level input on Texture2d Nodes?

    EDIT:: What are your target platform(s)?
     
    Last edited: Jan 7, 2015
  25. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    from what i can remember of shader warnings, mipmap use is quite limited and im not sure how much shaderforge accounts for it, on web trawling, mipmap generation seems quite a hands-on thing, but it cant hurt to look (if for future benefit although i think functionality in more suitable areas will develop in time) - target platform is webgl/ogles 2.0 (i'm not exactly targeting low end devices though)

    I've just had the thought that the messages were from NPOT textures, i'll look there next the next day
     
    Last edited: Jan 7, 2015
  26. JohnyK

    JohnyK

    Joined:
    Jun 13, 2014
    Posts:
    13
    Hello guys!
    I am new to Shader Forge and Shaders in general so I would like some guidance to create a shader that simulates the parts of an animal cell:
    http://www.turbosquid.com/FullPreview/Index.cfm/ID/514082

    I am interested in the following parts:
    nucleus, centriole, lysosomes, endoplasmic reticulum, mitochondrion.

    Is it possible to do in Shader Forge? Any help would be appreciated!

    Thanks in advance:)
     
  27. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Yeah, we can't use tex2dlod if targeting GL ES2. In the mobile comic shaders that I've posted in this thread, I had to make a copy of the textures I was using and set the resolution to that of the mip level I wanted. In the tests I did, it was a slight hit to the fill rate, but not near as bad as blurring. If you have substance designer, you can even filter the image for clarity during resizing at load-time to make the package smaller.

    Are you wanting the shader to calculate the innards of the cell or just the surfaces?
     
  28. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    My poking about in shadertoy had me thinking about the ingenuity at show and if you have some decent hardware and rendertextures in your license then you can probably get a lot of inspiration over there for procedural animation and shading that might be great for your cell stuff - That's quite heavy on cycles and brain application though even for the well initiated and unity shader talk generally gravitates to more game-ready and texture-based representations - i think IFLs mention of Substances could be astute here though - with again, enough application and time, strong Substances and their combining in various fashions could give you a lot of options for replicating the appearance you seek?

    IFL, thanks for the Substance reminder, but i think they're a no go for realtime changes in webgl atm, a pity because its a technology i'm extremely enthusiastic about getting stuck into - i do however think the suggestion of simply pre-blurring the image for when i want that particular effect might be an acceptable quick fix for now. I'm hoping for a time where i have a bit more freedom though, the more options when it comes to manipulating NPR effects the better when i'm really appreciating the novelty of having an enormous pallette of shaders themselves (no comment on shaderforge, i think im more in mind of webgl 2)
     
  29. JohnyK

    JohnyK

    Joined:
    Jun 13, 2014
    Posts:
    13
    Hey IFL,
    I just want to recreate the cell surfaces to give the same look and feel :)
     
  30. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    Hi, I've been playing around with shader forge trying to think of ways to create a decent volumetric based lighting/fog effect mixture. I'm aware it will probably be a fairly performance intensive thing, but can anyone have a good idea where to start and what hurdles to watch out for?

    My current idea is basically to create an alpha to make a material transparent, then apply this material to a mesh and use a mesh rendering particle system for the fog, however I've seen both on the asset store and in different programs volumetric shapes, however I don't know where I would even start to learn about creating one from scratch.

    I've kinda tried messing with things in shader forge, like depth, but I'm not exactly sure how those nodes should be used... In anycase! If anyone has a good tutorial for making one, or has made one and could explain a node tree that would be awesome! Also if anyone has a place I can read up on how volumetric objects/lighting work that would be cool too.
     
    Last edited: Jan 8, 2015
  31. wangzy_88

    wangzy_88

    Joined:
    Sep 12, 2012
    Posts:
    14
    How to invert the input and output field direction?
    I like beta version's layout.
     

    Attached Files:

    • now.png
      now.png
      File size:
      34.7 KB
      Views:
      1,013
    • want.png
      want.png
      File size:
      30 KB
      Views:
      1,063
  32. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    You can't. I switched it to make it go in the same direction as pretty much *every* other node editor out there. The sole reason I had it reversed before is because Unreal Engine 3 had it that way, but they too have now switched :)
    While I could add an option for it, I'd rather not, for consistency in screenshots and tutorials in the future, and because the coordinate system is a bit wonky.
     
  33. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Is there any way to recreate the high pass effect within shader forge ? You can offset the textures and blend them to get it, but I need it to work with screenspace like and actual 2D post effect and not on texture UVs.

     
  34. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I would like to know about this too.
     
  35. Deleted User

    Deleted User

    Guest

    @Acegikmo

    Ok...maybe i have asked the question in the wrong way...so...can i deactivate light color node with switch?
     
  36. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    The shader alone can be created with Shaderforge - since you have access to a a code node you could also pass in your convolution matrix by hand I guess.
    But the other part of creating a post process is actually creating the associated scripts that you attach to your camera.
    Either that or you do it the hacky wonky way by placing a plane mesh in front of your camera that kind of acts as a see-through window into your scene. This window would get the material with the post effect shader applied.
     
    Last edited: Jan 8, 2015
  37. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Using Unity 5 and SF 1.0 or later - Just enable PBL, turn on light probes and turn on lightmapping, then connect diffuse
     
  38. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    For the outer surface, it looks like you need a combination of a cubemap, fresnel, noise (for normals and spec), and a color. Does the following surface look somewhat similar to what you're wanting for the outer cell?
    SF_JohnyK_01.jpg

    What platforms are you targeting, and are you using Unity4 or Unity5? I'll post the node graph if this is what you want. Otherwise, tell me what needs to change.

    It looks like the inner pieces use a very similar shader to the outside, just with varying colors. The fluid of the cell has a more complicated depth-blur though.
     
  39. JohnyK

    JohnyK

    Joined:
    Jun 13, 2014
    Posts:
    13

    I am using unity5 pro beta 18 version. I could switch to Unity4 if this is a problem for the construction of the shaders:)
    I am targeting the windows/mac standalone.

    This surface is very close to my goal!
    Any graphs would be much appreciated!

    Thanks.
     
  40. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    v5b18 hasn't been an issue with Shader Forge for me (aside from deferred). Let me know if anything about this graph doesn't make sense to you. Keep in mind that there are hundreds of ways to do what you're wanting. :)

    SF_JohnyK_02.jpg
     
    JohnyK likes this.
  41. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    I know it's not directed at me, but a switch plugged into custom lighting using a setup that includes LightColor and/or texture2Ds works fine for me. If you don't do any extra shading, the light colors (without attenuation) add together and white-out the result. If you're already doing everything right, you could show your node graph so that I can look at the code to see what's going wrong. Although, I don't want to intrude if it's for a commercial asset. ;)
     
    Deleted User likes this.
  42. Deleted User

    Deleted User

    Guest

    No problem:

    First pic with only texture enabled from a switch



    Second pic with desaturate, light color and multiply enabled (all regular) from a switch



    And third pic with texture node directly connected to custom light, and all work fine also with point light enabled...so maybe switch doesn't work well in certain conditions?



    However thanks for help :D
     
    Last edited by a moderator: Jan 8, 2015
    IFL likes this.
  43. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Can you try to connect a LightAtten node to the multiply so that the multiply has desaturate, Light color, and Light atten connected? If that doesn't improve it, I'll get back to you tomorrow.
     
    Deleted User likes this.
  44. Deleted User

    Deleted User

    Guest

    Mhh...nothing has changed :/

     
    IFL likes this.
  45. JohnyK

    JohnyK

    Joined:
    Jun 13, 2014
    Posts:
    13

    thanks a lot for your help!!

    I will use it and tweak your graph for my needs :)

    Any ideas about what should i do if i wanted to be more translucent ?
     
  46. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    Thanks for trying that. I'm away from my computer, but I'll get back to you tomorrow whether I find out anything or not.

    If you want the center transparent, plug the color's A and the Fresnel's output into a Max node before plugging that into the Alpha on the main node. If you want an equal transparency, just plug the color's A into the Alpha. Either way, make sure you set the blending to Alpha Blended.
     
  47. JohnyK

    JohnyK

    Joined:
    Jun 13, 2014
    Posts:
    13

    I try to recreate the node tree but I am not sure what I am doing wrong here...

    Using the Unity4.6.1
    shader forge 1.02
     

    Attached Files:

  48. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    I'm trying to control alpha based on distance from camera. I just can't seem to get it to work, currently using this pattern posted earlier in this thread.

    camera_fade.jpg
     
  49. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    That should work, although you'll want a one-minus node in there as well.
    It's also assuming alpha blending is on. Which blending mode are you using?
    If it's additive, it should be multiplied with emission, with the one minus node.
    If it's multiplicative, it should be screened, using the blend node, with emission, without the one minus node.
    Also, you might want to replace that subtract node with the depth node; it's essentially the same setup :)
     
  50. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Sorry - I can´t achieve it. Here´s some screenshots of my setup. There´s no lightprobe or reflection probe in the scene.
    The left sphere has my Shaderforge-Shader.
    It does not recieve any light reflected from the wall behind it while the standard shader sphere does.
    In the objects lighting window we can see its realtime intensity map. It seems as this one is not being used at all?
    The shader also reacts much different to the skybox tint:
     
    Last edited: Jan 9, 2015