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. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    I know this is not a question related to the Asset itself, but I'm mainly struggling with how to use math to create what I want when I try to create shaders.

    I'm actually reading "Unity 5.X Shaders and Effects Cookbook", which will help me understand further how shaders work and to create some extra effects.

    Does anyone know of any other useful resources, maybe for applied math to shaders, so I can learn how different functions interact with each other?

    At the moment I'm doing mainly sprite manipulation for a 2D game (i.e. applying a mask to a chest , moving its UVs so that it resembles a pickable item, animating our main screen splash art, etc).
     
    Last edited: Nov 9, 2016
  2. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    528
    Hi all,

    Just uploaded a new build into the download area.

    For internal reasons we had to skip dev 005.

    Release Notes v0.2.4 dev 006:
    • Fixes issues on 'Panner' node
    • Fixed issues with not correctly generating local variables according to port category
    • Tweaked behavior and fixed issues on the 'Texture Coordinate' node
    • Fixed issues on 'Texel Size' node
    • Fixed issues on 'Local Vertex Pos' node
    • Fixed issues with Burn Effect Sample
    • Removed positive number restriction from Master Node 'Queue Index' property
    • Custom Material Inspector can be selected/changed on Master Node
      • Done through the Custom Editor property
      • You can always reset to our own by hitting the Reset button next to hit
    • Updated Rim Light Sample to use the new Space option on the 'View Dir' node
    • Updated Parallax Sample to use the new Space option on the 'View Dir' node
    • Added 'Translucency' input port into Master Node
    • Added 'Dithering' node
    • Added Matcap Sample
    • Added Dithering Sample
    • Added Rendering Platforms selector on Master node
    • Added Water Sample on a small terrain in the Sample Scene
    Dithering:
    This node generates a dithering pattern in screen space which may used to achieve effects like fading out objects without the need of using transparency.
    For the moment there only two available matrices, a 4x4 Bayer matrix and 8x8 Bayer matrix but we might add more in the future.


    Translucency:
    Through this port you can create an approximation of translucency ( DICE model ) which can be used to achieve sub surface scattering effects ( Skin, Marble,etc. ).



    VERY IMPORTANT, we would like to advise you guys to create a backup of you shader before compiling with this new version. The inputs order changed on the Master Node with the addition of the Translucency port.
    We are internally rewiring everything so your shaders will load correctly, but create a backup just in case we missed something.

    If your shader breaks in any way please send them to us so we can see what might be happening as fix it asap.

    Happy shader creations!
     
  3. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This is a start... :) Once, I can get custom specular and diffuse bump blur working on this... then I can start making my own shaders. It is gonna sound crazy, but I want to get as much control as I can like Marmoset and UE4

    And how do you make a custom inspector with this?
     
    Last edited: Nov 9, 2016
  4. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    +1

    Answering your question, the editor is only giving you the option change the custom inspector, the editor had one already but now you can change it to use another one but this means you would need to create one yourself. For example the standard shader from unity has one as well.
     
    KRGraphics likes this.
  5. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys, for anyone doing a deferred version of an Amplify Shader, does it turn black when you set the rendering path to deferred? I am creating a skin shader and trying to implement the three channel diffuse blur but (don't know how) and the shader turns black...

    Screenshot 2016-11-09 18.02.49.png
     
  6. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I am trying to figure out how...
     
  7. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    How do you change it? In the shader properties sidebar just change the custom editor field to the name of whatever is the name of the class of the custom editor you created.

    Or do you mean how to create one? The best I can reply is to follow on this doc which has a few examples. Of course you would need to adapt it to your shader. https://docs.unity3d.com/Manual/SL-CustomShaderGUI.html

    Also, I could be wrong but you can't use translucency in deffered since you would need to squeeze the translucency input into the g-buffer. Well it is possible to change that yourself but the editor creates shaders that works with whatever unity has, it's not intended to change the inner workings of unity's pipeline. But that black is probably a bug, it should use forward automatically, either that or it should exclude deferred by itself, meaning, it shouldn't let you select "deferred only". But you can rest assure that if you select "all" it will always use forward even if you have your scene set to deferred. Kinda like how it does with transparency currently.
     
    Last edited: Nov 10, 2016
  8. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    Hey!

    I have an issue which I'm unsure how to resolve in an efficient way.

    Let's say I've got some UVs animated by _Time. These would be permanently animated.
    How would you go about creating delays? For example, it would be animated one second and not animated during five seconds.

    To create these delays, should I set my own time property and handle it in a C# script using the material.SetFloat() function passing a value I handle myself?

    Is this optimal/optimized or is there any other way to go around it?

    Thanks!
     
  9. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Hey there. What would be the purpose of the effect? Are you gonna trigger it with gameplay or is it an effect that's always present? Because if it's the first case you are better off with scripting. You just fire the effect any time you want and you can control it using a tween of your choice, that would be the fastest and easiest way of doing it. But if it's a looping effect where you don't care when it starts, only that it has a delay you can create some logic inside the shader using "sin" and time. For example saturate(sin(_Time * 0.5)) will create a pulse with a pause in the middle because saturate will clamp any value below zero which is produced by sin half of the time. 0.5 is just a random value that makes the effect slower.
     
    KRGraphics likes this.
  10. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    It's going to be always present.
    I'll try what you told me and report back with results.

    Thanks!

    Edit: Unfortunately, it's not exactly what I'm looking for.
    This is what I had:
    Shader1.gif
    This is what I have after changing that:
    Shader2.gif

    The image on the left is a normal sprite.
    The image on the right is an composed atlased sprite using Spine. The top is actually a detachable image allowing us to change it to an open/close state. Hence the weird behaviour.


    This is my shader:
    Shader.png

    I was mostly looking for that horizontal bar to be animated every few seconds, always from top to bottom.
     
    Last edited: Nov 10, 2016
  11. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I might try this with playmaker, and just use a material swap :)...like the burning texture example
     
  12. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389

    Have you seen the new Translucency sample? We invite you all to try it out today, it's an easy and flexible way to simulate light transmission on almost any type of asset. Be sure to download the latest ASE version available directly via our own website.

    Amplify Products - Download
     
    Last edited: Nov 10, 2016
    benderete, ZJP and KRGraphics like this.
  13. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I had a chance to play with translucency last night. it was very easy to set up and I also used my existing textures on it. All that remains on the shader I'm making is setting up the custom shading model for subsurface scattering, adding a specular feature to the master node, setting up the diffuse bump blur like in most high end skin shaders, custom lighting.

    Basically, a new lighting model lol
     
  14. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    I love the effect of translucency but I wonder if we can fake raytracing.

    Thinking pubicly here :)

    Obviously when a light source is behind a character the entire character would not be emissive. This means we need a few things a texture to determine how translucent any given surface is & a texture to control the angle of translucency.

    An example will be a nose. Again with our light source behind the actor you would not expect to see light emission from the front of the face, only around the ears. But now looking at the right side of the head with the light behind the left side, you would not expect to see emission from the right ear but you would expect to see emission from the nose.

    I think by using a grey scale texture to control the translucency (thickness map) of the actor and perhaps something like a simple color map to give areas control over the light angle to determine when the emission from translucency would kick in.

    The angle map would be something like:

    red= when the light is to the right
    green= when the light is to the left
    blue= when the light is behind

    Because this is per RGB channel you can sample between the 3 colors to get any angle.

    Then multiply the thicknes map over the angle map and Boom simulated raytracing.

    Just a thought don't know if it would work.
     
  15. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    You don't need all of that, while the animated gif is showing a bunch of translucency the actual shader that generates has a slider for the shadow contribution to the effect, meaning, it will actually remove translucency based on the shadow created from the light source, it's just turned off in the example. In effect if you add the shadow you'll only get the effect in the rim of the model.

    Also, you can actually output a "depth map" to the translucency port, which means you can mask areas that are too thick to have such strong translucency. I recommend you to use knald for baking depth maps (they call it transmission there). But if you can't there a quick and dirty way of getting it by inverting the high-poly model normals and bake your AO map and then invert that same map in photoshop.

    @grogshotgames
    well my example was just that, an example, your best option is indeed shader logic. I don't have much time right now, but I'll try setting up an example for you later today. It's something like 1 sec forward animation followed by 5 seconds of pause right?
     
    KRGraphics likes this.
  16. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    @kebrus : That is awesome! I own Knald already & I will be getting this for sure now. Thanks for the description of how translucency works in amplify.
     
    KRGraphics likes this.
  17. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I actually noticed that with the shadow that there was no transmission. Something that is amiss with Alloy. I usually pack the transmission map in the alpha of the albedo map for optimisation (I might change this to have its own slot just for kicks. And add a subdermal slot for skin). I also edit the baked map in Substance Painter, painting areas closer to the bone a dark grey.

    While we are on the topic of skin, I'm trying to create the the diffuse bump blur that is often present in skin shaders to give the very soft effects like in games such as battlefield and sports titles. Any idea how to do it here in ASE?
     
  18. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    You'll love knald.
     
  19. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    @grogshotgames
    here it is
    Highlight effect.png
    Because what you want is a forward animation using sin doesn't help because sin makes the value ping pong between -1 and 1. On the other hand frac creates a repetition effect, the other part of the effect is the step node that gives you either 0 or 1 depending on the sign of the input. In this case I use it to "cut" the smooth gradient into a white band that I then lerp to whatever color I want.

    The values aren't totally right but it should give you a good start. You want to use the time scale float and the darkness scale factor to basically achieve whatever band you want with whatever time you want in between. I kept it simple so you can experiment with it, as an exercise, try creating the math logic so you wont have the time delay decoupled from the width of the band.

    I did this on top of a test with translucency and put it on emission. It should be easy to adapt to what you want.
    highlight.gif
     
    Last edited: Nov 11, 2016
    Squize, benderete and nipoco like this.
  20. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    I'm actually trying to add tex2Dlod and tex2Dbias to the editor. For now that is the only way I know to blur the images that you input. That should be easy, what's more difficult is adding that blurred normal to the translucency without destroying the original normal. That would required manual edit to the shader for now.
     
  21. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Aye, and there's the rub
     
  22. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    Thanks a lot!

    Will reproduce it and play with it as soon as I can.
     
  23. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    Had to tweak it a little bit, specially on the WorldPosition input, as it was returning several bands over my texture.
    After multiplying it for a value it seems to be working great.

    Thanks a lot! :D
     
  24. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    That happens because your sprite belongs to an atlas so it's a lot smaller on the final uv. That scale that you got working will break if your sprite atlas changes dimensions. But if it works for you thats cool.
     
    hopeful likes this.
  25. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    528
    Hi guys,

    We just uploaded a new version into the download area.

    Here are the release notes.

    Release Notes v0.2.4 dev 007:
    • Fixed issue on wrong auto-snapping wires with invisible, locked ports
    • Fixed issue with version control on Master Node
    • Added Transmission input port on Master Node
    • Added 'Mip Mode' in 'Texture Sample' node
    • Property names can now be changed directly on node by double clicking on it
    • Properties can be reordered through drag and drop operations on the Master Node properties via the Available Properties foldout area
    • Min/Max values on 'Ranged Float' nodes can be modified directly on canvas

    Separate Samples Package:
    To keep the build size as small as possible we decided to remove the samples from our internal builds and place them into a separate unity package, which is also available at the download area. This way is faster for you to download and import new builds into your projects.

    Transmission:
    This input provides the cheapest way to simulate transmission and is mostly useful for thin materials like paper or vegetation. It can also be used as a cheap form of back lighting. Although not as advanced as our previously added translucency feature, it can be enough for some cases.


    Property Node Renaming:
    Now is easier to rename property names on nodes. You no longer need to go to the Node Properties Window and use the Name text field, you only need to double click the node and rename it directly on the main canvas.


    Property Reordering:
    You no longer need to configure property order on shader via the Order Index on each Node Properties. Now you can easily achieve this via drag and drop operations on the Master Node properties.


    Happy shader creations!
     
  26. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    @KRGraphics
    There you have it :) with this you can define a lod level and have the textured blurred. It still doesn't solve the problem with having that blurred texture into the translucency calculation but keep in mind that translucency has a slider for the normal contribution, while it's not blurred it might be enough for the purpose of diffusing the scattering effect.
     
    KRGraphics likes this.
  27. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    o yeah property reordering :D
    yeah sometimes my ocd are kicking in :p
     
  28. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    You sir are my hero!! Can't wait to get home and mess with this.

    Will any of these shaders work with Enlighten?
     
    Last edited: Nov 12, 2016
  29. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467

    I'll test this later. And I hope we'll have a custom lighting to allow specularity, that is currently missing...

    I'm gonna try to emulate the shaders from CryEngine and frostbite... the red channel in the diffuse bump is usually the strongest and blue the weakest.

    Perfect example is the shaders from the Blizzard tech papers and the Pre-Integrated Skin Shader for Unity. It does exactly what I'm looking to recreate
     
    Last edited: Nov 12, 2016
  30. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    Actually... it's a non-atlased texture, that's why I find it weird.

    Cool stuff! Keep 'em coming!
     
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I'm digging the new texture LOD settings on the Texture Sample Node... is there a way I can do this per channel...?
     
  32. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Not sure if that is a bug, or an issue on my end.
    I tried to make a simple rim shader with a texture. But all I get is the notorious pink material. If I use a color for the albedo, it works just fine (The the pink sphere in the game view)
    Btw. If I try the same in Unreal's material editor, it works with texture too (same setup)

    I attached a screenshot with the console message.
    RimShader.jpg
     
  33. ViktorCor

    ViktorCor

    Joined:
    Jul 22, 2012
    Posts:
    13
    Great! :)

    Please add Light Wrapping. It is important for creating smooth lighting for skin or cloud or simple sss effect
     
  34. benderete

    benderete

    Joined:
    Aug 31, 2014
    Posts:
    129
    I don't know if is a bug or not. But you can have working your shader on two ways:
    - Change shader model to 4.0
    or
    - Add a texture sample for normal Captura de pantalla 2016-11-12 a las 19.06.04.png
     
  35. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    I can't tell if that bug is funny or just sad. What's happening is that unity is generating interpolators that have not been asked to be generated. It's very similar to a bug I had some pages ago with the same node, the fresnel one. Somehow unity is generating two extra interpolators even tho the code is not asking for them. This is definitely a bug on unity's part. What's even more strange is that if you actually ask for at lets one of those interpolators it then stops generating the extra two and it works again xD

    that's why if you put something into the normal it works. It will also work if you put the "vertex normal" node into the the "normal input" in the fresnel node which should be a temporary solution for you now. This works because if you do that the fresnel node doesn't generates the normals anymore but the new node will ask for them in the interpolators which in turn makes the extra interpolators disappear... yeah... weird and confusing.
     
    KRGraphics and benderete like this.
  36. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Thanks for those work-arounds @benderete
    And thanks for clarifying this @kebrus.

    That's indeed weird.
    Like I said in Unreal, this setup just works fine.
     
  37. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys, I am looking to setup the blurs for the normal map, is there a way to get this to work? The mip modes are cool, but I was going to use floats to change the strength of the normal map channels or blur it... I compared it to the Alloy skin shader and it is damn close to what I am looking for. Just need more control...
     
  38. barikinil

    barikinil

    Joined:
    Apr 15, 2015
    Posts:
    11
    Hello,
    I want to ask about
    • referencing base shader into another shader. For example i have base shader, and there 2 other shader that has differences specific to each to other. if i have to change something, i can easaly change in base shader, otherwise i have to change this 2 shader seperately.
    • grouping shader property at the material inspector like unity standart shader second maps "detail mask, detail albedo...".
    • can I add conditional boolen property to open or hide more options in the material inspector. For example i want to add snow property but if dont use this option i want to hide all snow normal, speculer, etc in the material inspector.
    Thank you.
    Regards.
     
    Last edited: Nov 14, 2016
  39. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    Hi, does this only generate surface shaders? Or can it be used to create vertex or fragment shaders to use in mobile games.
     
  40. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    I didn't try any specific example but it seems to work for me, what can't you do? could you be more specific?
     
  41. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    528
    You cannot do this using ASE on our current stage, but this suggestion has real potential indeed.

    To add additional options to the material inspector and achieve what you described you'll have to create your own custom inspector.
    When creating a shader using ASE, we auomatically assign our own custom Material Inspector ( ASEMaterialInspector ) to the shader but this can later be changed via the Custom Editor textfield under the Master Node properties.
    If you decide to come back to our own just hit the small reset button right next to the specified textfield.
    You can already specify shader properties order of appearence by either specifying the order index in each property Node properties window or via the master node properties by drag and dropping them under the Available Properties foldout.
    If you take a look at my last post, you'll see a small gif demonstrating the later one.

    Yes, for now we are only generating surface shaders. But adding vertex and fragment support will be also implemented down the line.
     
    hakankaraduman likes this.
  42. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I am trying to split the mip into three separate channels, then rejoin it into one normal map again... here is a diagram...

    Normal Map diffuse Blur.jpg
     
  43. RoyArtorius

    RoyArtorius

    Joined:
    Jul 11, 2013
    Posts:
    73
    Hi, still loving this, but I'm curious if there is or will there be multiply and add nodes that take more than 2 inputs. I asked about this quite awhile ago, and I think it help keep shaders a bit neater.
     
  44. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    kebrus likes this.
  45. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    Small bug report: When resizing a comment group while zoomed out, the resizing does not take the zoom level properly into account.
     
  46. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    How do we get that softness working in the graph? Alloy is the closest I can get with the skin quality.
     
    Last edited: Nov 14, 2016
  47. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    you can use texture mipmap or lod
     
  48. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Well my post is all about avoiding the mimap or the lod. I don't have amplify yet so, due to some problem on my side, soon to be resolve. As soon as I get it I'll try it.

    Replace the LOD sampling (the blurred normal) in pre integrated shader with:
    float3 Snorm = float3(0,0,1)*3;
    Snorm = normalize(half3(o.Normal.xy + Snorm.xy,o.Normal.z * Snorm.z));
    Snorm = WorldNormalVector( IN, Snorm );
    o.BlurredNormal= Snorm;

    You still have to implement a full pre integrated shader
     
  49. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Oooh i totally missed your post :D
     
  50. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    Since you want three difference mip for the same map it means you need to have three samplers instead of one, so instead of thing of doing one sampling followed by a split you need to do three samples of the same image, just duplicate those and use the same textcoords for the three of them and put two of them in "instance" mode, you can then change their bias and rejoin them as you want.
     
    KRGraphics likes this.