Search Unity

[Best Tool Asset Store Award] Amplify Shader Editor - Node-based Shader Creation Tool

Discussion in 'Assets and Asset Store' started by Amplify_Ricardo, Sep 13, 2016.

  1. m-i-e-c-z

    m-i-e-c-z

    Joined:
    Nov 10, 2010
    Posts:
    26
    Hi guys!

    I'm trying to create a shader that doesn't use mesh normals. So it's something like unlit shader but with shadows, light colors and attenuation. I'm a bit stuck though. My goal is to achieve something like this:


    or Kenucky Route Zero. If you have any suggestions, please share.

    Cheers!
     
  2. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    That's a nice art style.

    I'm doing something a little similar in my game. I don't have all the answers, I hope this is useful.

    First of all, you'll need custom lighting stuff to do this "properly" I think. ASE's lighting stuff is seemingly very much in-development and I don't really know how to use the little that exists.

    But maybe you don't need it. Lets talk about fake lights.

    Unity has great general purpose lights. They're fast and easy to set up and you can have a lot of them. They don't give you a lot of fine control, though. You can't, for example, change the falloff of a point light, or make a light with more than one color, or directly control the color of shadows. For specific, unusual lights like the ones in this trailer you can sometimes do better setting up your own.

    Doing lights like this has some obvious disadvantages.
    -You can't (easily) tap into the (mediocre) built-in shadows.
    -You can only have a fixed number of lights illuminating any given material, and you have to roll your own system for passing their positions and colors into the materials that need them. If you have one point light and one directional light in your entire world like this video that's not too bad, if you're a big open world crafting game where people can place their own light sources or whatever... good luck. (There's been discussion of adding support for arrays as shader inputs, which would make this vastly, incredibly easier.)

    The advantage is that you can pretty much do any weird thing you can imagine, including some very useful tricks like sampling light colors from a texture.

    There's two sorts of lights in that trailer. The more novel one is a non-shadowcasting point light that seems to be ignoring normals entirely and just making things brighter near it. You can do this from a given point pretty easily. Something like this:

    upload_2017-5-14_13-28-44.png

    The directional light isn't quite ignoring normals entirely, it's just lighting them either entirely or not at all based on their angle to the light, instead of lighting them gradually based on it. (There might actually be 3 levels on the light in the video.) It's a whole lot like basic toon/ramp shading, and that might actually be a good approach, especially if you want to use built-in shadows. I am not sure how to do this in ASE currently, but it's the simplest thing in the world in concept, check out the Toon Ramp shader here: https://docs.unity3d.com/Manual/SL-SurfaceShaderLightingExamples.html

    A fake version (without shadows) is also pretty simple:

    upload_2017-5-14_14-13-31.png

    It's possible to do your own shadows too, but it's more work. Unity creates shadow maps by rendering a depth texture from the point of view of the shadowcasting light, and then getting rid of the light on surfaces farther from the light than the closest surface. https://docs.unity3d.com/2017.1/Documentation/Manual/Shadows.html is a more detailed explanation. Anyway, you can do the same thing with normal cameras and rendertextures. I'm pretty sure that's how this guy's doing his custom shadows:https://www.assetstore.unity3d.com/en/#!/content/67730 I don't currently have a working example in ASE, maybe someday soon.

    With the light nodes it's probably possible to get some of the best of both worlds. I don't know, this is as far as I've gotten. You'll have to do some of your own experiments.
     
  3. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    405
    Unfortunately Tessellation is incompatible with some node operations/options and you may have stumbled into one of them.
    Is it possible for you to share your shader with us so we can see what is happening?
     
  4. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    374
    we have a bunch of generated meshes. they are stiching together. but they dont have any generated uv, normals, tangents. when i try to texture this ,esh, i see mess. triplanar help me to texture it but only diffuse. normal maps sre incorrect on mesh. so i tried to use diffuse+hight map to make it more realistic look. but tesselating meshes is a pain for performance. now im trying to decrease tess factor but i need to compensate it by normal mapping and i cant. this shader cannot work properly on generated meshes. i asked our programmers about tangents/normals/uvs, they say no, they dont generate any of this.
    and now im trying to solve my problem: make a good looking ground with generated mesh by custom shader with generated normals/tangents inside shader.
     
  5. m-i-e-c-z

    m-i-e-c-z

    Joined:
    Nov 10, 2010
    Posts:
    26
    Thanks a lot brisingre. I've managed to achieve this result in another shader editor, but Unity's build in shadows have some problems (they look weird on round objects) - I will most probably fix it with the "toon ramp" approach. Thanks again!
     
    brisingre likes this.
  6. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    791
    First off let me just say that ASE has become one of the most important tools on my belt. As an avid Shader Forge user I could quickly see how ASE outshines it on many fronts. Porting shaders from SF to ASE started to become a requirement as they stopped working with certain aspects of 5.5 and 5.6, so kudos!

    I'm in the process of porting my SF foliage shaders to ASE for various reasons. However, I'm stuck on a single aspects. I'd like to be able to set the normals in Object-space, specifically float3(0,1,0). Rather than Tangent-space.

    In Shader Forge this was possible by setting the "Normal Space" to "Object". I cannot replicate this in ASE, is it a limitation of surface shaders?

    Below is a comparison, an elementary shader with a clip mask and a Vector3(0,1,0) piped into the Normal output.

    This greatly affects the appearance of the objects. Does anyone know which kind of operation is needed to achieve Object-space normals?
     
  7. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    The normal output is already in object space by default, so when you put a float3(0,1,0) it will override the LOCAL value of the normal, since this local value is dependent of the object rotation, it will change when you rotate the object. Looking at your images it seems that you actually want it using the global normal float3(0,1,0). Correctly if I'm wrong but don't you just want all of the grass normals pointing up?

    If yes you can simply transform the your global value float3(0,1,0) into a local since the output only accepts local values. Like this:
    grassup.PNG
     
  8. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    791
    Thank you for the clarification! I completely missed the "Local Vertex Normal" output. Piping in the (0,1,0) vector shows the desired result.
     
    hopeful likes this.
  9. renardmf

    renardmf

    Joined:
    Jun 29, 2012
    Posts:
    46
    Yes, I thought that might be the case but this issue seems to be happening when I create a new shader and just check the tessellation box. The other shader I am making is just trying to use the layer blend option as I mentioned before in an earlier post.
     
  10. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Ironically I'm now running into this same sort of thing. I'm translating over a shader from Shader Forge, and I'm getting the same errors you were, I think for the same reasons. I've attached a pair of screenshots that show the errors in question. One shows what I'm doing in ASE, versus what I did (that works) in Shader Forge. The other shows the error that I'm getting.

    In my case, even when moving to Transparent Cutout as the mode, I'm getting the error. I've tried plugging things into the Opacity and Opacity Clip nodes, but nothing seems to help. I'm going to keep messing around with it, and will post if I figure anything out.
     

    Attached Files:

  11. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Well, that turned out to be easy. Here's the code "fix" (though I don't know what else it might break), as well as the resulting shader that I've got. Note that the material has to set it to the Geometry Queue, because doing that in the shader doesn't work for some reason. Either way I get the results I want here -- it's processing a cutout shader on the geometry layer, and able to use GPU Instancing properly with that.
     

    Attached Files:

  12. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    141
    If i create my Textures with substance designer that is also node based, is it possible to get another performance and quality boost with amplify shader?
     
  13. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    I've tried a bunch of different settings with tessellation in 5.4 and 5.6 and I can't seem to replicate the issue, could you share with us a broken shader?

    Yep, it's confirmed, there were some cases it was missing setting some stuff, expect a fix in the upcoming versions. For now, if it's urgent, you can simply use the blend mode dropdown once to set those stuff to bypass the issue.

    It doesn't necessarily work that, not even with substance designer. Designer creates textures, ASE creates shaders, any boost you might have from using them comes from some clever usage of those textures or those shaders, not from the software itself. Just to give you an example, you might want to use designer to pack some information in different channels to save space (you could also do it in photoshop I guess) and then create a shader with ASE that reads that custom data textures, thus saving some performance. That small extra performance could then be used to make a cool effect in the object. The purpose of ASE is to be an artist friendly tool to create cool effects, in order to save on performance you need some knowledge about the rendering system.
     
  14. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    123
    The Substance engine in the end will just generate a texture, the only benefit of using substances at runtime is the ability to randomly regenerate the textures, and the lower file size. But in the end the GPU(or ASE) will only use the generated textures, it doesn't know anything about the generating process(AFAIK the substance engine only works on the CPU in Unity).
     
  15. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    To my knowledge, by a lot of measures substances are actually thus slower (on the first draw). I tend to prefer to have it create the substance materials at load and then discard the original when using substances (there's a setting for that).
     
  16. Neo-Gamefactory

    Neo-Gamefactory

    Joined:
    Oct 18, 2012
    Posts:
    141
    Okay, thank you :) First time i used my own shaders ;)
     
  17. FerryvD

    FerryvD

    Joined:
    Sep 9, 2016
    Posts:
    25
    I want to create clear glass with refraction, i know it can be easily done with the refraction input, but i don't want the chromatic chromatic aberration effect.
    Can it be done in a different way? i found the refract node but have no idea how to use it (and if it is of any use for me)
    [edit]
    Never mind, i missed the slider
     
    Last edited: May 17, 2017
  18. FerryvD

    FerryvD

    Joined:
    Sep 9, 2016
    Posts:
    25
    Ok, i got the Refraction all setup the way i want it. But now i run into another problem.
    My shader has to be able to fade away.
    To achieve this result i used the Grab Screen Color Node and via some Lerp Nodes applied this to the Emissive channel.
    This works perfectly fine, until i plug in the refraction node.
    Instead of fading everything away it turns to black.

    Is this a bug in ASE? or should i set this up in a different way.
    Below is a screenshot of my setup so far: ASE.jpg
     
  19. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,172
    @Amplify_RnD_Rick Do you know if this is possible with Amplify?


    We were attempting to do a diorama of a beach with water that is cross-sectioned into a cube. The important part is to have a top surface that is water with waves while also having the water on the sides viewable.
     
  20. renardmf

    renardmf

    Joined:
    Jun 29, 2012
    Posts:
    46

    Attached is a new shader I created that I just enabled Tessellation on and it gives me shader errors.

    Let me know if you need anything else.

    Thanks!
     

    Attached Files:

  21. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    All of a sudden, I'm unable to open Amplify Shader Editor. When I try, it opens a blank window which can't be closed or resized, and I get spammed constantly with the following error in the console:

    NullReferenceException: Object reference not set to an instance of an object
    AmplifyShaderEditor.AmplifyShaderEditorWindow.OnGUI () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:3710)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    This happens to several people on the team, but not all. Our character artist can open it without problems, and I can on my machine at home, but not in the office. I've tried reimporting ASE, moving it to the Assets folder (we place most Asset Store tools in a subfolder named 3rdParty), and completely removing it from the project and reimporting from the asset package.

    We're using v0.7.2.005.
     
  22. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    405
    Do you have your blend mode set to Translucent? From the shot you posted this we aren't able to confirm this.
    If you do already have Translucent set, is it possible for you to share the shader file with us ( support@amplify.pt ) so we can do some tests on it?

    You can take a look at our Water sample as we do something similar to what the video is showing.
    Although on the reference you posted, two different shaders are being applied, one with only a simple refraction effect for the cross section and another one with refraction and animated waves on the top.
    Both of these are achievable with ASE.

    This is quite odd. The shader you sent does not have any kind issues when opened both on Unity 5.4, 5.5 or 5.6.
    The error shown on this one is similar to the one sent earlier?
    What Unity version and platform are you using?

    Thank you for reporting this issue.
    The log info you shared is not completely clear since it is pointing to a reference that in normal circumstances is always valid. We think the issue might be somewhere else.
    Can you give us any additional info on what triggered this on your project?
    Importing ASE into a new project within these machines and on the same Unity version triggers this issue?
    Also, is it possible for you to share a small project with us ( support@amplify.pt ) so we can replicate this on our end?
    We tried several tests but unfortunately everything is ok.
     
    Last edited: May 18, 2017
  23. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    I created two tutorials for creating water with ASE. They are heavily based on the example that comes with ASE.

    Overview


    Detailed implementation
     
    jc_lvngstn, inoj, KRGraphics and 4 others like this.
  24. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    Thanks for the quick response. I've done it again to get some more error information. I've hidden it in spoiler tags so people not interested don't have to look at it.

    ReflectionTypeLoadException: The classes in the module cannot be loaded.
    System.Reflection.Assembly.GetTypes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/Assembly.cs:371)
    AmplifyShaderEditor.GraphContextMenu.<RefreshNodes>m__0 (System.Reflection.Assembly type) (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs:81)
    System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[System.Reflection.Assembly,System.Type].MoveNext ()
    AmplifyShaderEditor.GraphContextMenu.RefreshNodes (AmplifyShaderEditor.ParentGraph currentGraph) (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs:82)
    AmplifyShaderEditor.GraphContextMenu..ctor (AmplifyShaderEditor.ParentGraph currentGraph) (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs:38)
    AmplifyShaderEditor.AmplifyShaderEditorWindow.OnEnable () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:364)
    UnityEditor.EditorWindow:GetWindow(Type)
    AmplifyShaderEditor.AmplifyShaderEditorWindow:OpenWindow() (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:317)
    AmplifyShaderEditor.AmplifyShaderEditorWindow:OpenMainShaderGraph() (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:248)

    NullReferenceException: Object reference not set to an instance of an object
    AmplifyShaderEditor.AmplifyShaderEditorWindow.OnGUI () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:3710)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    NullReferenceException: Object reference not set to an instance of an object
    AmplifyShaderEditor.AmplifyShaderEditorWindow.OnLostFocus () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:2631)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:262)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
    UnityEditor.HostView.OnLostFocus () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:111)

    NullReferenceException: Object reference not set to an instance of an object
    AmplifyShaderEditor.AmplifyShaderEditorWindow.OnLostFocus () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:2631)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:262)
    UnityEditor.HostView.DeregisterSelectedPane (Boolean clearActualView) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:325)
    UnityEditor.HostView.set_actualView (UnityEditor.EditorWindow value) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:32)
    UnityEditor.DockArea.OnDestroy () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:84)
    UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

    NullReferenceException: Object reference not set to an instance of an object
    AmplifyShaderEditor.AmplifyShaderEditorWindow.Destroy () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:625)
    AmplifyShaderEditor.AmplifyShaderEditorWindow.OnDestroy () (at Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:4217)
    UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

    I tried in a new project a few days ago, and it was fine, so I'm not sure what is in our project to cause the issue (especially since it's fine on some machines but not others). Our project is pretty large, so hopefully you can get something out of the above logs. If not, I'll see if I can replicate the issue in a small project.
     
  25. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Try resetting your window layout on your project, then opening it again. It's also possible that something else isn't compiling properly in there. The reflector isn't able to load the types from what I'm assuming is your main editor dll, and that's a compilation error, not a runtime thing (not even "in the editor runtime.").
     
  26. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    405
    Thank you for the console output. We've sent a PM to you asking some additional info to help us pinpoint this one.
    As soon as we figure out what is happening we'll report it here.

    Also, we've just uploaded a new build into our website.

    Here are the release notes:
    Release Notes v0.7.2 dev 06:
    • New features:
      • Added 'HSV To RGB' and 'RGB To HSV' nodes
    • Improvements:
      • Custom Expression' node with a return instruction on its Code text area generates a function with the code contents thus enabling multiple instructions lines on its body
        • Added small info text on node properties to explain its behavior
        • Added new name field ( can also be edited directly on node by double clicking on it ) which is used to name the generated function/ local variable
      • Small refactoring on some classes for consistency and warning removal from Visual Studio
    • Fixes:
      • Fixed issue on some changes not being correctly caught on setting Blend Render Type
      • Fixed issue with Unlit Light model doubling the value set on the Emission output port
      • Small fix on title updates when using Shader Functions
      • Removed warning from unused legacy source code on 'Register Local Var' and 'Get Local Var' nodes
      • Fixed issues on incorrect casts on 'Texture Sampler' node
      • Fixed issues on incorrectly snapping wires into hidden ports
    Happy shader creations and have an awesome weekend!
     
    Last edited: May 19, 2017
    Pecek, brisingre and petersx like this.
  27. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    This is a very pleasant surprise! I've integrated the HSV functions into my shaders in place of my custom stuff, and I'm happy to report that it works great and is waaay more convenient than what I was doing before. I haven't experimented with the custom expression nodes just yet, but those are also very exciting to have now.

    Thanks for all your hard work!
     
    Amplify_RnD_Rick likes this.
  28. Mr_Albert

    Mr_Albert

    Joined:
    Apr 28, 2017
    Posts:
    23
    Hello Guys!

    Sorry for my stupid questions: "whit parallax i lose the shadow projection whit point light, its normal? "

    thanks
     
  29. darkmajki

    darkmajki

    Joined:
    Mar 6, 2013
    Posts:
    1
    I am interested in getting this asset, but i want to ask you how easy would it be to create a terrain shader? I am total newbie when it comes to shaders so that's why I am asking. I am trying to fix the terrain tilling issue(of course among that also create shaders for other stuff) on a already textured terrain, and as I was looking around shader forge(even with the udk tips on how to fix tilling) i don't think i will be able to fix it easily.
     
  30. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    I love how easily it is to create shaders...

    @Amplify_RnD_Rick Here is the video about Paragon and how they use their detail maps for their characters. I need to test my detail shader to work with this, and if successful, I will add roughness and AO to the detail maps, provided I don't run out of interpolators....

    I will also tackle grass and foliage shaders too. And hair.

     
    Amplify_RnD_Rick likes this.
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    I might make on like this, and have a switch that will allow me to have high and low quality
     
  32. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    As I am working on updating my shaders, I am wondering if it is possible to add a feature for dropdown lists. Such as I want to have properties in my eye shader for things like eye colour... is this currently possible?
     
  33. ferlodeveloper

    ferlodeveloper

    Joined:
    Jan 21, 2013
    Posts:
    15
    Hi,
    One question, how it would be the right method to add shadows with textures?
    i have a layer of a texture with shadow and strength, how can i add to albedo result? with blend(darken), add?

    Thanks so much
     
  34. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    123
    I would simply use a multiply node(unless you have colored shadows).
     
  35. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    51
    Anyone know how to animate random vertex from mask area in mesh?


    Ok, i know how. Thanks :)
     
    Last edited: May 22, 2017
  36. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    I don't think so. One thing I'd like is the ability do do a hard "if block." Basically "if this condition is met, then do a whole bunch of nodes that might be expensive," but if the condition is false then skip all that other stuff.

    Right now the if/else is pretty limited in that it doesn't really handle entire blocks of many nodes. But if it did, then a lot of what you're going for could be handled with checkboxes or via an integer slider.
     
  37. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    123
    Still not done yet, but it's pretty close now I think. Shaders made in ASE of course, with a tiny bit of manual editing(tangents and the distant terrain shader can't be changed from editor)
    <Link to imgur gallery>
    This was my wisest purchase ever, I learned so much in the last 4 weeks. ASE is amazing. [sorry, I know this is fairly unprofessional but I had to say it out loud]
     
  38. KillerNads

    KillerNads

    Joined:
    Jan 22, 2017
    Posts:
    70
    Hey Guys,

    New to Unity here, building a VR game. Im really struggling to find an asset on the unity store that will give me a window with blur and water/rain drops animating on it. Please see the screenshots attached.

    Do you think if i was to purchase Amplify i would be able to create something like this?

    window with rain 2.png
    window with rain.jpg
     
  39. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Looks like all you need to do is in general set it to be a transparent shader using refraction, and then set two normal maps. One normal map is static and is the bumps of stuff that doesn't move. Then put in another normal map that you animate on the v axis using a time node at the speed you want, with the stuff going down.

    If you want to get fancy, add in a slight sine wave movement to it, and/or a slight sideways drift in general.

    Use the two normal maps additively (add node, not multiply) in the normal channel, and you should get some pretty interesting results. There's no texturing going on there, it's just refraction with a moving normal map.

    If what I've describe is too simplistic for what you have in mind, then just keep adding more normal maps and animating them and adding them together. Past a few normal maps that are animated that way, it will be near impossible to pick out the repeated patterns. Particularly if they are all at different but similar speeds, which thus causes a lot of merging and separation and thus breaks up the pattern even more.

    TLDR: Yeah, you could create that in this tool or a variety of others.

    edit: I should also add that the quality of the result you get is going to be as much dependent on the quality of your normal maps as your shader itself. If you have low quality normal maps or really repetitive ones, no amount of shader work will make that look nice. But pair great normal maps with the sort of shader logic I just described, and you'll get something easily as nice as the above.
     
    benderete and KillerNads like this.
  40. KillerNads

    KillerNads

    Joined:
    Jan 22, 2017
    Posts:
    70
    Thank you for the detailed response. I have zero experience with Shaders and for creating something like this. But hey we have to start somewhere right :D

    Perhaps i should just purchase ASE and give this a go, it might take me a few days but atleast i will know how to create similar stuff like this then in the future!

    I think though before i dive into something like this which is quite complicated i should start with something much smaller and easier.

    Can you recommend me any video tutorial to start me off with? Something which though not as detailed as what you described that i need to do but follows the same principles?

    Thanks.
     
  41. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    There are actually some refraction shaders directly included with ASE, and you can make a copy of them and pop them open and start tweaking things until they look like you want as one example. But any of the tutorials on ASE or Shader Forge should help you understand the principles of what is going on here. ASE tutorials are definitely better for ASE, of course -- and I do recommend ASE over Shader Forge, after having used the latter for years and switching recently to ASE.
     
    KillerNads likes this.
  42. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    Hi, just add to the great x4000 response you can also do normal map animation with a sheet of animated images (normal images) if you prefer, using the flipbook node.

    an example using flibook
     
    Rowlan and x4000 like this.
  43. redcap

    redcap

    Joined:
    Jul 5, 2012
    Posts:
    53
    I have shader forge, but have kept my eye on this for quite a while. How is it different or better than shader forge?
     
  44. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    298
    Longtime shader forge user here. Overall my impression at first was that they are very similar. I was quite frustrated with some of the differences in ASE at first, because things I was used to suddenly felt awkward. That passed surprisingly fast. Now I went back to Shader Forge for something and felt awkward there.

    The actual output from ASE seems cleaner than SF, when I have to go in and make changes by hand. It's more method-oriented.

    ASE supports instanced properties, whereas SF does not. So if you want to use instanced materials with per-instance properties, you need to either edit the SF shaders by hand after the fact (which I used to do), or you need to use ASE.

    SF has some recurring bugs with things like nodes being initialized in the wrong order, but they are very edge cases and something that can be fixed easily manually. ASE has many more errors that I've hit, but most are based around nullrefs in the editor code itself. These are easily fixed if you go into the ASE code and just wrap the offending line with an "if ( thingThatIsNull != null )" statement. But you have to be careful not to close ASE until you confirm that you didn't have any such errors. This is my #1 gripe with it, but unlike SF it doesn't affect the output shaders.

    I find the panner a bit more awkward in ASE compared to SF, and it seems like when you override the UVs of a texture sampler you're also implicitly overriding the base offset and tiling unfortunately. Then you wind up with a useless offset/tiling set next to the texture, and in the shader you need to add a new Vector4 to handle that. It's a minor gripe, but one example of something that is less mature than SF.

    ASE offers much better control over platform support, and over some of the keyword disabling for extra features you might not need.

    edit: ASE also offers multicompile for forward and deferred with one shader, which SF does not to my recollection. I typically don't use that anyway, but it's handy if you're selling something for the asset store I imagine.

    Dealing with transparent or alpha blended additive shaders is less intuitive in ASE. Workable, though, for sure.

    I miss the ability to have non-slider numeric floats like I did in SF. But you can use a Vector2 if you absolutely need that.

    The interface in ASE is cleaner, once you get used to it. And it has more tools for making it cleaner, such as the groupings and such. The variable declarations and so forth help lead to even better-looking organized stuff.

    Deleting one variable can sometimes cause other variables to lose their references, though, which is annoying. Easy to fix, though.

    The ability to use shader functions is pretty much worth the switch on its own.

    The ability to right click and then start typing to get the node you want is something I really missed when I had to do something in SF. I got used to that super fast.

    ASE is also updated way more frequently than SF at this point. Particularly with the new versions OFF the asset store.

    TLDR: ASE supports more modern features, particularly around instancing, and it seems to set things up in a more readable, possibly slightly more efficient way in the actual shader code. The interface is nicer in ASE, but there are some interface-related bugs that pop up from now and then, marring slightly what would otherwise be a flawless experience. You can easily fix such bugs yourself with typically one line of code, though.
     
  45. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,172
    Thanks @SniperEvan. That looks like exactly what I wanted. My only question is that if you wanted choppy/harsh waves, as in a Lighthouse on the rocks in Ireland, is there a way to make the top portion of the water look that way? All the examples I've seen seem to have calm waves.
     
  46. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    Hey guys... I am trying to setup my shader to use the Z Channel of the detail normal maps for roughness, but I just discovered there is no way to do it atm? Could we log this in as a feature request? I am planning on using detail maps for Normals, Roughness, and AO for detail maps. And make Diffuse if I can get away with it.
     
  47. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    414
    It's not the first time people ask about this, so I'll try answering this for future reference.

    In unity normals are packed on disk. This is because while you traditionally build normals maps with 3 axis components, you only need two of them (XY / RG) and the 3rd (Z / B) is ignored and recreated inside the shader. This not only lets you have higher quality normals maps from smaller images but also lets you resize the normal scale on your material.

    If, for any reason, you want to use either the 3rd (Z) channel or the 4th (W / Alpha) to further increase your savings you need to do some alterations on how you read your normal map, otherwise your normals will indeed get screwed.

    1. Unmark your normal map in your inspector as a normal map by setting it as "Advanced". This insures your normal map no longer is packed and you can use both the Z and W channels. This also means you cannot read the normal map in the shader in the same way.

    2. In this same "Advanced" mode, check the "Bypass sRGB sampling" or "Linear Space" equivalent to this texture. Making the texture linear is necessary for the normal map to work properly. This also means whatever data you put in the extra channels must be linear data. (as a side note, do not set set alpha as transparency)

    your unpacked normal map should look like this (unity 5.4)
    texture properties.PNG

    3. Finally in ASE you need to sample your texture as a regular texture and to the unpack and scale separately. BUT! because your texture is not packed you need to some swizzling in order to call the unpack correctly. It may sound counter intuitively since it's almost as if you are packing the normal map again but in reality you are just changing the channels around so that unity's built in function works.

    packvsunpack.PNG
    This image above shows both a regular packed normal map on top and the unpacked version that has information in the alpha channels below (the lerp is there just to check the differences, which are none unless the compression is different).

    The important part to note is the append node next to the texture sampler (that append is not exactly doing swizzling but it seems more logical do demonstrate). It's only reordering the R and G channels to G and A channels respectively. This is because that's how unity packs the normals internally and how the unpack scale normal expects the normals to be packed. (it has to do with the G and A channels having more precision than R and B)

    Here's an example on how you should really do this in the most clean way (using a swizzle node):
    unpackexample.PNG
    Hope this clears some things up.
    Cheers
     
    doq, KRGraphics and x4000 like this.
  48. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    405
    Hi everyone,

    We've just uploaded a new build into our website.
    Here are the release notes:
    Release Notes v0.7.2 dev 07:
    • New features:
      • Added support for multiple ASE windows opened simultaneously
    • New Samples:
      • Animated Fire with Shader Functions
    • Improvements:
      • Forcing InvariantCulture on ASE execution cycle to prevent issues with number parsing
      • 'Texture Sampler' node no longer shows it's sampler properties when a 'Texture Object' node is connected to it
      • Improved redundancy awareness on 'Virtual Texture Object' and 'Texture Sampler' nodes
      • Improved 'Virtual Texture Object' tooltip
      • Removed Return button from Shader Functions since it is now useless with new multi-tab behavior
    • Fixes:
      • Fixed issue on changing Normal map option in 'Texture Sampler' node not changing its output type
      • Changed 'Virtual Texture Object' node channel name to 'Layer' and fixed its default value not showing up correctly
      • Virtual textures now generate properties with their correct name (requires user changes to the virtual texture itself)
      • Fixed issue that break compiling when a missing shader function was present
      • Forcing internal data update for shader function Output nodes to prevent errors when they are disconnected
      • Fixed small issue with shader function nodes being stuck on selection when double clicking on them

    On this build we've added yet another cool feature which we think will be very useful to everyone. Now you can have multiple ASE tabs opened simultaneously, each one with either a shader in Shader Mode, a shader in Material mode or a Shader Function.
    However, you cannot have the same shader opened in multiple tabs even if they are in different modes.

    Here's a small demonstration of multi-tabs in action:



    Happy shader creations!
     
    petersx and benderete like this.
  49. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    272
    That'll make working with shader functions much easier.
     
  50. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975
    It looks like a real mess, but I will try it out. Especially if I want the Roughness in the Alpha and AO in the Z channel