Search Unity

Shader Forge - A visual, node-based shader editor

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

  1. aegget_

    aegget_

    Joined:
    Oct 30, 2012
    Posts:
    33

    Attached Files:

    Last edited: Feb 18, 2014
  2. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    A Flowmap node input (in the main input table) could be quite useful to plugin flowmaps and make flowmap shaders. There is probably a way to create a flowmap shader by using the flowmap texture and routing the different colour channels respectively to rotation, transform and resizing nodes and then combined into a multiply node to be plugged into the diffuse, normal emission etc inputs.

    I think an actual flowmap input could make things a lot easier, if it is possible though.

    I also think a forum of some kind where everyone can share and help people out with creating shaders could be quite helpful for an extensive plugin such as this one, especially for people that dont understand the mathematics and physics of lighting and shading yet.

    Thanks for an amazing plugin though, I just know its going to come in handy and I know I will get more comfortable with it eventually.
     
    Last edited: Feb 18, 2014
  3. Airborn-Studios

    Airborn-Studios

    Joined:
    Oct 31, 2012
    Posts:
    30
    Hey Joachim, is there a way to manipulate the way the model recieves shadows from the scene? i have a very flat custim shading with a very low shading contrastm but the shadow gets effected by this as well, it is very very faint, almost invisible, unless you move the shadowcaster.
     
  4. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    @XMachinaX:

    There's nothing hindering you from using the TextureAsset or Texture2D nodes to plug a flowmap into your shader graph. Actually that's what I've done over the last weekend to implement some fine smoke animation in my particle shader. Of cource you have to decide what to do with the flowmap inside the graph - so doing some math on texture coordinates is still required.
    Maybe you should clarify what it is that you 've got trouble with.
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The current noise node appears to just be the hashing function from a noise routine (such as perlin noise, etc). Perhaps it should be called random instead? Also, looking at the output I notice you are mixing rgba notation with xyzw notation:

    float2 node_53_skew = node_57.rg + 0.2127+node_57.rg.x*0.3713*node_57.rg.y;

    This is technically illegal HLSL and might cause an issue on some platforms (though seems to be fine on mine).
     
  6. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    @Marco Sperling: Thanks for the reply, I suspected as much. What I first want to figure out is what each colour channel in the flow map controls (do they control the specific UVs of the texture and what does each colour do respectively (rotation,panning, stretching etc.))? Also how can I connect these colour channels (or the entire texture) into panner and rotation nodes as to simulate the flowmap's particular flow.

    I have noticed that you cannot plug in a colour channel or texture into the input of the panner or rotation nodes only the output of the panner or rotation nodes can be plugged into a texture's UV thus giving the texture a very generic rotation or panning. Im wondering if Im perhaps supposed to use a mathematics or blending node on the flowmap texture or its colour channels as to get it into the a form that is acceptable for the input of the paner and rotation nodes.
     
  7. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Basically you can have two kind of flowmaps. One that defines the final state of where a pixel should end up. Or one that defines the actual movement vector.
    The red channel of the flowmap usually controls the U coordinate (final state/offset). The green channel is responsible for the V coordinate (again, final state or the offset).
    This means that you can store two flowmaps insde a 4-channel texture.

    After you've decided what kind of flowmap you want (maybe the flowmap authoring process decides this for you) to employ you are left with basically two options inside the graph:
    For the first kind of flowmap you want to lerp between original UV coordinates and the final state.
    For the second kind of flowmap you usually add the difference on top of the original UV coordinates.

    Of course with a flowmap of type A you can calculate the difference on the fly and just use an add instruction as well. No need to lerp.

    This is the basic theory. There's still some more stuff to do under the hood - it all boils down to what you want to achieve with the flowmap.
    Make sure to set your flowmap to clamp, Automatic Truecolor or something else uncompressed and bypass srgb sampling as a flowmap acts as some kind of lookup texture and should be as "uncompressed/unaltered" as possible to avoid artifacts.

    So in the end you do not need the panner node. Simply use a component mask to grab the RG or BA channels of your flowmap and use this vector2 for the math.
    When you're done with the math stick the resulting vector2 into the UV input of the Texture2D that you want to distort. Done.
     
    Last edited: Feb 18, 2014
  8. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Hey there, I'm running into an issue when trying to generate a multi-texture material for a wood floor. I know it would be easier to use a single texture for this, but unfortunately I'm trying to emulate something done by a co-worker, and this is the best idea I can come up with.

    $sf_multi-colored_wood_floor_2182014.png

    Issue 1: The three normal maps you're seeing in there are regular normal maps (I've included a smaller version of one below), but for some reason when I try to use them as normal maps in SF they turn blue and red like that; I checked, they are set as normal maps in Unity, so that's not it... I'm pretty sure that this is the cause of my second issue as well.

    Issue 2: If you look at the render of the shader, the map has no bump mapping from the normals. It's shiny like that so that the flatness of it stands out. Like I said, I'm pretty sure this is the result of my first issue.

    Issue 3: My last issue stems from the Channel Blend. For some reason, I cannot apply a texture to the alpha channel. If you look at both of the channel blends, it's grayed out. The Floor RGB material is set for Alpha from Grayscale. I'm sure I'm missing something simple, so, any guidance would be appreciated, I need the alpha channel for the last color of wood, it's not loaded as a texture right now because I couldn't get it to work, but I do have a fourth wood color I need to incorporate.

    One last thing, not sure if it's related to this or to my textures, but the textures comes in really dark, and doesn't seem to accept light evenly...

    Thank for any help!

    Here's the normal map example, I know it's crappy, the full res one is much better :p
    $Wood floor RGB.png


    Also, completely unrelated to this, but I've been trying to make some emmisive shaders that actually emit light... I haven't had any success with that yet though, any chance you could put up an example image on how you accomplish that?
     
    Last edited: Feb 18, 2014
  9. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    If your normal maps shift colors that much and result in unexpected shading you might have forgotten to mark them as normal maps inside your Unity project. Find the normal map asset in there and check the rollout that says "Texture". Change it to "Normal map" and make sure to check off the "create from greyscale" checkbox if your normal maps are true normal maps (not just greyscale bump maps).

    Edit: forget what I said about the first part. You already made sure this was not an issue. But double check the "create from greyscale" thing.

    Better to wait for Ace to reply to your question.
     
    Last edited: Feb 19, 2014
  10. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Sorry - I'm late to the party. I just bought ShaderForge as well and I absolutely love it.
    I really wish this makes Joachim Holmér a fortune and maybe even gets integrated into Unity (along with ProBuilder). This is such a huge leap forward for Unity's usability. Love it. :)


    Just a quick and really simple question to start out: are there Shader Graph examples for the basic standard materials for shader noobs to look at and analyze?
     
  11. SOULS STUDIOS

    SOULS STUDIOS

    Joined:
    Jan 20, 2013
    Posts:
    3
    HI Mister Acegikmo! Thank you So much for this awsome no other alike tool.

    About Features : I would like to ask if and when would be possible in a future version to Implement custom material properties with SHaderforge, for us to have color separators custom sliders, checboxes , txt notes and foldouts, in the shader interface, so we can organize shaders better and have shaders look like ALLOY and HUESHIFT and others products... as this is becoming quite a popular feature in high end shaders, i think would be good for us to have it also in shaderforge.I think is a major feature. Hope is possible in next versions soon. Thanks so much.



     
  12. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    As far as I understand, those are properties of script-supported shaders using custom editors, and you can't do anything like that by modifying a shader file itself. I doubt that generating external UI code is within the scope of Shader Forge.
     
  13. SOULS STUDIOS

    SOULS STUDIOS

    Joined:
    Jan 20, 2013
    Posts:
    3
    Only the Developer can Say it if its possible and when.

    There is Just need a .cs library with the Methods And call them in the shadercode .

    You got here a Working Example back in March 15, 2013 From unity Blog If you want to test the methods:
    http://blogs.unity3d.com/2013/03/15/4-1-graphics-features/

    You also got here The reference in unitY manual: https://docs.unity3d.com/Documentation/Components/SL-CustomMaterialEditors.html

    In the rest Having the .cs Simple Code for Custom properties this is Called in SHaderCode.

    I trully Believe it is Within the scope of SHaderforge to Support This Features.
    And i also believe is not that dificult, Shaderforge already uses a custom Inspector in its shaders.

    Best Regards.
     
  14. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Hello again. After experimenting with this some more this morning (read: starting from scratch :p) I have gotten it to work: My normal maps had some issue, so I deleted them and brought them in to Unity again and they worked fine. I guess they're blue like that because it's compressing a really large image down to a really small thumbnail.

    $sf_multi-texture_wood_floor_2192014.png

    It's a bit more complicated than I was expecting. I would have preferred for Channel blend to work, but whenever I tried to use it the final product was always too bright, not reflecting the proper colors of the floors. There was also the issue of getting the alpha channel to work. If I made the black portions of the Floor RGB image white and used them as the alpha (not alpha from greyscale, which was resulting in problems because of the colored portions), whenever I tried to separate out the R,G B channels, they would always include the white portions as well; so instead, I opted for that subtraction sequence you're seeing.

    All in all, it works like what I was wanting. I'd like to find a way to accentuate the plank edges a little bit more, but the core idea is there, so I can improve on it later. Below is an image from in-game.

    $Wood Floor.PNG
     
    Last edited: Feb 19, 2014
  15. WFTO_JWong

    WFTO_JWong

    Joined:
    Feb 4, 2013
    Posts:
    7
    $JuggLP.jpg
    Allowed me to tweak spec/gloss/cube settings to perfection to get this LP model looking quite dapper at any distance!

    $GoldPile02.gif
    Alpha Cutout, Reflection, Spec/Gloss, Animated Twinkles - all in one shader!?!? you bet!

    Thanks so much for SF, Joachim you are the best
     
    Last edited: Feb 19, 2014
  16. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    I want you SF graph right now !! :D
    Pleaase !
     
  17. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156

    Thanks so much for all the advice Marco, this will definately help me out.

    I will try both flowmap types and see which one will suit my liquid spell effect the best.
    I might try some vertex offset animations as well to really have the spere look more like
    liquid.

    Again thanks for all the help and advice.
     
  18. anadin

    anadin

    Joined:
    Oct 28, 2005
    Posts:
    98
    Yup, really want to see that :)
     
  19. Ga2Z

    Ga2Z

    Joined:
    Feb 16, 2012
    Posts:
    68
    WOW man, such awesome!!

    I quote it to bring the awesomeness to the current page ;)
     
  20. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    @WFTO_JWong
    I am really interested about the animated twinkles effect. Did you use some code ? or only shader ?
    Maybe you could give us a clue ! :D
     
  21. WFTO_JWong

    WFTO_JWong

    Joined:
    Feb 4, 2013
    Posts:
    7
    No code there, shader only :) The combined might of ShaderForge + Math! /raises fist for dramatic emphasis/

    I can't/shouldn't hand out WFTO assets just yet (but probably after a month, when 100% of our shaders are SF shaders, and the full-game is released, I can even pack up WFTO's shader forge shaders and pass along to all of you)

    You can see a good number of nice new Shader Forge shaders in-game and in action at http://store.steampowered.com/app/230190/ (shameless plug)

    But, I can most definitely give you that 'clue' you asked for.

    I was first led to this idea from the image on Acegikmo's page : http://www.acegikmo.com/shaderforge/images/web/screenshots/sf_ss_mainpage_a.jpg
    From looking at that, I came upon that fancy new 'Rotator" node that appeared in the latest SF update.
    If you want pulse/speed variation, you can either Remap with Sin and Time, or for triangular wave. . . Remap with Frac and Time.
    You can go with a Noise (as long as there are some solid black parts (for the twinkle to be 'off'), and the gradient isn't too fine/sandy, but I'd suggest you go with a simple gradient, like the classic white cylinder over black bg, and give that a 'spin' ;) -- iykwim
     
    Last edited: Feb 20, 2014
  22. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Fantastic ! :D

    Thank you very much for the clue. ;)
     
  23. mandydark2

    mandydark2

    Joined:
    Aug 13, 2012
    Posts:
    17
    Hello friend, again as always here and happy for your new updates.

    This time I want to ask if there is any node that is assimilated Shader Forge to DephtBiasAlpha UDK in the update 0.23 which is what I have, if there any, would you show me an example how to use it?

    The other thing is curious is that if I have a Render Texture, texture nodes from Shader Forge are not allow me to use it, however from the Unity editor itself I can use it! (I'm trying to create somehow a real time reflection).

    Moreover, when I try to use the Parallax node without using any node connected to the Normal channel, causes an error in the Shader Forge, which does not occur in UDK using Bump Offset, why is it necessary to have connected a normal map for the Parallax node work?

    Thank you
     
  24. Cynicat

    Cynicat

    Joined:
    Jun 12, 2013
    Posts:
    290
    I assume its becuase udk makes an assumption about what is plugged into the node if it has nothing connected. its prolly the same as if you had fed it 0.5 or something. however as SF is still if development it isnt fully set up to make those assumptions. i'm sure it will get this stuff later on but for now just do what you need to do anyway and plug something in. however i am curious of when reflection support will be added. i really could use it... alot... =3
     
  25. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Hello again, back with another issue >_>

    I recently created a shader that allows you to rotate the uv's to any given degree. As I was switching between the basic Bumped Diffuse shader and the custom SF shader, I noticed that the texture got significantly darker. Has anyone else noticed this issue, and does anyone have a fix?

    Here's the shader:
    $sf_rotatable_bump_diffused_2202014.png

    Here's the material with the default Bumped Diffuse:
    $Shader Forge issue - Dark Textures.PNG

    Here's the same material with my SF Shader
    $Shader Forge issue - Dark Textures - SF.PNG

    I'm pretty sure I'm having the same issue with the floor I posted earlier, so a fix would be great. Thank you!

    EDIT: It appears that checking "Double Incoming Light" solves this issue, though I'm not sure if that's the correct way of fixing it. Also, I noticed that I need to attach my rotated UV's to the normal... so.. yeah, that's fixed.
     
    Last edited: Feb 20, 2014
  26. Cynicat

    Cynicat

    Joined:
    Jun 12, 2013
    Posts:
    290
    if your using PBL then the problem is your lighting. go to the player settings and change the lighting method(i think thats what its called) to linear. if not then you might just want to click the double incoming light option. or multiply your diffuse by a property named brightness.
     
  27. mandydark2

    mandydark2

    Joined:
    Aug 13, 2012
    Posts:
    17
    sure, I've created a vector3 and them set the blue value to 1. The parallax node works fine using this setup.
     
  28. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Oh, yikes, looks like I've missed a page here, sorry about that!
    I'm glad you guys are responding each other, I've been a bit busy these last few days :)

    Let me know if you feel one of your questions have gone unanswered!

    Also, nice work on things so far, makes me happy to see your shaders in action :D
     
  29. mandydark2

    mandydark2

    Joined:
    Aug 13, 2012
    Posts:
    17
    Reviewing the subject, I found that the texture node Shader Forge allows only 2D textures, and is why you can not connect a Render Texture. The standard Unity shader allows use textures from any source.
    Any particular reason for not using textures in Shader Forge and limit it to only use 2d textures?
     
  30. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    You can use RTs in SF shaders with the regular Texture2D nodes, but you can't assign them in the node view itself (It's a bug). You can assign them in the material view though :)
     
  31. Cronos000

    Cronos000

    Joined:
    Nov 27, 2012
    Posts:
    3
    Hey is there any way to get _Projector and_ProjectorClip into Shader forge as variables?
    I am trying to make a decal and would prefer not to hand code it.
    Thanks
     
  32. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
  33. mandydark2

    mandydark2

    Joined:
    Aug 13, 2012
    Posts:
    17
    ejej ok thanks. hope you fix the bug soon!
     
  34. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    I agree, that'd be pretty cool. In the meantime though, if you're looking for something free with that functionality, I've been using this: Neo Texture Edit. I'm quite fond of it, but it'd be great to see SF develop that kind of ability. Number flow does look significantly more complex and advanced, but that comes with a price tag as well :p So far there have been very few textures I haven't been able to make using Neo Tex.
     
  35. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Do you have a link to some info on these? Are they built-in Unity variables?

    Edit: Found one, nevermind :) Seems a bit advanced to pipe this into the existing system though, but it might work
     
    Last edited: Feb 20, 2014
  36. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Hey there Acegikmo, since your back I thought I might ask again, is there any chance you could go over how you achieved the effects in that short video you did where the spheres are emitting light? I'm needing to achieve a similar effect for a light cove, and can't get it to work. Is that something limited to Pro?
     
  37. WFTO_JWong

    WFTO_JWong

    Joined:
    Feb 4, 2013
    Posts:
    7
    He'd answered this one before (forget which page of this thread) : they were Point Lights stuck inside of spheres
     
  38. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    This is a pretty good idea.
     
  39. Deathnote

    Deathnote

    Joined:
    Nov 26, 2013
    Posts:
    52
    Who create amazing water ?
     
  40. Powdered_sugar

    Powdered_sugar

    Joined:
    Aug 23, 2012
    Posts:
    64
    Oh T_T Dang, I thought that'd be really cool to be able to do. Oh well. Thanks for the info.
     
  41. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    2 quick questions:

    1) How can i (or, if it's not possible, can you add this please?) organise node order for display in the material inspector? I'm writing a ubber shader for offline use to be able to quickly prototype things that is probably going to have 50+ properties, i definately want to group them by functional area.

    2) How can i unconnect a connection without deleting nodes on either side? (say i have node A input connected to node B output, how i remove the connection without replacing it with another connection / deleting either nodes if i just want to go back to having the input empty)?
     
  42. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Oh and another thing that is most likely very very very quick to fix. you're using unix line endings everywhere (shader opens like crap in Notepad). Could you instead use environment.newline to make line endings compatible to the current system?
     
  43. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,140
    1. You can reorganise the material inspector by reordering the nodes in the properties tab:



    2. You can disconnect nodes by either alt-right-clicking on the connection tab, or by alt-right-clicking and dragging across multiple connections to sever multiple lines.
     
  44. AlteredPlanets

    AlteredPlanets

    Joined:
    Aug 12, 2013
    Posts:
    455
    Hello,

    anyone know if its possible to create a wet shader effect?
     
  45. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,140
    Like... wet pavement, or wet clothes, or something like this? There's a lot of directions this could go, so you'll have to be a bit more specific.

    edit: Here's a better demo
     
    Last edited: Feb 23, 2014
  46. marggob

    marggob

    Joined:
    Feb 24, 2013
    Posts:
    65
    Can the author to make a node for kubmap similar node "Texture Asset"? It would have eliminated the need to do two slots for kubmap if you want to do "Ambiente diffuse" and "specular Ambiente".
    $2.png
     
  47. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I'm just getting started with shader forge. How would I accomplish something like the this? I started by using vertex colors, but now i'm not sure. I need to be able to change the color of parts of the geometry over time based on some variable. Thanks.
     

    Attached Files:

  48. WFTO_JWong

    WFTO_JWong

    Joined:
    Feb 4, 2013
    Posts:
    7
    You mean like slime?
    Something with a wetness that is moving downward?


    Here's a slimy downward membrane type thing I did not long ago
    $Heart_Slime.gif
     
    Last edited: Feb 23, 2014
  49. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hi WFTO_JWong, I've sent you a pm. Care to answer it?

    @wet surface:
    Do you want your wet surface to be procedurally created? -> probably more instructions inside the shader and some solid math skills required
    Or can you live with manually authored "flow directions"? -> more time spent creating the asset but the extra amount of data inside the asset will probably not consume as many GPU instructions - though a larger memory footprint might appear..
     
  50. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    To get the effect of a wet surface, you usually want high glossiness (0.8-1.0) and possibly a specular cubemap as well.

    @topofsteel: Which parts do you want to modify, based on what parameter, and in what way?