Search Unity

  1. Unity 2019.2 is now released.
    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. DannyHuskWildMan

    DannyHuskWildMan

    Joined:
    Apr 26, 2019
    Posts:
    2
    Can anyone explain how i'd recreate Substance Painter's (Balance, Contrast) in ASE? I have all these textures masks and i want to balance/contrast them exactly how i would in SP. I know this is doable but for the life of me i cant get this to work? I've tried using REMAP, i got close results but it's still not the same. Dying for help on this, i'd create this as a shader function and use this EVERYWHERE.
     
  2. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    I made a shader function which expects a texture object such as
    upload_2019-6-7_9-47-54.png

    When I add it to a shader it was auto declared in the material properties which is it supposed to be
    upload_2019-6-7_9-49-9.png

    However, if I add more than one such function into the same shader there would be ONLY ONE such texture properties.

    upload_2019-6-7_9-54-47.png


    How can I have more than one such function with isolated properties one for each?
     
  3. JavierDuranSn

    JavierDuranSn

    Joined:
    Oct 4, 2018
    Posts:
    1
    Hi,

    I'm trying to make a subsurface effect. I'm getting the light vector, camera view, etc. but it seems to work only with Custom Light mode. In Standard, the light vector is not working, and in Custom Light the Smoothness and Normal inputs are disabled.

    So, how can I make this effect work with Smoothness and Normal?
     
  4. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    This is not very intuitive over the HD Lit template, but after you select the Transparent option over the Additional Options groups you need to go also to the Blend Mode options ( inside the SubShader foldout ) and select Alpha Blend on the Blend RGB dropdown.
    We'll make this extra step to be automatically done over a future build.


    I'm not familiar with how Balance and Contrast behaves on Substance Painter. Is it possible for you to share additional information? Possibly some shots so I can try to figure what they might be doing?

    Unfortunately you can't.This is working as expected.
    Shader property names on Unity must be unique, so on the second time you use the shader function, ASE will detect the property is already registered and won't register it again.
    For you to have two different texture properties using that shader function you'll need to do something similar on what you have over the Texture Coordinates node. Create a Function Input node, set its Input Type as Sampler 2D and connect it to the Tex port over the Texture Sample node.
    Then over the shader, create two separate Texture Object nodes and connect them to each shader function

    This is quite strange. What light vector node are you using so we can do some tests on our end?
    Regarding Custom Lighting, on this mode you are responsible for doing all the lighting calculation thus the Smoothness and Normal inputs are disabled.
    We do however give you access to the Standard Surface Light node when you are working on Custom Lighting which calculates lighting similarly to the Standard Surface and will give you access to the Smoothness and Normal ports.
     
    Gollunk likes this.
  5. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    We have also uploaded a new build into our website.

    Here are the release notes:
    Release Notes v1.6.7 rev 06:
    • Fixes:
      • Fixed multiple issues on 'Custom Expression' node
        • Fixed layout issue when writing input names
        • Fixed issue on updating InOut/Out ports when reordering inputs
        • Fixed custom loading issue on void Output or Call mode when no inputs are declared
        • Fixed issue where user could set main output type as OBJECT type
        • Fixed incorrect text replacement on Call mode code
        • Fixed Custom Types not being correctly declared
      • Fixed compilation issues both on HD Lit and PBR when WRITE_MSAA_DEPTH directive is used
      • Possible fix on VR issue with Lightweight RP
      • Possible fix on issue with Unlit template when using Single Pass Stereo VR
      • Possible fix on issue with 'Grab Screen Color' node when using Single Pass Stereo VR
    • Improvements:
      • Added Variable Mode to 'Grab Screen Color' node
      • Added new Alpha port on 'Blend Operations' node to enable a more layered like behavior
      • Added support to SRP 5.16.1
    @themdubs our Grab Screen Color node is now using Unity defines on both declaration and fetch. We also updated the Unlit template to correctly set the stereo info. Please let us know if now everything is working as intended on your end.

    @SF_futurlab we've reviewed the Blend Operations node and it seems to be working as expected. We did however a slight change to the node and added a new Alpha port so we could have results similar to what you see on Gimp or Photoshop.

    The way it was now, the blend operation was done over all channels (RGBA) indiscriminately. But when applying a blend operation on two layers over p.e. GIMP, if the top one has transparent pixels then it gains the color from the layer below on these pixels and no blend will be made on them.

    So now you can have that behavior. Taking the Overlay for example, here's on GIMP:

    OverlayTestGimp.png

    and on ASE using the new Alpha port.

    OverlayTestASE.png

    Hope you guys have a great weekend and happy shader creations!
     
    Last edited: Jun 7, 2019
    Gollunk likes this.
  6. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    Yes, i did search a lot and try all the options in the HD Lit template to understand. The Alpha channel work for this kind of effect, but now i can't find any option for a double sided effect (as i need a cap for the liquid volume effect). I tried with the cull mode (switch from back to front) but it make the lights not applied on it when front is active. Also i'm experiencing a strange effect (artifacts) on the material when it's behind a transparent material (a window from the unity's standard HDRP shader).
     
  7. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    84
    Hello,

    I need to make volumetric sand on the terrain.
    I use a mask to determine where the sand should be, and where not.
    I use the sample: SimpleTerrainFirstPass

    How can I make the terrain work with the offset of the vertices according to the mask?
    I turned on the tessellation and indicated the mask in Local Vertex Offset.
    upload_2019-6-7_23-33-0.png
    Forward rendering:
    Vertices shifted, but all the shadows remained in the same place:
    upload_2019-6-7_23-31-16.png
    Deferred rendering:
    The displacement of the vertices had no effect on the normals and the self-shadowing:
    upload_2019-6-7_23-32-21.png
    Also, in both cases, the part of the terrain that is not visible without the displacement of the vertices is cut off:
    upload_2019-6-7_23-31-32.png
    It seems this problem only occurs with terrain:
    upload_2019-6-7_23-39-37.png
    Can you please tell me how to add the offset of the vertices on the terrain?

    I use Unity 2019.1.3f1, Linear space.

    Thanks.
     
  8. pxlweaver

    pxlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Hopefully I'm just missing something obvious here, but I get a "undeclared identifier" shader error when I check on "use texture array" on the triplanar sampler node.

    Attached a screenshot (yes, the screenshot is a slightly older version of Amplify, but I tested the latest and it happens there too):
     

    Attached Files:

  9. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,357
  10. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    Is it possible for you to share a small sample to us via your support email ( support@amplify.pt ) so I check it out and see what might be happening?

    By default this sample is using the Unity's terrain shadow caster to cast shadow through the Fallback "Nature/Terrain/Diffuse" shader.
    However if you toggle the Cast Shadows option over the Output Node properties then it will use our own custom shadow caster and the final results should be corrected.

    What's happening there is that your Texture Object node is set to be a Texture 2D and the Triplanar Sample node is set to receive a Texture Array.
    You can force your Texture Object node to be a Texture Array by either drag and dropping a texture array on top of it, or go to its Auto-Cast Mode, set its value from Auto to Locked To Texture 2D Array ( and back to Auto, if you want it to maintain its auto-adapt behavior).

    Not all our samples can be converted to SRP.
    P.e custom lighting samples cannot be converted to HDRP as we haven't been able to convert some of our custom lighting nodes (Indirect Specular Light and Light Attenuation ) into that specific SRP.

    Also, samples containing the Outline node cannot be converted to SRP as this node adds an additional Outline pass which we still don't support on our template based shaders.

    The samples that you can convert, you need to check parameters like the shader Render Type, Render Queue and Blend mode as these are not copied when switching between Shader Types.
     
    pxlweaver likes this.
  11. JGeigerMammoth

    JGeigerMammoth

    Joined:
    Apr 12, 2018
    Posts:
    2
    Hello, I hope this is the right place to ask.

    I'm trying to create a post process stack shader that accesses the camera depth texture. Problem is, this is for a VR game using single pass stereo, and no matter what I try and where I look it seems like I cannot properly map the depth texture to the player's eyes, and both eye's depth appear in both eyes, and I cannot figure out how to properly access each eye's index (unity_stereoeyeindex always returns zero). Looking at the PPStack template shader, it looks like the code to make it work in stereo is there, but I must be missing something on using it properly.

    I've tried the following:
    • Using screen position, which is mapped to both eyes individually and not across both, which is what I need
    • Using texture coordinate index 1, which the shader template seems to try to address as a stereo UV across both eyes, but that appears to return the exact same UVs as index 0.
    • Using the typical UVs and adjusting what it shows based on the eye index, but as I mentioned above that doesn't appear to work.
    • Adjusting the template to call the macro's that unity references mentioned here, but either it's not working or I'm doing it wrong (I don't fully understand shader code)
    Any help would be great, I'm willing to try anything at this point.
     
  12. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    Hello,

    Here is the shader file i'm working on : https://drive.google.com/open?id=1gFz1Rmqu6qd8JXybAdIP7MQeCWLymWUk

    1) I'm trying to achieve a fake liquid volume with no culling mode and a "switch by face" node to make a fake light on the top of the volume. But to achieve that i need to use the HD unlit shader type to make the illusion that the top is a full surface and i can't find a way to make the alpha channel work with this shader type.

    2) Alternativly, and for a best result i would like to use the HD lit shader type and my idea (but i don't know exatly how to achieve this) is that i could select the top vertices of the cylinder mesh (from the UV coordinates ? I don't know) and move them with a simple physic way according to the movement of the container (vertex displacement ?). I think that vertex displacement could work as i see that it's possible to select specifics vertices with a map :


    Thanks a lot !

    PS : I just noticed that rotating the top face will deform the mesh on its sides, so the second solution is maybe a bad idea...
     
    Last edited: Jun 11, 2019
  13. pxlweaver

    pxlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Ahh see I was missing something simple. Thanks! FWIW, it is set to Auto by default and I was getting the error with Auto. Setting it to be Locked to Texture 2D Array fixes the error.
     
  14. jura_wd

    jura_wd

    Joined:
    Jan 28, 2014
    Posts:
    30
    Hey! I'm trying to port https://www.assetstore.unity3d.com/#!/content/26903 (made with Amplify Shader Editor) to HDRP 5.13.0 (latest supported version on asset store). So I installed proper HD templates and trying to replace templates in the Planets shaders. It works for simple ones. But for complex ones - I have tons of compilation errors, not known properties, etc. I don't think it shouldn't work, HDRP version is claimed as supported, Unity 2019.1.5f1 is used - also fine one.
    Could you please fix bugs for HDRP shader gen? Thanks!
     
  15. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    It seems to mostly depend of Unity as HDRP is still in preview.
     
  16. jura_wd

    jura_wd

    Joined:
    Jan 28, 2014
    Posts:
    30
    There are shader compilation errors. They have nothing to do with the state of HDRP. Amplify Editor should generate some valid shader output, no matter what the state of custom render pipeline is
     
    Last edited: Jun 12, 2019
  17. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    I have another issue (i hope that it's my fault else Amplify + HDRP will begin to make me crazy...). So, with a HD Lit shader type, i made a radial emission to make the illusion that energy is propaging along time.

    https://drive.google.com/open?id=1CS8zSqrl-wkJaNKdw2zDip9EtBCTCKF6

    It work but the idea is that the emissive texture should be rendered only from the multiplication with the radial system (so black should make the emissive totally transparent while white should make it totally visible). But if the emissive channel is active, the emissive texture is rendered even if it's black.

    https://drive.google.com/open?id=1IFYSFmycSnTCWHb5P_d_WdrjX80aoPQT
     
  18. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    Suppose I have such a shader graph which won't do a sample if the switch is off:
    upload_2019-6-12_22-8-15.png

    However, no matter what the status of the switch is the code of `vertex to fragment ` is always generated which may cause some unnecessary calculation:
    upload_2019-6-12_22-8-56.png
    upload_2019-6-12_22-17-19.png
    Could the `Vertex To Fragment` to be omitted if it's under control of a static switch?
     
    Last edited: Jun 12, 2019
  19. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    We reviewed the template and noticed that, although we are calculating the correct stereo coordinates, they are not being used by default on the template when fetching screen depth.
    We already modified the template so this is done by default and we will release this fix on our next build. But on the meanwhile you can do this:

    upload_2019-6-13_12-8-6.png

    The yellow selected node is a Template Fragment Data node. You will need to create one and select the texcoordStereo option.
    Concerning the shader the shader you sent, one of the issues was on the Blend Mode. Like I mentioned before for transparency to work it need to be set to Alpha Blend.
    The other issue was on both Render Type and Render Queue Tags (under the SubShader > Tags options), they both need to be set to Transparent.
    I've attached the same shader you sent with all these issues fixed.
    For the HD Lit template, the process is exactly the same.
    Regarding moving the liquid on a more realistic way I think you may always need to send at least the speed of the container from a script since you don't have access to that kind of info from inside the shader. The way on how to make the liquid mode, well that's tricky one. I would also need to investigate that myself.

    You can always find a more updated version of ASE on our website. You only need to input your ASE invoice number on the Unlock text area and hit its button.
    Over there we already offer support to HDRP 5.16.1.
    Is it possible to try our latest version version and let us know what type of errors are being thrown into the console?
    You are definitely right, on our end we must make sure that at least the generated shader doesn't have compilation errors. But one thing must be kept in mind, not all nodes work under HDRP since some data which is accessible to us over the standard pipeline is not under that SRP. (P.e. custom lighting nodes like Indirect Specular Light or Light Attenuation )


    Maybe this is because of global illumination. Have you tried maybe setting the Occlusion also to 0 on those areas so they won't be affected by it?

    This is a tricky one. Unity compiler already does some optimizations regarding calculations when using keywords but that specific case it seems to be always doing those vertex instructions.
    We'll register this case and what see what we might do under ASE to prevent it. Unfortunately I won't be able to give you an estimate on when we will be able to tackle it.
     

    Attached Files:

  20. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    Thank you for your help, indeed the transparency work now with the HD unlit. But as you can see on the picture below, the back face is not rendered properly (it depend of the position of the camera), also the bottom face is not rendered at all. For the illusion to work, these faces must be displayed with the same flat color (to believe that a surface is here).

    https://drive.google.com/open?id=1wpCmAJ3RTSJAkjQE66IizCxEO_bMO_OY

    That is the role of the "switch by face" node. The real top face is obviously not rendered cause the alpha is cutting into the mesh. But the bottom face is still there and should be rendered from the switch by face node.
     
    Last edited: Jun 13, 2019
  21. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    upload_2019-6-14_14-29-35.png

    Can the `RenderType` to be bind to some custom material properties, like the cull above, so that I could change the render type on the material instead of creating a new copy the same shader with just a little difference.
     
  22. Salim

    Salim

    Joined:
    Apr 25, 2011
    Posts:
    142
    Hello,
    I just installed Amplify Shader Editor in my project and I get 2 errors:
    Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs(464,60): error CS0117: `File' does not contain a definition for `Exists'
    and
    Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs(776,9): error CS0117: `File' does not contain a definition for `WriteAllBytes'

    Would you have any idea what could cause this problem? I'm on Unity 2018.4.0f1 and installing to a new clean project doesn't cause the issues.
    Thank you for the help!
     
  23. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    This is quite strange. I did some tests now with the HD Lit template using the Switch By Face node on a shader with transparency and Cull set to Off. The results seem to be correct so I'm clearly missing something.
    Can you pack me that a simple scene you showed and send me via our support email (support@amplify.pt) so I can check it on my end with your exact conditions?

    Unfortunately no as this is a Unity restriction. Neither the Render Type or Queue can be dynamical modified.


    What might be happening is that you have a class named File on your project which isn't on a namespace. Since the C# own System library also has a class with that name, a conflict is being thrown.
    You should find that class and place it inside a proper namespace.
     
  24. Salim

    Salim

    Joined:
    Apr 25, 2011
    Posts:
    142
    You're right! I feel stupid now. Thanks so much for the help :D
     
  25. JGeigerMammoth

    JGeigerMammoth

    Joined:
    Apr 12, 2018
    Posts:
    2
    Thanks for the response! However, it looks like I'm still having the same problem. In single pass stereo rendering, each eye gets their own UV instead of sharing one long one like in multi-pass. However, the camera depth texture is still rendered as if they shared one UV map, meaning if you try to map the depth texture to the eyes, each eye will see the depth of both eyes. I should be able to use unity_stereoeyeindex to correct the UV index manually, but that is always returning zero. The setup you shared above seems to do the same thing whether you choose texcoord or texcoordStereo, so is this more meant to allow UV charts in each eye (which single pass does by default) or am I just not doing it correctly?

    To Illustrate what I'm talking about:
    Expected UV result:
    Unity_2019-06-14_09-46-12.png
    Actual UV Result (Bottom is cropped a little bit, just the screenshot):
    Unity_2019-06-14_09-46-31.png
    And to show the issue I'm having, depth texture expected result: Unity_2019-06-14_09-51-07.png
    Depth Texture Actual Result: Unity_2019-06-14_09-51-20.png

    I hope this explains my issue more, I really hope I'm just doing something wrong and that this isn't impossible.
     
  26. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    I tried to export a simple package (cylinder + material + shader) and import it into a new HDRP project (so with the sames versions of Unity and HDRP) and the same problem occur. Tou can see from the package (and build) linked below. What versions did you use for your test ?

    Could the graphic card act on something ?

    https://drive.google.com/open?id=1a70pdddHI5u35aPHu_EvCrnzopaMypP4

    PS : It seems that the problem depend on the camera position and world position, so could it be due to the root of the shader (the part with the water level and wobble effect). However, i took this part from the liquid volume example from Amplify.
     
    Last edited: Jun 15, 2019
  27. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    The material has an interface named SetOverrideTag which could be used in the custom material editor.can this be integrated with ase?
     
  28. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    123
    Is it possible to increment a variable entirely in the shader over time(or whenever a certain criteria is met)? This is more of a general question about shaders, I would be down to editing my shaders by hand if I have to(after about 6 hours of searching I just couldn't find any information about this).
    So specifically I'm looking for something that would look like this on the CPU
    x += 0.01;

    And that's it, I want it to increment a variable by a certain amount each frame without the CPU(with a script it would be trivial, but I have over 100k meshes with this shader in my world and they all require per instance changes, I don't have the performance budget for an overhead like that).
     
  29. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,321
    Hey there,

    I guess it really depends on what you want to build but, if it's something over time without any external script input, you'll likely need to use one of the available time nodes.

    Learn more: Time Nodes

    Please do elaborate, thanks!
     
    Last edited: Jun 17, 2019
  30. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    123
    @Amplify_Ricardo I'm trying to make a spring system for interacting with vegetation, I want to store and manipulate the force on each spring(~renderer), I don't think the time nodes would help with this(at least not on their own). Currently I have a really backwards solution(I store the object positions that can interact with the foliage in a global array then I do a distance/direction check in shader to move the vegetation away, this works but I would like to implement a nice spring like movement when the plant is trying to go back to its resting place - worst case I can hack something together to kinda look like that by adding more points in the array, but if it's possible to increment a variable that only exists in the shader then I could make to act exactly like a spring).
    Is this even possible in a shader or is the data always lost at the end of the vertex\fragment program no matter what?
     
  31. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,321
    Hey there,

    If you can't get away with using Time or Position based nodes, you'll likely have to use something external as you cannot increment a shader variable in that manner.
     
  32. Pecek

    Pecek

    Joined:
    May 27, 2013
    Posts:
    123
    @Amplify_Ricardo that's super disappointing to hear, but thanks a lot for clearing that up - where were you when I spent half the night looking for this very specific answer.. :D
     
  33. Salim

    Salim

    Joined:
    Apr 25, 2011
    Posts:
    142
    Hello,
    I would like to use a function similar to Mathf.DeltaAngle in order to convert an angle back between 0 and 360. Is there any way to do that with the nodes already available?
    Thank you!
     
  34. Karan90

    Karan90

    Joined:
    Mar 19, 2019
    Posts:
    7
    Does Amplify shader fully supports HDRP pipeline now?
     
  35. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    No problem at all.

    This is quite strange. I did test again on my end and everything seems to be working as expected as you can see over the screenshot below.

    I'm testing on my end with Unity 2018.3.14f as on Unity 2019 the Mock HMD SDK seems to be bugged/having an incorrect behavior.
    This shot was taken over the new ASE build ( which I'll release soon ) and uses texcoordStereo internally.
    Can you let me know which Unity version are you using so I test on that exact version?

    Thank you so much for providing a sample.Whats happening over there is, because you have your shader set to write on the Depth buffer, when you see the cylinder from a top position, the faces that will be rendered are the ones closer to the camera occluding the ones that are behind them (even if their fragments are completely transparent ).
    For you to not write on the Depth buffer, go to SubShader > Depth > ZWrite Mode and set it to Off.

    We don't have plans on integrating this over or custom inspector. The Render Type tag only affects replacement shaders and it may not make much sense to have it changed over the inspector.

    You can maybe use the Fmod. This outputs the remainder of a division, so if you place the value 360 over the B port (the divisor), it should work similarly to Mathf.DeltaAngle.

    Amplify Shader Editor supports HDRP up to the 5.16.1 version. We provide 3 templates, HD Unlit, HD Lit and HD PBR which work similarly to the ones provided by Unity itself.
     
    Last edited: Jun 17, 2019
  36. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    @Pecek here's a neat sample that deals with grass.

    Maybe you can get some cool ideas for you project from it. Hope it helps.
     
    Flurgle likes this.
  37. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    Thank you but i tried it before and the problem now is that the bottom face is displayed above the faces on side... Moreover the same problem occurre about the displaying depending of the position of the camera. It seems that i can't do a simple thing like this with HDRP and Amplify.
     
  38. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    I understand your frustration and rest assured we're here to help. It's not as a simple problem as some would imagine.
    So this new visual issue is happening because since Cull and ZWrite is Off, you are rendering both Front and Back faces.
    This generates a conflict as the order on which each face is rendered changes leading to sometimes the faces that are drawn on top are the back faces and sometimes are the front. This is not a behavior specific to HDRP and ASE as it happens even in the standard pipeline.
    I've attached a modified shader of yours which is now writing into the depth buffer and is rendering the back faces. At a first glance it seems to be working as expected.
    Please let us know if this helps.
     

    Attached Files:

  39. Beauque

    Beauque

    Joined:
    Mar 7, 2017
    Posts:
    17
    Hello,

    I am attempting to make multi platform shaders where I can turn off unused texture slots and other components (for mobile platorms for example).

    Since we can't switch off inputs in the shader's Output Node, I am wondering if having a switch that outputs an integer = 0 instead of a texture into the Smoothness port (for example) of the Output Node is equivalent to having nothing plugged in this Smoothness port? I don't exactly know how ASE and surface shaders work internally and if they have default values anyway or no value at all when we don't plug anything.
    And if not, what does it really take in term of performance and optimization to have default integers instead of leaving the ports empty...?
     
  40. Gollunk

    Gollunk

    Joined:
    Oct 19, 2014
    Posts:
    41
    This is probably the best you can do. If my settings are correct, in this version there is only one flat color, not the surface one. As i said, the inside faces must be rendered with a different color to make the illusion work. I achieved this trick very easily with ASE and the standard RP, so something is wrong with the HDRP or with the HDRP compatibility of ASE. However, thank you for your great support.

    This is the one i edited with a surface shader type (from the ASE example) : https://drive.google.com/open?id=1CeUH-HKEQfQAka7OJlDtehD-nF1tzdnV

    This is what i need.
     
    Last edited: Jun 18, 2019
  41. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    419
    Yes, its the equivalent. If you don't connect anything into a certain input port we internally set a default value into it.
    P.e. on our Unlit template, if you don't connect anything to the Frag Color input, we set it with a white color( fixed4(1,1,1,1) ).
    Code (CSharp):
    1. finalColor = /*ase_frag_out:Frag Color;Float4*/fixed4(1,1,1,1)/*end*/;

    Thank you for supplying the shader. I'll take a look into it as soon as I can and will let know my results on the HDRP conversion.
     
  42. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    676
    Is there any way to use the finalcolor modifier with Amplify Shader Editor?



    So far I'm hacking the shader output which works fine, but it's a bit annoying.
     
  43. rcazzy

    rcazzy

    Joined:
    Jun 7, 2014
    Posts:
    6
    Hello, I am have an issue using the Vertex Position node on the single axes. The node seems to put the Y axis at a 45 degree angle as ppposed to straight up/down vertically. It occues with both custom objects and Unity default meshes. My object rotation transofrms are at 0, and scale is at 1. I have looked at the Normal Extrusion sample shader, but when I try to switch to one axis, it has the same effect of skewing as show below.

    It is based on the Transportation shader by PolyToots here:


    Thank you for your help!

    upload_2019-6-19_23-16-44.png
    upload_2019-6-19_23-17-11.png
    upload_2019-6-19_23-17-37.png
     
  44. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    I have a two pass template and add the same ase_pass_options to each of them such as:

    Code (csharp):
    1.  
    2. /*ase_pass_options:Name=Additional Options
    3.     Option:Split Alpha,InvertActionOnDeselection:Off,On:Off
    4.     On:SetDefine:_SPLIT_ALPHA 1
    5.     Off:ShowPort:Color
    6.  
    7.     Option:Clip,InvertActionOnDeselection:Off,On:Off
    8.     On:ShowPort:Clip
    9.  
    10.     Option:Vertex Offset,InvertActionOnDeselection:Off,Object,World:Off
    11.     Object:SetDefine:_OBJECT_VERTEX_OFFSET 1
    12.     World:SetDefine:_WORLD_VERTEX_OFFSET 1
    13. */
    14.  
    After I create a material based on this template shader I could see such options under both output nodes
    upload_2019-6-20_14-10-27.png upload_2019-6-20_14-12-46.png

    However, when I close this editor and reopen it again, all the selections on the non-master pass node would be LOST. ONLY the selections on the master pass node would be saved.

    I tried use different option names for these two pass but it won't fix this issue neither.

    UPDATE

    I may found the cause of this issue. It looks like only the master node refresh the options when opening, and all the other output nodes were ignored.
    upload_2019-6-20_16-25-26.png

    I made such changes which fixed my issues temporary but I'm not sure if its right correct solution or not
    upload_2019-6-20_16-31-34.png
     
    Last edited: Jun 20, 2019
  45. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    67
    Can I change the port name based on the its connection state? Such as
    Code (csharp):
    1.  
    2. /*ase_pass_options:Name=Additional Options
    3.     Port:Alpha
    4.         On:SetDefine:_SPLIT_ALPHA 1
    5.         On:SetPortName:1,RGB
    6.         Off:SetPortName:1,RGBA
    7.  
    I want to change the port name to 'RGB' if this 'Alpha' port is connected and to 'RGBA' otherwise. I tried add such options in the pass section of my template shader but it doesn't work.

    BTW. The 'SetDefine' action works.
     
  46. Beauque

    Beauque

    Joined:
    Mar 7, 2017
    Posts:
    17
    Nice, thanks for your response.
    I also have a question now about static switches/keyword enum: Is there a way I can set them as shader features and as global variable just as any other variable, so to turn them on/off in an editor script?

    -

    Hi, if you just want an offset in local direction, try multiply everything by the vertex normal (XYZ) instead of vertex position Y, then plug this in the local vertex offset port.
    upload_2019-6-20_9-58-23.png
     
  47. rcazzy

    rcazzy

    Joined:
    Jun 7, 2014
    Posts:
    6
    XYZ seems to work fine, as it seems to scale correctly, without being skewed. It is just the single axes where I'm having issues. I'm looking for only Y movement
     
  48. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    676
    To answer my own question - Yes there is!

    You can create a custom expression node with the "Set unique" option disabled, and then check "Auto-register". Then add the proper parameters with custom types (i.e. "Input", "SurfaceOutputStandard") and set output type to void.

    Finally, add "finalcolor:<your_function>" to "Additional Surface Options".
     
  49. irwit

    irwit

    Joined:
    Sep 30, 2014
    Posts:
    55
    Hi all,

    I'm trying to get any type of shader from amplify to work in WebGL but every time I make a build the shader doesn't work. I get an error and it doesnt draw the material. If anyone can point me in the right direction, even to just start looking, would be a huge help!
     
  50. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    21
    Hi, just imported ASE to 20191.1.7f1, using HDRP v5.16.1 - pink is everywhere, no sample is working. Followed wiki instructions on importing template packages - no effect, pink is still there.

    What I do?