Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[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. Andrey_Graphics

    Andrey_Graphics

    Joined:
    Oct 29, 2015
    Posts:
    140
    Hello, at displacement of vertices, a model is not correctly shaded, I tried to study shader " VertexNormalReconstruction" but did not understand, because I do not understand as it works, I did not find complete description, will explain please as it works and how to build shader.
     
  2. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    353
    Wow, what a fantastic and complete response -- thank you! Those things sound like just the ticket for me. In the worst case I can simply build four variants of each of my shaders by hand. It's not my preferred approach, but there are a limited number of shaders that I'm using repeatedly and that would need this sort of functionality, so it's not the end of the world.

    It would definitely be nice to be able to implement checkboxes for these features, but as you say that would basically be a multi-compile situation, rather than branching if-else code within the shader -- if I'm understanding that right? Now that I have the keywords that control this, I am going to need to do some more research into this on Monday to see how I can best use this, given the unity docs.

    I'm targeting 2017.3, so I don't have any worries about the pragma approach not working; I'll probably explore that as the primary avenue.

    Thank you again!
     
  3. ZaZy

    ZaZy

    Joined:
    Jan 14, 2015
    Posts:
    20
    Sorry, I didn’t explain that well in my post but the forum wouldn’t allow me to edit my post twice (kept generating an error about spam or something).

    What I meant was that when using the pragma method you have to use the shader_feature directive for those keywords for them to work (because that’s how Unity implements them in the standard shader). When using shader_feature directives you can’t purely rely on setting those keywords via script code because the Unity compiler will not include variants into the game build if it doesn’t detect the keyword as being used on any materials in the scene (as opposed to multi_compile where Unity will include all variants for those keywords regardless of use in the scene). Using scripts may work in the editor but then get broken when your game is built.

    I couldn’t find a workaround to this, so for now you will need to manually set the shader keywords in the material debug inspector tab if using the pragma method. This is still better than hard coding them as always off at the shader level (i.e. when using the define override method), because it allows you to turn them off on selected materials in certain scenes instead of turning off everywhere for that shader.
     
    x4000 likes this.
  4. ZaZy

    ZaZy

    Joined:
    Jan 14, 2015
    Posts:
    20
    So to clarify, we could implement checkboxes if the ASE devs give us one or both of the following features:

    1.) A ToggleOff Property Attribute - We only have a Toggle[On] attribute currently. The drawbacks of this is that we would still need an additional pragma for each keyword and we would need to name the property in a way that shadows the underlying standard shader variable for its checkbox property variable (we would also need to use the variable in our shader somewhere so it doesn’t get discarded by ASE)

    2.) An OFF option for Static Switches - this would append an OFF suffix to the internally generated keyword (instead of ON like it does now) so we wouldn’t need additional pragmas. The same drawback of having to use this block in our shader to avoid it being discarded would still apply
     
    x4000 and Amplify_Paulo like this.
  5. ZaZy

    ZaZy

    Joined:
    Jan 14, 2015
    Posts:
    20
    That’s a fantastic idea! Brian Sharpe’s noise lib has great noise quality and is very efficient (although the parallel optimisations make it quite a bit harder to understand). Are you porting just the noise lib or his more self contained ‘Wombat’ library as well ? Do you plan for this to be a community submission ?

    I ask as I have recently extended his 3D simplex noise with derivatives (Wombat version) to 4D with derivatives and am contemplating submitting this as a community solution to get feedback on whether the implementation is correct. I think I have also had some success in converting the derivatives to tangent space for input to the standard normal map channel in the fragment shader so would be great to get feedback on that as well.
     
    x4000 and blitzvb like this.
  6. Cdngater

    Cdngater

    Joined:
    May 29, 2014
    Posts:
    65
    Hello all,

    I bought amplify and am blown away with it. Unfortunately I am having an issue, not with the application, but with my understanding of shaders and I hope someone can help with a simple concept.

    This is based on something simple, blending between two textures. Now I understand hooking them up to a larp node and depending on the input value (0-1) I get a blended output, this works fine.

    But here is what I am trying, I want values 0-0.35 to be texture one, 0.36-0.65 to be the blended texture and 0.66-1 to be texture two. I think I know how to do it get the value via c# code, I just not sure how to do it in amplify shader node language.

    Can someone help me understand how to do this?

    Edit: thinking about this some more, it’s edge blending between two textures. I don’t want the overall blending, just an edge amount to be blended.

    Thanks
     
    Last edited: Dec 3, 2017
    x4000 likes this.
  7. TheNathanParable

    TheNathanParable

    Joined:
    Mar 21, 2014
    Posts:
    17
    It sounds like you either want to Smoothstep or Remap the alpha before feeding it into the lerp.
     
    x4000 likes this.
  8. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    Hello all!

    Since there's not a lot of documentation for it, I made a tutorial explaining how to edit material properties with a script:



    And this video explains how to use the Panner node:



    I hope its helpful! Subscribe ;)
     
  9. Cdngater

    Cdngater

    Joined:
    May 29, 2014
    Posts:
    65
    Thank you TheNathanParable, I had added a remap, but with my thinking I had used it wrong, your comment made me rethink and figured out the ‘stilly’ mistake I had done.
     
  10. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    So in my quest for having a suite of shaders, I decided to create a hair shader that will allow me to create realistic looking hair on my characters. I am looking to emulate the hair shader from Alloy but at the moment, there is no access to the shading models I need.

    The current shading model is specular/Gloss, and I will later add the ability to have 3 additional strand colours (Which requires me to create CG hairs in ZBrush for baking to textures later.), double specular highlights and shifting (Are we able to transform textures yet?), Root and tip colouring using a mask (I can try using a gradient for this)...

    Stay tuned.

    Alloy Hair
    upload_2017-12-3_16-40-0.png


    Mine
    upload_2017-12-3_16-48-14.png upload_2017-12-3_16-49-5.png
     
  11. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Sorry for the delay, it was long weekend.

    As for your questions about the custom expression. We introduced the out and inout types at the same type as the call mode. The call mode is sorta of an ugly hack to be able to call a function that already have (lets say, inside a cginc file) and be able to specify when you want to run it. So when you activate it a new port is added to serve as a guide to when you want to run it. And because you can inout parameters we added those for the those cases. In retrospective we might have missed some usability when not in call mode. So you are right to be confused on how to get the values you send because we only thought about then for the specific case of function calls.

    We have discussed internally and the idea we have to solve that issue is to add output ports automatically for the types that need it. We'll work on it and if it all goes well you can expect it on the next dev build.

    Cheers, and sorry for the confusion

    Like you've already figure out that's an unfortunate byproduct of batching, because batching merges all meshes into one and thus it becomes just one transform. If you really need batching you save the information you need to be different between then in some vertex data like color or unused texcoordinates.

    The equivalent node would be world position node like brisingre mentioned, you may find the code is not the same but that is only because we are taking advantage of some surface shader code that is generated automatically. If you do it like the screen below you'll see the code ends up the same because I'm forcing it to be generate in the vertex function (ignore the local variables generated they don't affect performance). This is irrelevant to the common user but since you asked :p
    Unity_2017-12-04_12-19-33.png
     
    Last edited: Dec 4, 2017
    brisingre likes this.
  12. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I think I will try to use the template to reconstruct the hair shader from Alloy... just need to figure out how. The shader code has a lot of properties for its custom UI in it
     
  13. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    Hi, was there any progress on this (adding in support for Hitbox Team's Hx Volumetric Lighting)? It was simple enough to make these modifications on my old shaders made in Shader Forge, but it's the one thing I'm having trouble replicating in my new Amplify shaders. I'm not really a coder, so after throwing in the #include and #pragma lines, I'm at a loss. :(

    If it truly can be done within the graph itself, that would be fantastic, because I always had to manually edit the compiled shader with my old Shader Forge creations.
     
  14. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    @ZaZy already gave you an awesome response (thx), I'll just add here that I'll add a few more options in both the main rendering options and the static switch node so you can create those two toggles (and others if they ever exist) so you can toggle them easily or use them for some logic you might need.

    Hey there, I'm not sure if this completely solves it for you but the equivalent code for that would be something like this:

    Unity_2017-12-04_14-37-27.png

    Do notice that I'm not really using the values you would need to use, you would replace the screen position node with the distorted UVs you already calculated and the input for the if node would be the normals you want to change or erase from.

    Having tried doing some of them myself I'm pretty sure you can. At least in terms of surface shaders, as far as templates go we are still missing multipass which should come after the terrain support that we are working on now.

    I could be wrong here since I haven't tried it but most likely you are able to create a outline template already IF you don't need to edit it. Since we want it to be editable we need multipass support which we'll start working on after the terrain support. After that it's all gravy :) These changes only affect surface shaders, since some users wanted a few more options to outline we have discussed if it worth working on them right now or wait for multipass, what we decided was to add a few small options now to surface, one of them was fog support that we just released, and there are others for ambient light coming. And then we'll do the rest with the template system. The main reason being that it would be too difficult to asses which new options should we add. We thought about texture based outlines for instance but considering all the requests we got, there's simply too many different cases, so it's just better to wait for multipass in templates and then you do whatever you want with them. I know I've talked about them endlessly but there's just too many things on our hands right now and it's not always easy to prioritize what to do next between features and bugs to fix.

    The idea behind it is that you need to calculate the new vertex position not once but three times, one is the original that you already have, and the other two are mostly similar but with a small offset in tangent X and Y. With these three points you can calculate a new normal. In the sample we provide we have the code for the vertex transformation inside a shader function so we can reuse it in those 3 points. So because that calculation might differ from yours, unfortunately, it's not something you can just copypaste into your shader, but the general concept is there.

    On the other hand I highly recommend you to check whether blend shapes are enough for you or not. Blend shapes already save and blend normals and since you seem to be doing character transformations it might be the best solution for you. Normal reconstruction is useful for realtime stuff like procedural generation or moving vertices.

    I know you already have your answer but here it is for future reference, you do it like this:
    Unity_2017-12-04_15-26-49.png
    I'm using colors but you can use textures. The idea here is that you transform the linear value of your lerp function into one that starts 0.33 times later but ends 3 times faster, so you subtract -0.33 so it starts lerping later and you multiply it by 3 to end at 0.66. The saturate node clamps whatever value into the 0 to 1 range. this is to make sure nothing funny happens to your colors if the values start going negative or higher than 1.
     
    KRGraphics likes this.
  15. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Immensely sorry :C after failing to get a hold of that asset I eventually forgot about it completely. Bad management of my part, completely lost it in the sea of requests.

    I'll prioritize your case and start looking right away.

    Again, very sorry for not looking into it for all this time :| (shame, shame, shame)

    PS: it seems the original request was from @brisingre truly sorry for the delay :oops:
     
    Last edited: Dec 4, 2017
  16. rekka3000

    rekka3000

    Joined:
    Feb 9, 2014
    Posts:
    46
    Hey, thanks for the reply! No rush :) I just wasnt sure if it worked yet. I won't be the one programming it so I just didn't want to ask our outsourcing companies to work on something if it wasn't possible. We will want to edit it depending on the character / situation so its okay to wait :)

    As an additional question, I'm trying to add some additional features to the toon shader, mainly from the Guilty Gear Xrd shader the amazing High_moon made (his shader is freely available to download on the forums).

    One, I want to add additional shadow information via the green channel of a texture
    Two, I want to add additional shadow information via a vertex color.

    I shot him a message and I also checked the source code myself, the main points that he also pointed out where:

    I've tried to replicate the code as nodes, I've got a Vertex color node, taken the red channel and multiplied it with the green channel of the texture. Put that into a one minus node, but I'm trying to figure out exactly where I should add this to the toon shader example you guys made. I've customized it a bit but it's not that different to what you guys did.

    In addition, the NdotL is obviously the World Normal and World Space Light Dir input into the Dot node which is then put into the scale and offset / saturate + Toon Ramp texture, but is the calculation the same as what hes doing?
     
  17. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    @MitchC and @brisingre
    So I THINK this should be enough for you to make transparency work. Please test it and see if any issues come up. I tried to encapsulate as much as I could into one shader function (in attachment). The only thing outside of it is the multi compile pragma which I'm now considering adding to shader functions as well. So In order for this to work you need put your shader into custom lighting mode and add "multi_compile VTRANSPARENCY_OFF VTRANSPARENCY_ON" without quotes in the custom pragma foldout. Afterwards you just use the shader function which should be self-explanatory. If this works I'll add this to the documentation and maybe even in the package.

    here's a shot, what you use for lighting is up to you, here I'm using the standard one:
    Unity_2017-12-04_17-51-00.png

    You can open up the shader function to see what I did but in short I used a few nodes to get the documented data and then a custom expression node to call the functions in their correct pass.

    I think I've seen that before, is that talk where they change the normals and UV to make a cell shading style to look like it was drawn? Wasn't aware a shader already existed in the forums.

    Either way, I'll have to look into that later tomorrow, I don't see anything special from the code you shared so it should be easy to get it working but I need to understand its context first before I can help you with it and today has been nothing but support. Yay! \o/

    Thx ;)

    Do you mean casting its type automatically? Unfortunately, no :\ .. Because the end result can be literally a function you need to specify the type of the arguments. Or am I missing the point?
     

    Attached Files:

  18. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I started one last night, and it looked really good. Only issue I'm having is the colour not blending properly and the hair fading when you move far away...
     
  19. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    353
    Thanks so much @ZaZy for all the information, and @Amplify_Paulo that's awesome that you can add that sort of toggle. I'll definitely be looking forward to it.
     
  20. rekka3000

    rekka3000

    Joined:
    Feb 9, 2014
    Posts:
    46
    Yes exactly!

    The shader can be found here: https://forum.unity.com/threads/guilty-gear-xrd-shader-test.448557/

    It's pretty good, the only thing is it doesnt support multiple lights and has a weird light error that I've found with spotlights etc. Only really seems to work with one directional light. Essentially I want to try and create this shader but with support for multiple spot lights, no light rendering bug and rim lighting! Also as much flexibility to the look as possible, which is exactly what your toon shader example provided :)
     
  21. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    Thanks very much for getting on that!

    I gave it a try, and it sort of works, but not quite. For one thing, I'm using it on a shader with tessellation, and I get this in the output window:
    Code (CSharp):
    1. Unable to use Vertex to Frag when Tessellation is active
    2. UnityEngine.Debug:Log(Object)
    3. AmplifyShaderEditor.AmplifyShaderEditorWindow:ShowMessageImmediately(String, MessageSeverity) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:3828)
    4. AmplifyShaderEditor.AmplifyShaderEditorWindow:ShowMessage(String, MessageSeverity, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:3812)
    5. AmplifyShaderEditor.UIUtils:ShowMessage(String, MessageSeverity, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs:1920)
    6. AmplifyShaderEditor.VertexToFragmentNode:GenerateShaderForOutput(Int32, MasterNodeDataCollector&, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs:67)
    7. AmplifyShaderEditor.InputPort:GeneratePortInstructions(MasterNodeDataCollector&) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs:307)
    8. AmplifyShaderEditor.CustomExpressionNode:GenerateShaderForOutput(Int32, MasterNodeDataCollector&, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs:522)
    9. AmplifyShaderEditor.InputPort:GenerateShaderForOutput(MasterNodeDataCollector&, WirePortDataType, Boolean, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs:354)
    10. AmplifyShaderEditor.ComponentMaskNode:GenerateShaderForOutput(Int32, MasterNodeDataCollector&, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs:282)
    11. AmplifyShaderEditor.InputPort:GeneratePortInstructions(MasterNodeDataCollector&) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs:307)
    12. AmplifyShaderEditor.FunctionOutput:GenerateShaderForOutput(Int32, MasterNodeDataCollector&, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs:114)
    13. AmplifyShaderEditor.FunctionNode:GenerateShaderForOutput(Int32, MasterNodeDataCollector&, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs:536)
    14. AmplifyShaderEditor.ParentNode:GetValueFromOutputStr(Int32, WirePortDataType, MasterNodeDataCollector&, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs:2280)
    15. AmplifyShaderEditor.StandardSurfaceOutputNode:Execute(String, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs:1710)
    16. AmplifyShaderEditor.MasterNode:Execute(Shader) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs:408)
    17. AmplifyShaderEditor.ParentGraph:FireMasterNode(Shader) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs:2161)
    18. AmplifyShaderEditor.AmplifyShaderEditorWindow:SaveToDisk(Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:1329)
    19. AmplifyShaderEditor.AmplifyShaderEditorWindow:OnToolButtonPressed(ToolButtonType) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:1423)
    20. AmplifyShaderEditor.ToolsWindow:OnButtonPressedEvent(ToolButtonType) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs:206)
    21. AmplifyShaderEditor.ToolsMenuButton:Draw(Single, Single) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs:172)
    22. AmplifyShaderEditor.ToolsWindow:Draw(Rect, Vector2, Int32, Boolean) (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs:234)
    23. AmplifyShaderEditor.AmplifyShaderEditorWindow:OnGUI() (at Assets/Standard Assets/3rdParty/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:4114)
    24. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    If I disable tessellation, it mostly works, but I get some strange ghosting effects which seem to be from objects in the foreground.

    Any idea what might be causing these? Thanks again!
     
  22. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    The dark 'spiky' looking shadow under the red line shouldn't be there. It's some sort of weird ghost of the grass to the left (it animates and moves in time with the grass).

    There's still the other issue of it not working if tessellation is enabled, too.
     

    Attached Files:

  23. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I see, I really think the best solution relies on shader functions. Just like you said managing the custom expression node would be a pain, and in fact we actually want them to always create a function even if the user doesn't return a value because right now we need to define different local variables each time you use a custom expression and we need to change their names accordingly, all this comes with problems, with functions it's all taken care of. But regardless of that which is a separate issue we want to be able to hide shader functions from the context menu (should be easy to do) and then have various shader function linked by name that you use as overloads like I explained previously. That would probably take care of all the things you want to do in a neat little way.

    I'm not really sure whats going on, it does seems to be working tho which is a good sign. The shadow not being cast is a problem I still have to fix, custom lighting shader isn't assigning the alpha properly. ( I can try get this to work for the next build but no promises )

    The difference in tones I'm guessing it has something to do with the blend operation because we do it slightly different from the standard shader. I would suggest to try changing the blend mode to transparent and/or alpha premultiply first, then set it to custom so that the shader uses custom blend modes. For the premultiply you might need to set the blend rgb to custom as well and premultiply the rgb by it's alpha before passing through the shader function. I'm also not sure if zwrite as any impact on it so you might wanna do some experiments with that as well. In the meantime I'll fix the shadows.

    Gonna take a look, can't promise anything yet because it isn't always easy to deal with multiple lights. Thx for the link ;)

    Well that one is easy but not recommended, you can open the shader function and simply remove the vertex to frag node and reconnect the remaining nodes in order for the error to go away. But let me warn tho, that error shows up because unity's tessellation functions don't work well with custom vertex functions, by removing that you doing the calculations in the fragment function which reduces performance unnecessarily, the calculations aren't too expensive but I still advise you to take some measurements of your performance.
     
  24. DiggingNebula8

    DiggingNebula8

    Joined:
    Oct 2, 2016
    Posts:
    21
    Greetings,

    Shaders are the most crucial technical aspect of the game development pipeline. Amplify Shader Editor does a fantastic job of simplifying the entire tedious part of writing the code. However, for achieving something using ASE, we(the developers) need a thorough understanding of the Shader pipeline.

    So, I am asking the developers of ASE (who are pretty good at it) to help me out, by guiding me in a general direction where I could learn about the shaders. Sorry for bothering you for such a silly reason, I just want to learn it from the best.

    Thank you so much.
     
  25. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    353
    By the by -- regarding the new toggle options, is that a feature that is coming in the next couple of days? I don't in any way mean to be pushy, I'm just trying to plan my week. I don't want to implement the features in four copies of shaders one way to just have to turn around and then redo that when the toggles are out. Since you guys seem to have a pretty insanely fast turnaround time on lots of smaller features like that (I think it's small?), I was guessing it might be soon and thus I'd be better served by waiting.

    Anyway, just trying to plan, like I said.

    Best,
    Chris
     
  26. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I think you only really need a general view of how everything works in order to work with ASE, otherwise we might be failing at something, there are quite a few tutorials about shader in unity on youtube. We also have a few older ones about ASE and we are now creating a different batch which start out explaining some fundamentals about rendering

    (new, rendering introduction only for now, might be a good place to start )
    http://amplify.pt/unity/amplify-shader-editor/tutorials/ (ASE specific, very old, might still have a some useful information)
    https://www.youtube.com/channel/UCEklP9iLcpExB8vp_fWQseg (various different shaders explained, some in more detail than other)
    https://en.wikibooks.org/wiki/Cg_Programming/Unity (tons of useful information in written format, might be a good place to start)
    I'm sure there are a lot more, even here in the forums, its kinda hard to point to one direction only and thats one of the reasons we are doing our own tutorials. Still, I reiterate, unless you really want to for whatever reason you shouldn't (and hopefully, you don't) need to learn about coding them to use ASE.

    No harm in asking ;) we'll be doing a build today to fix some urgent stuff for some users but those toggles wont be in it. I would say the toggles should come by the end of the week.
     
    x4000 and DiggingNebula8 like this.
  27. DiggingNebula8

    DiggingNebula8

    Joined:
    Oct 2, 2016
    Posts:
    21
    There's nothing wrong with ASE; it is a brilliant plugin. As a 20 years old rookie programmer, I want to learn and understand how things work internally. Presumably, learning C++ and OpenGL is a reliable way, innit?

    P.S: Question from my designer; Is Metallic/Roughness workflow already integrated into ASE? (Or should I just use One Minus node before smoothness input)
     
  28. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    353
    Cheers, thanks for the heads up on likely timetable, that helps quite a bit. :)
     
  29. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Yes, it's integrated, you only need to switch which workflow you are using in the main left panel from the "Light Model" dropdown and switch between "Standard" and "Standard Specular" where the first one is the metallic workflow, the output ports of the masternode will adjust to the corresponding workflow.
     
    DiggingNebula8 likes this.
  30. Amplify_RnD_Rick

    Amplify_RnD_Rick

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

    We've just uploaded a new build on our website.
    Here are the release notes.

    Release Notes v1.4.0 dev 01:
    • Fixes:
      • Fixed issue with 'World Space Light Pos', 'World Space Light Dir' and 'Object Space Light Dir' nodes
      • Fixed issue on 'Texture Coordinates' node forcing a sampler to be picked even when none was selected
      • Fixed issue on 'Indirect Diffuse Light'node ignoring the tangent space normal completely
      • Small fix to shader functions so they can refresh their custom include list properly on change
    • Improvements:
      • Added node previews for 'Light Attenuation' and both Indirect Light nodes
      • Added explicit call to Unity Editor ShaderUtil on Material Inspector to prevent class issues
      • Added Dependencies List on the Output Node properties
    Happy shader creations!
     
    marcatore, DiggingNebula8 and x4000 like this.
  31. TheNathanParable

    TheNathanParable

    Joined:
    Mar 21, 2014
    Posts:
    17
    Hey, I was playing around with the included Toon Shader example and making some alterations to it (such as adding normal maps and changing the way light attenuation is used so that I could get cel-shaded shadows), and I decided to turn on tessellation to see what would happen, and this is what I got.

    AmplifyTesselation.PNG

    No matter what settings I use, the model ends up looking broken. What's causing this, and is there any way to fix it? The model is the anime maid available for free from the asset store.
     
  32. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    Thanks very much. That does actually get everything working as expected (and that weird ghosting effect is gone as well). I haven't checked yet to see what the performance impact is by removing the Vertex to Frag node. Is that really the only way to get HxVL compatibility along with tessellation? If the performance impact isn't huge, then I guess we won't worry about it.
     
  33. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    Maybe it's me but I can't find a very useful option, in the manual or in the editor : export the node graph as an image. Is it hidden somewhere?
     
  34. rekka3000

    rekka3000

    Joined:
    Feb 9, 2014
    Posts:
    46

    Thank you!

    I've managed to replicate the shadow weighting of vertex color and shadow map texture as shown in the shader. I've now moved on to replicating the other functions.

    I'm trying to replicate this piece of code

    Code (CSharp):
    1.  
    2. NdotL -= s.ShadowThreshold;
    3.         //NdotL -= s.ShadowThreshold;
    4.         //NdotL -= 0.2f;
    5.         half specStrength = s.SpecularIntensity;// = 0.1f + s.SpecularIntensity;// > 1 = brighter, < 1 = darker
    6.         if (NdotL < 0) // <= s.ShadowThreshold)
    7.         {
    8.             // this line is important for added shadow layer, eg the darkest shadow
    9.             if ( NdotL < - s.SpecularSize -0.5f && specStrength <= 0.5f) // -0.5f)
    10.             {
    11.                 c.rgb = s.ShadowColor *(0.5f + specStrength);// (specStrength + 0.5f);// 0.5f; //  *s.ShadowColor;
    12.             }
    13.             else
    14.             {
    15.                 c.rgb = s.ShadowColor;
    16.             }
    17.         }
    18.         else
    19.         {//this next line about specular size is important for highlights
    20.             if (s.SpecularSize < 1 && NdotL * 1.8f > s.SpecularSize && specStrength >= 0.5f) //  0.5f) // 1.0f)
    21.             {
    22.                 c.rgb = s.BrightColor * (0.5f + specStrength);// 1.5f;//  *(specStrength * 2);// 2; // lighter
    23.             }
    24.             else
    25.             {
    26.                 c.rgb = s.BrightColor;
    27.             }
    28.  
    29.         }
    30.  
    The && operator is stumbling me, I'm obviously not a coder, but how would I replicate something like this code? I've tried to replicate it by doing a bunch of comparison nodes, if nodes and basically a checksum where if for example SpecSize is less than 1, AND the NdotL * 1.8 is more than the SpecularSize AND also Specular Strength is equal to or greater than 0.5, each one is plugged into a comparison node that gives a value of 1 if true and 0 if false, I then add all the numbers together for each comparison (in this case the total should be 3?) and say if the incoming number is three, output the diffuse texture multiplied by spec strength (that’s been multiplied by .5).

    This doesn’t seem to work. :( I’m sure there is a proper way of doing it, so if you could suggest anything that would be really helpful
     
  35. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    question... are we able to create post process shaders in ASE?
     
  36. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    I noticed the Lerp node doesn't linear output but a kind of exponential is it the normal behaviour? Is there a way to get linear values?
    I'm interpolating UV coordinates but the output image is curved.
     
  37. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Are you perhaps using the keep quads options in the model importer? Unity' default tessellation algorithm uses triangles only.

    Unfortunately for the time being yes, thats the only option. We might try rewriting Unity's function at some point (don't even know if it's possible) to see if we can deal with the problem ourselves but I have no ETA on that. The performance impact will always depend on what the shader already does and your target platforms. The most reliable way to know is to compile two different versions and create a stress test in your platforms to see the impact.

    What do you mean? like taking a screenshot of the whole graph zoomed in? Isn't print screen enough?

    Yes! just select the post process template under the "shader type" option on the main left panel.

    The Lerp node is linear and most likely you are referring to the node previews, am I right? The previews render in the linear color space so unless you specify an sRGB texture the results will always show in Linear mode. Since UV coordinates are a linear value when you use them they look differently from the usual "photoshop gradient" but they are still correct and produce the correct outputs. The only time this might not be the case is when you mix up sRGB textures with Linear values which are very rare and in those cases you use either Linear to Gamma or Gamma to Linear nodes (check links for images). If you share your setup I can properly tell you whats happening.

    Haven't look at it yet, gonna do it today.
     
    rekka3000 likes this.
  38. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Maybe I'm misunderstanding your issue but can't you do something like this?
    Unity_2017-12-06_10-56-33.png
    In this case I'm using a texture to drive the blending but it could be something else. I know you said no blending but I don't understand why not, if what you are looking for is a low poly look then you can always paint the mask in the vertices in your software and you would replace the texture sample in this image by the vertex color node. Then the blending would become hard edged.
     
  39. rekka3000

    rekka3000

    Joined:
    Feb 9, 2014
    Posts:
    46
    No problem :) Sorry if it sounds like I'm being pushy, just interested to delve further into the shader stuff. Messing about with this stuff is fun but also very tiring! Lots of new stuff to learn.
     
  40. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Hi, I'm not talking about preview but output itself:



    ase_deform.png
     
  41. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Can you send me your sample? I'm having a hard time figuring out what's connected to what with just that image. Are you sampling a gradient using the UVs? why not used the UVs directly?
     
  42. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    I use a texture gradient because I need more control on intermediate places.
    Ok, I will try to isolate the problem and upload a sample.
    Thanks!
     
  43. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    The output is the same (exponential) even using UV:
    ase_deform_iso.png
     
  44. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @Amplify_Paulo : did you saw my question about the screenshot function ?
     
  45. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I'm not sure what you trying to accomplish but that exponential growth is happening because you are forcibly creating that exponential, there's no issue with the lerp node. The way it is setup right now you are linearly interpolating between two differently scaled versions of the U coordinates using the V coordinate, in other words, the higher V is the slower U grows, but since U has been scaled linearly as well and V is not constant you get a second degree function.

    Is perhaps this what you want?:
    Unity_2017-12-06_17-07-49.png
    I did, and I did "answer" you.
     
  46. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @Amplify_Paulo : oh sorry, I didn't saw it (scrolled too quickly the web page at work...)
    The idea would be to export the node graph as a PNG. When the graph is big, if you want to have all of it on-screen you need to de-zoom, and it's difficult to keep it legible when using only the 'print screen' key.
     
  47. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    @rekka3000
    So I didn't had the time to check out the point lights yet, in fact I'm not sure exactly what kind of "support" would you need from point lights, like what you expect to see from them? Either way, for now, here's the full conversion, maybe you can explorer the point light support in the way you want now. Adding support for more vertex color channels should be much simpler as well.

    Also, I added an extra goodie, open up the shader to see what I mean if you don't guess it from the image already :p

    Unity_2017-12-06_17-22-24.png

    I has become apparent from this example that we definitely need a new outline port :\
     

    Attached Files:

    KRGraphics likes this.
  48. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Hi, I need an output like the that one:
    ase_chec.png
    a interpollation between the lower side (original) and the top side (stretched 2x).

    I can't find a solution for my self, can you help me? ;)

    Thanks!
     
  49. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    I've found the solution:
    ase_deform_iso_solved.png
    Seems I don't need a Lerp for that kind of output.
    Thanks you very much!
     
  50. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I guess that's another way to put it, I actually shared with you a possible solution using the lerp node, check above.