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

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    So I've replaced the built in deferred lighting with Advanced Foliage shaders which have transmition and translucency so can I still use Amplify Editor for my other uses I mean besides foliage or changing builtin deferred messes things up?
     
  2. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Unfortunately, that's not something we can answer, we don't know what that package does.

    I suppose that package aims to support what Unity provides so I'd say that it's probably ok.
     
  3. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    Thanks for quick support. So I guess we'll see but fortunately my problem is now fixed!
     
    Amplify_Ricardo likes this.
  4. ArminJohansson

    ArminJohansson

    Joined:
    Jan 8, 2019
    Posts:
    14
    Using a specific shader function in a surface shader causes a bunch of cg include errors. Other shader functions do not cause any errors. Additionally, that same shader function works perfectly fine in unlit shaders!
    upload_2020-10-16_15-12-59.png

    This is the shader function network
    upload_2020-10-16_15-13-56.png
     
  5. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hey that's odd, can you send us a complete sample? (support@amplify.pt)
     
  6. Liderangel

    Liderangel

    Joined:
    Jul 8, 2018
    Posts:
    101
    Hi. Do you need to have the Substance plugin installed in the project to use Amplify? Because we have no use for it (and thus it's not in the project, and have no plans on installing it) and we are getting compile errors from missing Substance's namespaces.

    (Unity 2019.4.12, ASE 1.8.6)
     
  7. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hey there,

    You don't need Substance; those errors usually come up if you try to use, or open, Substance related content without the Substance Plugin installed.

    -What's the actual error?
    -Have you unpacked our Substance sample?

    Thanks!
     
  8. Howard-Day

    Howard-Day

    Joined:
    Oct 25, 2013
    Posts:
    137
    Hi guys! I'm trying to figure out the right sequence to get the correct World-to-Tangent matrix transform into an ASE shader to calculate light angles. - I have a shader that works great with static models and meshes, but particles don't seem to have the same angles/ computation. :/
    Thanks!
     
  9. Liderangel

    Liderangel

    Joined:
    Jul 8, 2018
    Posts:
    101

    You are quite right! We did use them at the start of the year for a couple of days, and when deleted it didn't delete the define symbols. I just deleted that and it's now working. Thanks!
     
    hopeful likes this.
  10. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    977
    I have discovered a bug with the legacy unlit shader in built-in.

    When using a vertex offset, clip pos for screen position is calculated before vertex offset is applied.



    Expected result for a quad covering the screen:


    Actual result:


    Which is not weird, considering this is the code that is generated:

    Code (CSharp):
    1.             v2f vert ( appdata v )
    2.             {
    3.                 v2f o;
    4.                 UNITY_SETUP_INSTANCE_ID(v);
    5.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    6.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
    7.  
    8.                 float4 ase_clipPos = UnityObjectToClipPos(v.vertex);
    9.                 float4 screenPos = ComputeScreenPos(ase_clipPos); // <--- SCREEN POS COMPUTED BEFORE VERTEX OFFSET HAS BEEN APPLIED.
    10.                 o.ase_texcoord1 = screenPos;
    11.                
    12.                 float3 vertexValue = float3(0, 0, 0);
    13.                 #if ASE_ABSOLUTE_VERTEX_POS
    14.                 vertexValue = v.vertex.xyz;
    15.                 #endif
    16.                 vertexValue = ( v.vertex.xyz + float3( -1,-1,0 ) );
    17.                 #if ASE_ABSOLUTE_VERTEX_POS
    18.                 v.vertex.xyz = vertexValue;
    19.                 #else
    20.                 v.vertex.xyz += vertexValue;
    21.                 #endif
    22.                 o.vertex = UnityObjectToClipPos(v.vertex);
    23.  
    24. #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
    25.                 o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
    26. #endif
    27.                 return o;
    28.             }
    This does not happen for surface shader.
     

    Attached Files:

  11. MatteoMazzeriBlasph

    MatteoMazzeriBlasph

    Joined:
    Jan 4, 2019
    Posts:
    12
    Hi, I try to make a toon shader with your impostor. I managed to make it work with a baked impostor (i set the Albedo map, Normal map, and emissive map UVs equal to dot(WorldNormal, World Space Light Dir) in your Impostor/Bake/Unviersal shader) . How can I make it work also with you Run Time Impostor Shader?
    When I try to change the uv coords i can't see any change in Run Time

    Thank you :)
     
  12. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hey there,

    Maybe one of our devs can provide some additional input, can you provide additional details and context?

    Thanks!

    Good one, glad you spotted that!

    As per-developer feeback: You've unfortunately stumbled into a difference between templates vs surface shaders behaviors. When working on surface shaders, when we apply a vertex offset and use the Screen Position, the resulting vertex/frag shader that is generated by Unity first applies the offset and then calculates the screen position over the offsetted position.

    Over the Unlit shader (which is a template) as you posted, the Screen Position node calculates its value with a vertex position prior to the offset so the color you'll see is always related to the vertex original position.

    You can fool ASE around by doing this:


    In here were manually calculating the screen position , which is done after the offset, thus the behavior will be the same as the surface shader.

    Here's the paste-bin you can copy paste directly to your shader: http://paste.amplify.pt/view/raw/b5a204aa




    Hey there, we're going to need additional details, or an example.
     
  13. cyuxi

    cyuxi

    Joined:
    Apr 21, 2014
    Posts:
    49
    Hi,

    Using Surface template, with any of the light model (from standard to custom lighting),
    the World Reflection node will cause duplicated code when normal input is applied.
    This will cause the error of declaration conflicts.
    Maybe Ia bug?
    WorldReflectionError_1.png WorldReflectionError_2.png WorldReflectionError_3.png


    environment:
    Unity 5.6.3 (Built-in pipeline)
    ASE 185.005
     
  14. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    That's odd, we'll run a few tests on our side.

    Can you forward us your shader to support@amplify.pt?

    Thanks!
     
  15. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hey there, just to let you know that we uploaded a fix to our site if you want to grab it now; the Asset Store version might take some time.

    http://amplify.pt/download/
     
  16. benzy54n

    benzy54n

    Joined:
    Dec 21, 2013
    Posts:
    34
    I am struggling how to implement with the editor a custom vertex function. Where I could have something like this:

    Code (CSharp):
    1. struct appdata
    2. {
    3.     float4 vertex : POSITION;
    4.     float3 uv2 : TEXCOORD2;
    5. }
    6.  
    7. struct Input
    8. {
    9.    float3 color : COLOR;
    10.    float3 worldPos;
    11.    float3 mydata;
    12. }
    13.  
    14. void vert (inout app_data v, out Input data)
    15. {
    16.    UNITY_INITIALIZE_OUTPUT(Input, data);
    17.    data.mydata = v.uv2.xyz;
    18. }
    And then have mydata get passed to the surface function. Any help would be appreciated.
     
  17. cyuxi

    cyuxi

    Joined:
    Apr 21, 2014
    Posts:
    49
    Wow, Thanks! you guys are awesome! lightning fast!
     
    Amplify_Ricardo likes this.
  18. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Try using the Vertex to Fragment node, hope it helps!
     
  19. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389


    Shows your creations on Twitter, win keys!

    No rules, except that it should be made using Unity or Unreal, could be an existing project.

    We'll reveal the winners on the 31st.
     
  20. sanchezAlvarez

    sanchezAlvarez

    Joined:
    Aug 28, 2013
    Posts:
    3
    Hi, Another question about Depth Fade, in the manual you wrote - The shader must have its Render Queue value set to Transparent or higher ( p.e. Blend Mode set either to Transparent or Translucent ) so the object is not written on the Depth buffer.

    But where to change it on HDRP? Attaching screenshot. depthafade.PNG
     
  21. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hi there!

    Try here:
    upload_2020-10-22_18-34-19.png
     
  22. sanchezAlvarez

    sanchezAlvarez

    Joined:
    Aug 28, 2013
    Posts:
    3
    Hi, thanks for the response, it is working in opaque or transparent, the solution was this one Attaching for others, who will have the same problem :)

    depthpass.PNG
     
  23. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hi,
    I'd like to use a stencil mask(buffer) as a mask for an Amplify Shader Post process effect?

    ss_1.jpg
    This is the stencil I'm already rendering (for other reasons)
    ss_2.jpg
    Here is the full image (stencil is used for player' field of vision)
    ss_3.jpg
    I'd like to use the inverse of that stencil to apply a color effect to rest of the screen.

    Is such a thing possible?
    How should I approach this?
    I'm trying this for a long time but couldn't do so any help would be appreciated.
    Thanks
     
  24. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    This is confusing. It sounds like you are talking about splat maps but I'm talking about terrain layers. I'm using MapMagic and splat maps have been deprecated and replaced with terrain layers but Amplify doesn't seem to edit terrain layers.

    EDIT: Nevermind, I'm just misunderstanding all of this. I'll find another solution.
     
    Last edited: Oct 26, 2020
  25. Igualop

    Igualop

    Joined:
    Mar 1, 2017
    Posts:
    30
    Hi guys,

    I'm getting a compilation warning when using the "Gradient Sample" node.

    The warning is: "floating point division by zero" d3d11

    It happens inside the SampleGradient function, and this is the line causing the warning:

    float colorPos = saturate((time - gradient.colors[c-1].w) / (gradient.colors[c].w - gradient.colors[c-1].w)) 
    * step(c, (float)gradient.colorsLength-1);

    You should be able to reproduce this using the example in the Gradient Sample wiki page: http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Gradient_Sample
     
  26. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    I'm looking to create an ambient occlusion post effect for built in that has a min/max range. I had hoped there's an example of this since I have no clue how to, but I could not find any. So I'm asking here, hoping for something to get me started.
     
  27. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    If it's a regular render texture you can just set it on your Image Effect, alternatively you can also access Global Textures with a Texture Sample node set to Global. Would this work for your case?

    Hey, no problem!

    Just be clear, a terrain layer is made of splats, you can think of them as each tiled texture used. Terrain terminology can be confusing.


    That's usually a harmless warning, re-saving it should in most cases hide it. This is due to internal calculations which might result in division by 0; I'm not sure if we can make this one completely disappear but our developers can check it out.

    What's your Unity version?

    Hey there,

    Ambient Occlusion can be a complex topic, I'm afraid we don't really have samples for something like that. You can access Gbuffer and Global textures which would help but you'd also need additional scripting at some point.(C#)
     
  28. Shinono23

    Shinono23

    Joined:
    Dec 25, 2016
    Posts:
    5
    Hello! Sorry, I'm back again. Last time, I decided I wanted to try to finish this shader myself. I still haven't figured out how to fix the issue, although I've found out what causes it.

    Basically, it seems that no matter what I do, if the end result isn't multiplied with raw light attenuation, the direct square of influence for a point light will always be visible once the shader enters its active area.

    I do understand that you're supposed to multiply with light attenuation, but my issue is multiplying with unedited light attenuation causes a harsh black shadow, and it's only fixed by changing the shadow value of the directional light. Instead, I want to color the shadows myself to fine-tune the visuals of my game.

    So, I've basically tried all I can find. I've tried using replace color to replace the black caused by light attenuation (the current set up in the screenshot, and currently the best looking),

    making a color mask, then adding the color mask to the light attenuated end result,

    changing the color of the normal shadows and attenuated shadows separately, then together,

    and I've even changed the order of operations to see if that has any effect, but none of this has fixed this issue yet.

    This time, I've prepared an example shader so you can clearly see what I'm doing:



    and here are the examples. As you can see in the video and screenshot, the shaders generated by Toony Colors Pro do what I'm describing. I've created 2 different shaders here, which are both marked with blue arrows. The one with the black shadows is multiplied with light attenuation right before being plugged into custom lighting and the one with purple shadows uses replace color before plugging in, as shown in the screenshot above.

    EDIT: I forgot to mention. On the shader with purple shadows, if I replace with the color black instead of purple, this issue goes away.







    Is what I'm trying to do possible with amplify? If you have time, do you have any suggestions I can try? It's okay if this is out of the scope of your support, I just thought I'd try to ask someone more experienced than me about this.
     
    Last edited: Oct 26, 2020
  29. SpreadcampShay

    SpreadcampShay

    Joined:
    Dec 9, 2010
    Posts:
    180

    Attached Files:

  30. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Well! I'm trying to avoid render textures or setting global textures. I should have mentioned earlier.

    Is it possible to make a post processing effect that gets its mask from stencil buffer automatically?
     
  31. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Ah, that's a bit beyond my skills. Would it be possible to request such a thing for the examples pack in the future? Something really simple?

    Maybe I should have explained a bit more in my case. I'm not actually looking for a shader that creates shadows, but instead something that acts as a mask for my own effect. Since ambient occlusion creates its effects in the corners, which I want too, I thought it could be a good starting point.
     
    Last edited: Oct 26, 2020
  32. Igualop

    Igualop

    Joined:
    Mar 1, 2017
    Posts:
    30
    Hi Ricardo, I'm currently using Unity 2018.4.26 and Amplify v1.8.6. Thanks.
     
  33. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    I think we're looking at different issues here; I can confirm that the square is absent when the Light Color is multiplied by the Attenuation. A reminder, this is how Unity internally processes it, it's a requirement and not specific to ASE.

    upload_2020-10-26_18-8-17.png

    What's happening then is that you're replacing the input with Replace Color node; you can tweak the Range of that node and Fuzziness up to a certain point but you will start to see the squares eventually; this is an expected result.

    Here's an example of a small tweak after the square became visible.
    upload_2020-10-26_18-11-5.png

    Here's a possible example of shadow coloring: http://paste.amplify.pt/view/raw/04cfc3ce (paste to canvas)
    upload_2020-10-26_19-45-9.png

    We can't really speak for the Toon pack, we don't know what it does internally.

    Note: If you're using the Indirect Diffuse Node, be sure that Lighting is being calculated.

    An Ambient Occlusion sample? I don't think so, that's way beyond regular samples and more on the realm of separate packages. (quite a lot of work involved)

    So you basically want to mask out intersections? I'm afraid there isn't really an easy, "fit for all situations", solution for that. You could try using the Depth Fade node but you are then limited since it does not write to depth.

    I don't know exactly what you need but perhaps Vertex Color or even baked Vertex Occlusion could be a viable option for your project.


    Thanks for the heads-up, I think we can mitigate this on the next ASE update.
     
    Igualop likes this.
  34. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    I wanted to do something like this, there the dark parts are actually glowing.
    test.jpg
    I thought of just modifying Unitys shader to make the shadow color HDR, but I need more options like distance and some animations. So I'm kinda lost here now unfortunately.
     
  35. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
  36. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Try using the Depth Fade node, our Shield sample(built-in) may help. Even if not on the main model, you might be able to overlay another.


    Hey, my bad, missed your last question.

    The stencil buffer is cleaned before OnRenderImage; not really sure what to recommend here but perhaps there's already something out there that could point you in the right direction. Here's an example, the catch is that the Stencil also being written by the post-process: https://github.com/egomeh/stencil-buffer-post-process
     
  37. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Thanks, but does that node really work with post effects? All I get is white and the wiki says "for this object" which tells me it's not for post. Maybe I use it wrong?
    {39827A49-C8D5-4728-A9CA-3678D42A359F}.png
     
  38. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    No, this is for objects, not for post effects that apply to all objects.
     
  39. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Ah, back to square one. :(
     
  40. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    I definitely recommend looking into using an object shader, even if you have to generate the mask externally.
     
  41. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Thanks, I'll see what I can come up with.
     
  42. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    Unity3d 2020.2

    HDRP surface output HD\Lit

    Shader error in 'HDRP/Custom/LitAlphaCutoutFromNoiseDoubleSided': 'LightLoop': cannot convert output parameter from 'struct LightLoopOutput' to 'float3' at line 4209 (on d3d11)
     
  43. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hello there,

    Apologies for the inconvenience but we don't support Unity Beta/Alpha versions, the issue you're experiencing is likely related. In any case, support will be available shortly upon release.

    Thank you for understanding.
     
  44. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    135
    are there tutorials for the most nodes ?
     
  45. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    There are tutorials for the most common nodes that you'll be using most of the time.

    You can learn more here: Beginners Series - Basics

    Beyond that, you start to get into actual shader development which is not specific to our Editor; in those cases we recommend looking at external sources. We usually recommend looking Alan Zucconi's tutorials ( starting with the Gentle Introduction to Shaders ) and his much praised Shaders and Effects Cookbook; Catlike coding is also an excellent reference for shader development.

    A full node list is also available: Official Wiki
     
    skyLark9 likes this.
  46. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    135
    OK. most of those tutorials are old and not cover most nodes. Plus, you could do better than those on your page! Sorry but I'm not good at all with shaders and provide good tutorials helping those like me very well. I will wait to see any new update on you tutorial page. Thank you.
     
  47. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Well thank you for the reply.
    At first look, it seems this technique can be done with Amplify Shader editor nodes. Am I right?
    It makes 4 passes;
    second pass makes a selection based on shaders roughness value,
    third and forth ones render an effect based the newly created stencil mask.

    By the way; I just finished "Disco Elysium" and saw your names. Just wanted to say "It is a great game and I was happy to see your names in credits"
     
  48. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Alan
    Those nodes are at the core of what you'll need to create anything, I definitely recommend it. The tutorials may be old but the information there is still valid. You should look into exploring specific topics not individual nodes, the nodes will follow naturally as you need them, hence whey we recommend external sources to learn actual shader development. We provide you with the basics for the editor itself, our learning resources are not meant to teach users everything they need to know about shaders.

    There are various sources out there which you can apply to our editor or other shader editors.

    We have other general videos if you're interested in browsing: https://www.youtube.com/c/AmplifyCreations/videos

    You might even find courses out there that actually use our editor: https://www.udemy.com/course/shaders-in-unity-with-amplify/

    In any case, I strongly recommend checking Allan's book.

    Not exactly sure what you're asking, the linked example uses additional scripting. Let us know if you have any additional details, I'd be happy to pass it on to one of our devs.

    Oh thanks, Disco Elysium rocks, we're honored to be able to contribute in some form!
     
    skyLark9 likes this.
  49. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    That's correct linked example uses a script for the user to define a threshold value and to use "OnRenderImage" method.
    Hopefully I can translate that script to the new post processing stack since ASE already creates a compatible script for me.

    I want to learn about the shader part. How can I make a post processing effect shader with 4 passes like the example.
    And render different per pixel effects (color lut or blur) for different passes.

    Hope it is not too much to ask.
     
  50. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hey, hope it works.

    You might be better off with a Custom Template for added control, you can edit the existing ones.

    upload_2020-10-30_10-29-25.png