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

    luellasfpg

    Joined:
    Jan 23, 2019
    Posts:
    16
    Hi, another question, can we use shared samplers in Amplify? A google search from Feb says it's not implemented yet but I'm wondering if there has been any progress recently.

    e.g this stuff
    UNITY_DECLARE_TEX2D(_MainTex);
    UNITY_DECLARE_TEX2D_NOSAMPLER(_SecondTex);
    UNITY_DECLARE_TEX2D_NOSAMPLER(_ThirdTex);


    Edit: nvm asked on the discord and it's a no as of now! I would like to see this added eventually I think it would be really helpful in many other cases too. Thanks though :)
     
    Last edited: Aug 14, 2019
  2. artanist

    artanist

    Joined:
    Oct 28, 2014
    Posts:
    5
    Hello, I am currently using the Lightweight PBR shader type and I was wondering if the 'Alpha To Coverage' option will be available in it or if it one restriction to create shader in LWRP. Thank you
     
  3. BananaMcMuffin

    BananaMcMuffin

    Joined:
    Jan 13, 2018
    Posts:
    1
    Hello, I'm creating a grass shader. It uses an opacity mask and is set to transparent cutout as well as using vertex offset and various other effects.

    But, how do I get it to receive shadows. To my knowledge, the receive shadows option won't work with transparent cutouts, but I have seen other amplify grass shaders that are able to receive shadows. Is it possible to sample the shadow coordinates of the screen space using Amplify? Ideally, I would want to be able to choose the color of the shadow, so returning a float by sampling the shadow coordinates would be ideal, but I'm open to any solution.

    Thanks in advance
     

    Attached Files:

  4. ayk

    ayk

    Joined:
    Nov 14, 2013
    Posts:
    54
    Hey there, I'm trying to create an unlit shader that also adds a single-pixel outline to a model. Anyone know how to go about doing this? I'm totally stumped.
     
  5. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    Unity's shader compiler is smart enough to see what variables are being used in each permutation and optimize it, so although the computedColor is generated over the shader, it will only have impact on the permutations that actually use it.

    So Unity can be a bit tricky on certain situations. So for the shadows to be properly generated, the sampler property you use must match the one used by Unity's replacement shader when calculating the lightmaps.
    On the Albedo texture sampler you can maintain the Name but the Property Name must necessarily be _MainTex.

    By looking at your shader there's at least something I don't quite get and is its the usage of the World Position node. You are calculating an object to tangent transform matrix, but then you are multiplying it with a world position.
    Can you let us know a bit your train of thought over what you have done?

    What most likely is happening is that you have another class on your project called Path which is not on a proper namespace.
    When this happens the compiler gets confused on which class it should actually use.
    Can you please confirm this?

    Yes I can confirm on what as been told to you over our discord. We do have plans to implement this but still haven't got the chance to do it.

    We haven't tested the Alpha To Coverage option under the Lightweight RP environment so I can't let you know for certain if it works as it should.
    Because of that we haven't added that option over the Lightweight template. For now you must manually open the shader and add the AlphaToMask On option right under the SubShader Tags declaration.
    Please let us know how it goes.

    By looking at your shot the only thing you need to is, you need to do is go to your Render Queue dropdown (under the Blend Mode area) and set it to Alpha Test.

    We have an Outline node on our Standard Surface Shader Type. You can use this Shader Type and set its Light Model to either Custom Lighting or Unlit.
    This Outline node extrudes your object according to the value you specify over the Width input port. You can play around with it to have the result you desire.
    Besides that you can create an outline via a post-processing effect. For this one you can check our Sobel example, which may be a good starting point.
     
  6. bigbenmatt

    bigbenmatt

    Joined:
    May 30, 2019
    Posts:
    10
    Hiya

    i'm having problems with the scale factor of a Normal Texture sample? It won't scale to 0,0,1. Latest amplify with Unity 2019.1.12f1

    NormalScaleIssue.PNG
     
  7. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    Hey,
    I've run some tests on my end across multiple Unity versions and everything seems to be working as expected when modifying the Scale input port.

    Can you let me know which steps you took in order to break the node?
    Also, if applying the respective material into an object, are the scaled normals also broken in the object itself?

    Just to be sure what you mean when you mention it won't scale to 0,0,1, what are these values you're referring to?
    From the screenshot I assume these are the Min,Max and Default Values of the Float node.

    I've also noticed that you're working on Shader mode so these values you are setting will be written as the property's default value and not set on the material itself.
     
  8. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,040
    Hey Folks,

    In the HDRP template, I notice the Offset Factor and Offset Units are not available under the Depth rollout. Is this forthcoming or a limitation?
     
  9. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    85
    Thanks, worked! Seems a little obscure sooo... For future searchers....
    Static Mesh Renderer of Amplify Shader with Opacity Mask Not Casting Baked Shadows: Fixed
     
  10. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    22
    Hello! Been using Amplify and loving it but right now I'm kinda stuck and have spent too much time trying to solve it myself.

    I'm working on a Terrain shader with custom lighting. I've managed to make both FirstPass and AddPass shaders work with Lambert lighting. The problem is when I want to modify them to use Custom Lighting because the terrain shaders use a special surface option called finalcolor:SplatmapFinalColor.

    I found out that this function is inside Unity's built-in shaders in a file called TerrainSplatmapCommon.cginc. I've already tried to include this file in my shader and it doesn't work cause that file already uses it own Input struct and that messes up with the Input struct that Amplify generates.

    I'm leaving here a screenshot of both my shaders which use the same ShaderFunction called ColorfulTerrainCustomLighting. This shader function basically reads a mask to denote which parts of the terrain are colored. I want to be able to add my own lighting code to ColorfulTerrainCustomLighting.

    Oh and if I don't use the finalcolor:SplatmapFinalColor the AddPass won't work correctly :/

    Please help me I've been struggling with this the whole weekend.

    firstpass.png add pass.png colorful custom lighting.png console.png


     
  11. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    Not really.
    Hey its not really a limitation. We usually use Unity's own template structure to create our own ones and there they don't have that setup exposed.
    We'll register your request and add it on a future build.

    Yes I agree, this isn't an obvious solution. We need to understand a bit how replacement shaders works and when they are used.

    You can declare your own SplatmapFinalColor function so you can use your own structures.
    If you take a look into our SimpleTerrain example you'll notice that we declared the SplatmapFinalColor directly on our shader.
    That SplatmapFinalColor node is a custom expression which is marked to auto-register and its input port types are set as custom so we could define the proper input and output structures.
    The function name is set by the Custom Expression name and it can be whatever you want, as long as you then properly register it over the Additional Surface Options ( much as you are already doing it over your shot ).
    P.e. if you name your custom expression MyCustomFinalColor, then on the Additional Surface Option it should be finalcolor:MyCustomFinalColor.
     
  12. Polygonmaker

    Polygonmaker

    Joined:
    Nov 18, 2013
    Posts:
    31
    Hello,

    I am trying to create a shader to use Object-Space Normal map.

    Unity HDR pipeline allows to use it.

    I was wondering how I could do the same with the default pipeline in Unity using Amplify Shader.

    Thanks for your support

    Fabio
     
  13. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    132
    Hi. I just purchased ASE yesterday and am getting going using it in my project. I've been using ShaderGraph, but haven't been entirely thrilled with the final results there. I am attempting to create a toon shader that I can then animate the vertices on for vegetation. I can't imagine that it is something that should be that difficult. I'm targeting LWRP in Unity 2019.2. I figured that the easiest way to start would be to take the CustomToonLighting example included with the asset and change it over to LWRP. When I do, I get a warning in the Light attenuation node that a shadow caster pass is need in the template. Is there an easy way to add that?

    Also, I'm hoping to be able to use the normal correction sample for the animated vertices. I'm targeting mobile devices, so is this something would wind up being to intensive for newer mobile devices?
     
  14. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    So if you are using the default pipeline Standard Shader Type then you necessarily have to plug a tangent space normal into its Normal input port. But you can p.e. use an object space normal map and then use the Transform Direction to transform its result from object to tangent space.

    Glad to have you on board! You can ignore that warning since our Unlit LW Template does contain a shadow caster pass and that node is correctly working over there.
    Regarding your second question, this really depends on how expensive is the way you are using to modify the vertices since you'll also need to use two more times to calculate the new normal vector.
    Usually when dealing with grass you can usually get good results without having to reconstruct its normals and have them p.e pointing up.
     
    Last edited: Aug 20, 2019 at 12:14 PM
  15. Tracecat

    Tracecat

    Joined:
    Mar 20, 2014
    Posts:
    14
    Hi!
    Just tried to create a new HD Lit shader in Unity 2019.2.1f1. But I get " invalid subscript 'worldToTangent' " errors in the shaders inspector window. The shader itself is just the master(gbuffer) node without any other nodes...Maybe the new Unity version broke something?
     
  16. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    Can you let us know which ASE version are you using? Is it the v1.6.9rev002 from our website?

    EDIT: If not, can you please download this version and reimport the HDRP templates ?( only if if our template auto-importer doesn't import the new HDSRPTemplates.unitypackage )
     
  17. Tracecat

    Tracecat

    Joined:
    Mar 20, 2014
    Posts:
    14
    Wow that was fast! Thx! Updated to rev002 (had rev00) and it works now! Maybe the version on the Unity Asset store should be updated, as that's where I had the rev00 from and there was no futher update available...
     
  18. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    22
    Hey! thanks for the super quick reply!!
    So... I checked the thing you mentioned about the custom expression. I added a custom expression for the final color function called CustomCustomFinalColor and changed the output type to the same output struct Amplify spits out when using the Custom lighting option. It's called SurfaceOutputCustomLightingCustom (had to check the shader's code to know the output struct's name). I changed the surface option in both my shaders to use CustomCustomFinalColor and the error went away but now my terrain looks completely black (ignore the grass that's another shader). Am I doing something wrong here?

    first pass.png final color expression.png terrain.png
     
  19. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    Yes, we usually update the Asset Store after gathering a couple of updates from the versions on our website.
    For us, having that website version is a way to, if needed, give you guys new builds as fast as possible without having to wait for Unity's approval process when submitting a new build into it.

    If the terrain gets black what's most likely to be happening is that your SurfaceOut.Alpha is always 0 thus when applying the final color calculation it is getting always black.
    How are you calculating that Alpha value over your shader function?
     
  20. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    22
    Well the only way I use the Alpha is with the FourSplatFirstPassTerrain function. I simply output its alpha node to the opacity port in the master node. Maybe when setting the shader for custom lighting the alpha is not set on the FourSplatFirstPassTerrain function?

    Apart from that I use the StandardSurfaceLight node to replicate unity’s standard lighting and then output it to the custom lighting port in the master node. The same code that generates the Albedo part of the shader worked fine with Lambert lighting so I assume the issue isnt there.

    Btw is there a problem with me using FourSplatFirstPassTerrain function in both the FirstPass and AddPass shaders?
     
  21. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    379
    Hi, I'm curious about the relationship between ASE and ShaderGraph on Unity HDRP, are they using the same API behind the scene? My project suffers from SG Lit master node, it could take up to 3-5 mins to strip/optimize for each build, which is not ideal. I would like to know does ASE have the same problem as well?
    Another question is would ASE support feature that SG currently doesn't have, say Stencil buffer?
     
  22. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    Could the nested static/function switch within a shader function node to be exposed to the outside user?

    For example if I create a shader function 'Function_A' with an function switch named 'options_a' then I put it into another shader function 'Function_B'. When I add this 'Function_B' into my final shader I want to change the value on the 'options_a' of the instance of 'Function_A' in the instance 'Function_B'.
     
  23. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    396
    Ok so I tested out our Simple Terrain with Custom Lighting and got the same result as you do. The problem here is, when we are doing custom lighting the Alpha of that SurfaceOutputCustomLightingCustom is not being written thus the final color process fails.
    This, however, is by design since on Custom Lighting we do not want to write data on that structure since all lighting calculations are done via what is set into the Custom Lighting port.
    But don't worry as there's a simple solution, you need to to remove that finalcolor:SurfaceStructure option from the Additional Surface Options and manually do that multiplication of the final color value by the alpha before setting into the port.

    Something like this:


    You can check a modified version of the Simple Terrain over here. Please notice that importing this package will rewrite the original sample.

    Regarding the FourSplatFirstPassTerrain shader function question, yes you can use it on both First and Add passes. You can notice that we are using it on both our SimpleTerrainFirstPass and SimpleTerrainAddPass shaders on the SimpleTerrain sample.

    Sure, that's a pretty valid question. We are using Unity own HDRP API and our templates are based on their templates for each of their types of Master Nodes ( Unlit, PBR, Lit ).

    On our end you do however have access to each pass that is being used/written into the shader and you can select a couple ones out.

    P.e. if may not want the Motion Vectors or the Meta pass, so you can select those ones out.



    This will decrease shader compilation times.

    One other thing you can do, but this is on a much more advanced level, we do give you guys access to our templates as they are default hlsl shaders with some ASE special tags. You can open the template and customize it to your needs, remove unwanted keywords and this way decrease the amount of permutations.

    Regarding Stencil Buffer operations, our template system allows them. But in the case of HDRP we did not exposed them since each pass in HDRP requires a specific stencil buffer setup to properly work.

    Hum it's a really neat idea but I really don't know if this would make much sense ( depending on how you want to modify them ).

    Changing the value of a Static Switch is Enabling/Disabling keywords which is something that is not controlled via shader operations or properties.

    On ASE we do have that UI on the node to change the values, but what we are doing internally is enabling/disabling that specific keyword.

    How were you thinking on exposing those options on the upper shader functions? Maybe list the available switches on the SF Node Properties window?
     
    zhuchun likes this.
  24. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67

    I'd like to wrap a set of nodes into a reuseable shader function and each shader function would provide several options, functon switches, for different purposes. Then I'd like to wrap them into a larger shader function.

    For example:

    My_Final_Shader_1
    + Use a shader function 'Function_B'
    |--+Use another nested shader function 'Function_C'

    My_Final_Shader_2
    + Use a shader function 'Function_B'. And I want to change the opitions on this Function_B to be different from the 'My_Final_Shader_1' which is doable.
    |--+ Use another nested shader function 'Function_C'. And I want to change the opitions on Function_C to be different from the 'My_Final_Shader_1' which is not doable.
     
  25. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    22
    Thank you for the answer it worked perfectly!!!