Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    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. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    Thanks for confirming it, we've been able to replicate it in some cases. We'll need to run some additional testing on our end as it seems to be working in some of our tests but not on others.


    We'll reach out to you as soon as we find the cause of the issue, thanks for the heads up.



    Yeah, I was about to ask that; could be something with your Light Shadow Parameters, or the actual URP parameters. Testing it on my end, in a new project, seems to work as expected using default settings.
     
    moatdd likes this.
  2. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    51
    I think my shadow parameters have something to do with it. I also found a thread regarding choppy edged shadows that might help me out as well

    https://forum.unity.com/threads/jag...poly-models-using-urp-baked-lighting.1003767/
     
    Amplify_Ricardo likes this.
  3. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    629
    Is there a way to use the flipbook animation with a cubemap? UV's require a vector 3 for the UV input and I can't figure out what node to plug there.
     
  4. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    No, our Flipbook nodes are not prepared to work with a Cubemap; in this particular case, controlling a cubemap image sequence with a simple script may be the best choice.
     
    Cactus_on_Fire likes this.
  5. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    629
    Made a fake light scattering using mathematical objects.

     
  6. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    629
    Btw is there a way I can use pixel depth offset in ASE as it works in the HDRP pixel depth displacement shaders?
     
  7. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    That looks amazing!


    Perhaps this?

    upload_2021-7-16_10-37-3.png
     
  8. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    629
    I'm not using HDRP though, this is just the normal 3D template. I don't seem to have those options.
    upload_2021-7-16_17-33-43.png
     
  9. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
  10. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    629
  11. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,380
    Silly questions but I couldn't figure out how to have back face on my cut out material shade correctly :confused:
     
  12. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    There are no silly questions. All questions are valid ones.
    The first thing that comes to my mind is that perhaps you're not inverting the vertex normal vector for the back faces.
     
    florianalexandru05 likes this.
  13. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,380
    Ok, it was an easy fix, thank you, had to find it in the AS documentation. ;)
     
    Amplify_RnD_Rick likes this.
  14. ksicotte

    ksicotte

    Joined:
    Apr 26, 2021
    Posts:
    3
    Hi, I just imported Amplify to this project that is using HDRP. When I create a new shader (HD/LIT)' it throws these errors:
    upload_2021-7-20_11-55-0.png

    Is it normal?
     
  15. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    I noticed you posted the same message over Discord. There is no problem at all, but for the sake of avoiding duplicate posts please choose only one place to post in future issues.
    Please let me know if you want to continue to track this issue over here or over discord.
    I already responded over Discord, but we can switch to here if you prefer.
     
  16. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    651
    I was told we have HDRP tesselation support now, how can we enable it? I turned in on, but I don't see it on the master node anywhere... what i'm I missing?
     
  17. rioneye

    rioneye

    Joined:
    Aug 10, 2015
    Posts:
    8
    Hi,

    I've been messing around with amplify shader and have been really enjoying it so far!

    I've been trying to create a reflection shader and am running into the following problems:
    1. Sprite blend mode: I'd like to create a shader such that there is no blending between sprites. This picture shows the current result but the legs should not be visible upload_2021-7-20_19-50-29.png .
      I thought turning off Blend Alpha in the Blend modes section would be enough but it seems to have no effect: upload_2021-7-20_19-54-3.png
      I was wondering if someone could point me in the right direction for achieving the desired effect. Note: The issues does seem very similar to this one but the image in the post seems invalid.
    2. Sprite Fade: I'm also working on trying to create a fade effect where the alpha value increases in the negative direction on the y-axis. Something like this upload_2021-7-20_20-6-31.png
      I am experimenting with applying a gradient but have not made any real progress yet. If someone has any tips on how to better achieve this, please let me know.
    3. Material instancing: I have multiple sprites that will be using this shader and they will all have different properties. I was wondering, what is the best way to instance the material such that changes don't effect all sprites? I read that you could create a script that edits the material using MaterialPropertyBlock, but I have yet to try that out. This is somewhat unrelated to amplify but I could still use any advice on this.

    I'm using unity 2020.3.13f1 and URP. Any help on this would be appreciated. Thanks!
     
    Last edited: Jul 21, 2021
  18. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    Yes, HDRP now has Tessellation. Although you can only setup it via the Master Node properties. In SRP no additional input ports are created when tessellation is active.




    Thank you for the kind words.

    Regarding 1)
    I do suppose the content of that image would be something like this.

    Using the alpha channel of one of the images to lerp between both of them.
    Regarding the intersection itself, I need a bit more information.
    That second character below (the reflection) is a separate game object? Can you give a bit more detail on how you are creating the reflection?
    If they are separate game objects, you can play around with the stencil buffer. The main shader applied to the player writes on the stencil buffer and then the reflection object reads from there and only creates reflection where the stencil was not written.
    We do have a Stencil Buffer sample usage on our samples folder if you want to check it out,

    Regarding 2)
    With a gradient you have a more precise control on how alpha behaves across the axis, but you can directy use UV coordinates to achieve this, more specifically the V coordinate.
    This V coordinate should also be used over the Gradient Sample node to correcly sample it as you want.


    I noticed when creating this sample that there's a small issue with the Gradient Sample preview and its not updating correctly when the gradient is changed.
    This not affect the final result, and you can click on the Time input port(will disconnect and immediately reconnect what's in there and it will force the preview to correct itself). Expect a proper fix for this in a future build.


    Regarding 3)
    Yes, you need to use MaterialPropertyBlocks for that.
    You can check our SimpleGPUInstancing sample that comes with ASE as a reference. In there you'll find the SimpleGPUInstancingExample.cs script which exemplifies exactly that.
     
  19. millionpoly

    millionpoly

    Joined:
    Mar 5, 2016
    Posts:
    6
    Hi,

    I'm trying to get the stencil effect below to work in HDRP using 2020 LTS and the latest version of Amplify Shader Editor. The effect is the same as the StencilExample scene found in the Built-In samples package. I was able to get it to work with 2019.1.12f1 using HDRP 5.16.1 and Amplify Shader Editor 1.7.1r1 (the image below was captured in this environment), however, the same shader setup doesn't work for 2020 LTS. I'm curious if there's an setting I'm missing.

    HDRP_Stencil.png


    Here are the SubShader and Pass settings for the mask and read shaders that work in 2019 with the package versions mentioned above.
    2019_Stencil_Shaders.png
     
    Last edited: Jul 21, 2021
  20. rioneye

    rioneye

    Joined:
    Aug 10, 2015
    Posts:
    8
    Thanks for the fast reply!

    I managed to get the gradient working and the MaterialBlockProperty correctly setup in a script.

    To answer your question for (1) the reflection is a separate gameobject. I have a script on the gameobject that will change the texture to match the target object it is reflecting. The reflection is a child of the target object and thus follows the target as it moves. I have masks over areas of the map that will hide the reflection when outside.

    The issue I was trying to solve is the case when there is a layering of reflections, say when a monster is being ridden by the target. In that case, both reflections combine which give an undesired result.
    I have yet to work with a stencil buffer but will look into that and see if I can achieve the desired result.
     
    Amplify_RnD_Rick likes this.
  21. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    651

    ya I seen that and used it. I thought that was the new way, I wanted to be sure I wasn't missing anything. I had used that that night and it was working but I was just making sure. Thanks
     
    Amplify_RnD_Rick likes this.
  22. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    Hey,

    The problem here is that Unity also uses the Stencil Buffer internally. So most of its bits are reserved for internal operations.
    On your case you are trying to use reserved bits and Unity internaly may be clearing them up.

    Taking a look at the HDStencilUsage.cs.hlsl file from the latest version, the only bits you may perhaps use 64 and 128 ( which are marked as user bits ).



    Hope this helps!
     
  23. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Hi,

    I have a few questions about the long-term future of Amplify Shader Editor. I'm not trying to make you make promises, only to make the right decision for a very large long-term project in URP.

    Basically, I use thousands of assets. The only way I can make all this play together is to author a handful of comprehensive shaders that do everything (snow, rain, water, grime, damage, moss, decals, layering etc), and use them for all assets. I need to think in a 10 year time frame, that my shaders will still compile for years. I know, it's insane to guess what Unity will do, but I have to.

    The choices are:

    * Amplify. This is the choice I want to make because it's comprehensive.

    * Better Shaders. I'm just as happy writing HLSL, but a little more on my own.

    * Shader Graph. But it's immature compared to Amplify.

    The surest bet in staying compatible with Unity's ongoing changes is probably Shader Graph. For both Amplify and Better Shaders, I depend on either of you continuing to update it to stay compatible.

    In that regard, I feel more comfortable with Amplify, because you'll have a larger user base than Better Shaders, and might stay alive for longer even as Shader Graph starts to draw people away from you. But the concern is also that Shader Graph will eventually mature, although it looks like it'll be years.

    I have to assume that a lot of new users can't tell the difference between Amplify and Shader Graph, and will choose the wrong one (Shader Graph) simply because it's free. So I feel like your business will always have Shader Graph attrition to worry about. You are doing an amazing job being way, way, way ahead of Shader Graph. For the short term, it's not even a choice.

    But I'd like to hear if you expect (casually and not promising) to be around 5-10 years from now. And have you thought it into your business model to maybe charge for upgrades? Whatever you charge is a negligible part of my project cost, and I would happily pay for Amplify updates if it helps it stay around for a really long time.

    To compare it to something, I have a popular mobile app that was written in Adobe AIR, which is end of life. AIR apps depend on Native Extensions made by third parties. One third party did subscriptions, and is still alive and actually thriving, even in an end of life environment. The other major one did one-time purchases, and just closed up for good.

    To be clear, I think Amplify is way better than Shader Graph, and if I'm doing this node-based, it's not even a choice. Except that Shader Graph, for all its inferiority, will have to work less hard to be compatible with Unity.

    Again, not asking for a promise, just a sense of what the future looks like this exact moment.
     
  24. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    And of course, there is also possibly accepting that there will be a major shader rewrite in my future no matter what. The the options are would be either:

    * Do Amplify now, and in five years, adapt all the shaders to Shader Graph.

    * Do Better Shaders now, and in five years, find some other way to run my HLSL code, maybe ShaderLab or custom Shader Graph nodes.

    Anyway, hoping for some input, and also other paths I should be considering.
     
  25. millionpoly

    millionpoly

    Joined:
    Mar 5, 2016
    Posts:
    6
    Hi, thanks for the reply. Is setting the bits something I can do within the shader editor window?
     
  26. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    Thank you so much for such kind words and confidence on our plugin.

    That's quite a tough post to reply to, mostly since it's hard to predict in such a long term.

    We've been around with ASE since 2016 and still think we have much to offer, so yes we do want it to be alive and kicking over the next years.

    Regarding Shadergraph, I do think both editors can co-exist. Shadergraph will evolve but so will ASE.
    We update ASE on a regular basis with bug fixes and community suggestions, will always support the legacy Builtin pipeline and do our best to keep up with Unity changes regarding scriptable rendering pipelines.

    Regarding the Business Model, please don't get me wrong but my role in Amplify Creations is research & development, I'm the main developer on ASE, so this topic is outside my scope to comment on.

    Our sales department person is currently on some well deserved holidays, but as soon he gets back I'll let him know about your question so he can comment on this.

    This can be set over the Read Mask paramater over the Stencil Buffer setup area.
     
  27. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Thank you, appreciate the answer! And you're right. Just because Unity makes a GI solution, that hasn't stopped 10 other GI solutions from thriving on the asset store. Unity does tend to make bare-bones implementations, and leave it to third parties to make the kickass version of it.
     
  28. rioneye

    rioneye

    Joined:
    Aug 10, 2015
    Posts:
    8
    I have a question about getting multiple stencils to work with in amplify shader. I am trying to accomplish a masking effect with two shaders. One writes to the buffer a reference value of say 10. The other shader reads a value from the buffer and if it is less than or equal to 10 it will draw. This works* but I want to extend it so that the shader that is reading the buffer will only draw the sprite if it is less than 15 but greater than 5.

    My first thought to achieve that was to have two passes with two stencils in the shader but that doesn't seem like it is possible in URP. Then I read a bit about the additional use passes but that doesn't seem to take into account the stencil.

    So my question is, is something like what I mentioned possible? Where two or more stencils can be applied to a shader?

    *There are some bugs I notice. The sprite will disappear when I change the sort order to certain values.
     
  29. PeryOdders

    PeryOdders

    Joined:
    May 13, 2019
    Posts:
    2
    Hi, I need help with this, please.
    I need different value for each eye in VR.
    The following shader is working as it should, in all cases except the one I really want.

    This is the shader.
    Screenshot_1.png

    And this is the function.
    Screenshot_2.png

    And work good.
    Screenshot_3.png

    Except in multiview build, when both are red, (unity_StereoEyeIndex is ever 0 )
    Screenshot_4.png

    What I'm missing here?

    Thanks.
     
  30. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    Hey, just a quick reminder on how stencil buffer works. Its a buffer with 8 bits available to read/write.

    Here's the official documentation.

    So when setting the value 10 on the Write what your're explicitely setting is the 2nd and 3rd values to 1
    2^1 + 2^3 = 2 + 8

    You only have one stencil buffer ( there aren't stencil multiple buffers ) but over that single one you can set what bits you want to be set or not. So instead of thinking on values you should be thinking on bits read/written.

    Imagine that that you have two effects X and Y. Effect X writes on the first bit of the stencil buffer and effect Y writes on the 2nd bit.
    So in the first effect you have a write mask of 1 (2^0) and on the second one you have a write mask of 2 (2^1).

    Now you have a:
    - Sprite A which you on want to appear over the first effect
    - Sprite B which you on want to appear over the second effect
    - Sprite C which you on want to appear over both effects

    For that:
    - Sprite A should have a read mask of 1 ((2^0)),
    - Sprite B should have a read mask of 2 ((2^1)),
    - Sprite C should have a read mask of 3 (2^0 + 2^1).

    TLDR: You can't explicitely set an interval of values over the stencil via logical operations, greater than 5 and less than 15, you always play around is with which bits are activated or not.

    You should check our own Stencil example where we set multiple values on the Stencil buffer and show different geometry according to it.

    Please let us know if you have further questions.

    It's quite strange as Unity explicitely lets users know on the official documentation that unity_StereoEyeIndex has valid results over Single Pass mode. Since Multiview expands on Single Pass it should be working as well.

    Unfortunately I don't currently have an available Oculus device so had to test using Unity Mock HMD with both Single Pass Instanced and Multi Pass and the value seems to be correctly setup.

    This does really seems to be a Unity issue as there are other users reporting this.

    There is a post here that a user solved it by accessing the value on the vertex program and interpolating it to the fragment.

    You can try this out very quickly by adding a Vertex To Fragment node between your Append node and the master node.


    One other thing, more quality of life suggestion. Instead of having to create a custom expression to access that global variable, its nicer to create a property node and point to it.

    Something like this:



    In here we:
    • Create a Float node (since its a float variable )
    • Set its Type to Global and Variable Mode to Fetch (this way no variable is declared inside the shader as it assumes is declared elsewhere)
    • Set the name as the one used by the variable we want to access.

    Here's the paste-bin for this node you can copy/paste directly into your ASE canvas.
    http://paste.amplify.pt/view/raw/0e0e7acb
     
    rioneye and PeryOdders like this.
  31. PeryOdders

    PeryOdders

    Joined:
    May 13, 2019
    Posts:
    2
    Confirmed!!, this works, thanks very much for your help.

    Screenshot_5.png
     
    Amplify_RnD_Rick likes this.
  32. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Hi,

    I'm struggling with structuring a very layered shader using Shader Functions. The problem is that any inputs defined in a shader function live only once for the entire shader. But I'd like each layer to have unique inputs, so each layer has its own albedo input, for example.

    This forces me to have all the textures and uniform inputs outside of the shader function and pass them in. This is already getting out of hand, and I'm going to have a good deal more layers and properties. I'm starting to drown in human error.

    upload_2021-7-29_0-2-9.png

    QUESTION 1: Is there any way to define an input in a shader function and have it be per-function usage? Like if I set up an Albedo input in a function, is there any way to have that become 5 Albedo inputs if I have 5 layers? It appears that defining anything inside the function makes it live once for the entire shader.

    QUESTION 2: I want to enable function features with keywords, but again, the Static Switch appears to be global for the function. So if I make a World Space static switch, it appears under the same keyword everywhere the function is used, and thus there's only one switch for the entire shader, enabling/disable World Space for every usage of the function. Is there any way to give functions a number and then use something like _WORLDSPACE{NUM} as the keyword?

    Especially on question 2, without this, I'm not able to do any compile-time disabling of features, and I'm forced into heavy GPU branching inside of each usage of the function. I'm trying to clearly tie these comparison nodes to uniform integer values in the hope that the GPU will take the hint and not execute disabled code for that frame. But does anyone have an insight into how much worse comparison nodes tied to uniforms are as opposed to static switches?

    It seems like this is maybe not supported, so this would be a strong feature request, to allow function nodes have some automatic personality, like a number that can be compiled into keywords for static switches "_KEYWORD{NUM}", or the ability to place shader inputs directly in the function and have every usage becomes its own input. Again, the UI could simply be that the name of the property is written as "_AlbedoTexture{NUM}"

    Best,

    Per
     
  33. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    When you place Shader Functions node inside a graph, you internally are adding their graph inside the main one, so there are no sub-levels per se. When you create a property node under a shader function, or a static switch, it is exactly if they were being created under the main graph.

    Please notice that properties are unique and declared globally. The only scope there is, is on a Shader Pass level with uniform/global variables. So declaring a texture property inside a SF and resuing it several times in your graph will result in errors.

    If that SF you are creating is to be used multiple times, then all global/property data must be declared outside (in the main canvas) and sent to the SF via function inputs. And the user is responsible for its naming uniqueness.

    The suggestion you made is a good one, each shader function node alreafy has a unique id set for it when placed on the graph. But I do predict some pitfalls, our nodes are not prepared for that, and we need to give the option as well of not auto-renaming variables as some users may not want it. Thus this would only be applicable to global variables as we suspect users don't want the property inspector name to be changed with some id appended into it.
    Static Switches are not straighforward as well as we need, some restructuring would need to be done as well.

    TLDR: It's a good sugestion, I can see some pitfalls on it but we'll defintely register it.


    Regarding comparison nodes vs static switches. If you use a Toggle Switch node, we use a ternary operator, so no branching occurs.
    But in the case of the other nodes, Compare,If, you'll be introducing branching, which are slow on a GPU.
    Static Switch, on the other, introduces shader variants which makes the process of compiling the shader slower. And the more Static Switches you use, variants increase exponentialy because a variant must be created for all keyword combination.
    If you are targeting performance and the number of keywords you require are low then you should go via the Static Switch approach.
     
  34. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Hi,

    I actually took at stab at modifying the shader generation to make this happen. The idea was to simply have a "_SUFFIX" parameter on each function, initially empty, but to be filled with "1", "2" etc. Then I'd search/replace _SUFFIX when property names are referred to. So "_LAYERENABLED_SUFFIX" would become "_LAYERENABLED_1" in the code.

    I should say that my understanding of the Amplify codebase is poor, but the main problem is that at the times and at the code levels where parameter names are added to the shader code, there's no context that informs you which function this value originally came from. So like in Go, you'd have to pass a context value everywhere around the code, to have a way to obtain the suffix parameter when you need it.

    You may have more central places to rewrite it. I tried to do semi-globals, and that creates a problem with nesting, should you ever have functions within functions that use the same feature. But nesting is a logical problem, because you'd only want to do this for parameters that are immediately under the shader function. I don't have the Amplify skills skills to go further with it. I didn't get it working properly, I was missing many cases, I couldn't find good hooks.

    But stacking is critical enough to me that I started writing this as a custom node instead. But given that I was now writing the code by hand, Amplify would just be a framework for HLSL compilation, and then I'm better off with Better Shaders, which is leaner and looks more like real code (code generation is a bit awkward in Amplify, because you have to work with registering variables, so there's tremendous boilerplate around the actual shader code).

    This is the optimal compromise for me. I do worry about maintenance for both Amplify and Better Shaders, but my code looks more like normal shader code in Better Shaders and is more easily portable in the future.

    Better Shaders does exactly what I need with stacking, and maybe you can be inspired by how Jason Booth does it. If you define a pragma or a property, e.g. "_USELAYER" or "_Albedo", it gets its pure name in the code the first time it's used. Subsequent usages are then automatically mangled to "_USELAYER_DEF_1" and "_Albedo_Ext_1", and 2, 3, 4 etc. This makes it easy to pick up the values in a custom inspector.

    He also has the BLACKBOARD block to easily pass data between levels, e.g. accumulated height data. So you don't do any routing to make layers build on each other.

    Small note, as I understand it, ternary operator still branches, but both branches get executed. And the same for many if statements. There are a lot of unresolved ideas on the internet about when exactly branching happens. Many believe that when a branch is clearly tied to a uniform input, the graphics card knows not to execute. Others say that even this isn't true, because different materials with different uniforms are executing the same shader. Having researched this deeply, I'm more unclear than ever. My sense is that anything you do that's not compile-time is probably superstition. So use if's for logic, not performance.
     
    Amplify_RnD_Rick likes this.
  35. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    57
    hi,
    I have this project which entirely relies on ASE, and the lambert lighting model.
    upload_2021-7-30_12-43-25.png
    I am considering switching to URP now but I can't seem to find this equivalent in the URP template. Can I get some pointers on how to proceed? I
     
  36. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    Thank you for the tips. I am fortunate to know Jason, he is indeed doing a great job with BetterShaders.
    I'll take a look at it to get some inspiration ;).


    In URP you'll need to use the Unlit template and do the Lambert calculations manually. I've created a new Lambert Light shader function for you and attached a small sample using so you can have a good starting point I'll include the shader on our next build as well.
    Please notice this sample was created with URP 10/11. If you open it under URP 9 and below you will need to recompile the shader with the appropriate URP Unlit 9 template.
     

    Attached Files:

  37. shadowmatt

    shadowmatt

    Joined:
    Jun 2, 2013
    Posts:
    10
    Im getting this error on creating a new shader, URP, on OSX

    Shader warning in 'Master': 'Unity_ColorMask_float': implicit truncation of vector type at line 900 (on metal)

    This is before I do anything, any ideas?
     
  38. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    526
    Those type of warnings usualy are harmless, nevertheless we'll take a look at it. I've been trying to search for the Unity_ColorMask_float usage on a couple Unity/URP versions but haven't found it yet.
    Can you let us know which Unity and URP version are you using so we can replicate it on our end?
     
  39. shadowmatt

    shadowmatt

    Joined:
    Jun 2, 2013
    Posts:
    10
    It was 2020.3.13, after writing the above comment I updated to 2020.3.15 and deleted and installed Amplify again and now the warning have gone.

    I will let you know if they come back but it seems promising
     
  40. Polygoat

    Polygoat

    Joined:
    Aug 29, 2015
    Posts:
    10
    I'm having some problems getting the URP AO to work.

    This is a scene with the new Screen Space Ambient Occlusion render feature enabled. Left is the Unity Standard shader, right is a shader build from the Universal/PBR template with nothing other than a color assigned to the albedo (and the DepthNormal pass enabled ofcourse)...

    Am I missing something here?
     

    Attached Files:

  41. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    Exactly, there's room for innovation and alternatives; ASE definitely has the better approach here when it comes to flexibility in regards to actual node-based shader editing. Be it with our extensible Template System or Node API, we're in this for the long run, there's quite a lot of studios out there relying on ASE for extreme customization and shader development. It's not so much a "game of catching up", our editors have different design choices and goals.

    At the end of the day we're all dependent on how Unity evolves, there's no telling if SRP will exist as it is today in 5-10 years. What we can guarantee is that we will adapt to whatever the future brings us, much like we adapted to HDRP/LW/URP.

    As for the business model, ASE is going to remain single-seat, single purchase, for the foreseeable future. Paid upgrades are not something we've done before, although we've gradually increased the price over the years, we will probably reserve that for major version changes that could justify the upgrade cost.


    We already discussed this via Discord, just as a reference for other users, the problem here is the use of a Beta/Alpha Unity and SRP version, which we don't support.
     
  42. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Hi,

    I'm having a problem with Amplify, that it crashes the editor on certain shaders.

    When opening Vegetation Engine / Leaf Subsurface Lit, the frame rate of the Amplify editor itself drops to about 5 fps. And if I leave the this particular shader open for editing for more than a few minutes, it crashes DirectX11, graphics card goes down and goes to just one monitor, and I have to reboot. It even crashes Chrome and other apps.

    Before this happens, the log shows the following. It usually shows quickly after opening only this particular Amplify shader. Other Amplify shaders are fine, which is a mystery:

    Code (CSharp):
    1. D3D11: Failed to create RenderTexture (128 x 128 fmt 1 aa 1), error 0x8007000e
    The Unity editor is also running 100% on one CPU core when this Amplify editor is open. It's entirely limited to opening specific shaders in Amplify. Without opening this, I can work for days without a hitch.

    I've tried to reinstall Amplify, Vegetation Engine and even URP. It's the same. I'm struggling to understand how any shader can have UI features in the editor that crash D3D and Unity.

    This particular shader is simple, and fits on one screen. I can't take a screenshot because the computer crashes before I'm able to do it. I'll try a full power cycle.
     
  43. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289

    Hello,

    Apologies for the inconvenience, we would recommend contacting the Vegetation Engine developer in this particular case as this error does not directly hint at an ASE specific issue. Is this something you can replicate in a new project using only ASE and Vegetation Engine? That would make for a great test project.

    Thanks!
     
  44. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    The question is, how can ANY shader crash the Amplify Shader Editor? I very much doubt it has anything to do with Vegetation Engine, I mean, how can anyone insert nodes that crash Amplify?

    This particular shader is just some function nodes, some set variable nodes, and Amplify Shader Editor crashes the graphics card and the computer needs a reboot. And this is a tiny shader, fits on a screen.

    How would any third party even have the power to do that?
     
  45. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    We cannot jump to that conclusion before testing; could there be an additional script running there in conjunction with TVE for Render Texture generation? But in any case, if you can only replicate the issue with TVE you need to contact the original developer first. If he concludes that this is a problem on our side, we will then take it on based on his input.

    I cannot speak for TVE but there are countless occasions of conflicts resulting in errors or crashes between different Unity extensions; we see them on a weekly basis.

    Please confirm something for us, what's your current Unity version?
     
  46. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Hi,

    The Unity version is more the likely culprit. I'm forced to be on the latest beta because of UI Toolkit.

    But I'm not really trying to pin down Amplify or TVE as having a bug, I'm more trying to get ideas to what in the world could be running 100% CPU and GPU processes when a simple editor window is open. This is running as cleanly as I can, freshly started Unity, no scene open, double-clicking on Leaf Subsurface Lit, and everything grinds to a halt.

    So for example, if you have code that actually evaluates deeply into functions used in a shader, and this could be disabled, and if I don't know about this feature, that's more the point of this post. I only want to guess at what category of problem it might be and maybe I can disable something.

    I totally get that you can't support every bleeding edge Unity release. But remember that I'm also hailing from the future, and if there's a problem, it may become widespread later.

    Best,

    Per
     
  47. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    If you're using a beta version that could be a problem on our end; that's not something we can support you with.
    It's impossible to know what's happening based on the details shared, like I mentioned above, this needs to be tested; first by the TVE developer and then by us if required. But I think he also does not support Betas, best to confirm.

    There could be a variety of things happening there, from our shader previews(does generate a few Render Textures) not working on that Unity beta distribution, or some additional script bringing things to an halt.

    We're keeping a close eye on future releases, including possible issues, and planning accordingly in respect to the Unity release schedule.
     
  48. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    The TVE developer obviously has no problem.

    My only point is that if e.g. Javascript crashes Chrome, it can't be a Javascript problem, because it shouldn't be able to do that.

    I also thought it might be about previews, since that's a curious size of RenderTexture. Can previews be disabled globally in Amplify?
     
  49. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,289
    I don't understand how you came to that conclusion, but like I said we can't speak for it; we don't know what scripts it could be using.

    I understand your point perfectly, what I'm telling you is that it's impossible for us to know what's happening without actually it being tested first. That said, I'll jump back to my previous replies; if a problem is only present with a 3rd-party package, contact the developer first and if the 3rd-party developer concludes that the problem is on our end we resolve it with the developer directly.

    You can possibly disable previews in the Project Settings / Amplify Shader Editor, but there's no guarantee this will work in this particular case given the use of a Beta/Alpha distribution.
     
  50. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    221
    Hi,

    Actually node previews were already globally disabled, but it was that kind of tip I was looking for. The TVE developer doesn't have a problem. So there's some feature used in his shader that takes down Amplify in newer versions of Unity. It seems important to identify what, because then this risk exists for all Amplify shaders in newer Unity versions.

    I'm not on a tight deadline, and I can wait and see what happens. But again, his shader is simple. No regular work in Amplify should be able to take down Unity and the GPU and need a reboot. So hopefully, you'll have opportunities to study this in the lab.

    Best,

    Per
     
unityunity