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

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Hello, thanks for using it!

    Perhaps with the Smoothstep node?
     
  2. lifeisabeach

    lifeisabeach

    Joined:
    Apr 26, 2020
    Posts:
    47
    Olá!

    I'm a happy user of Amplify Shader Editor.

    I'm trying to create a URP material that is part fully transparent, part fully solid. I have managed to achieve the opaque/transparent part (with help here) but the opaque parts of the geometry that are behind opaque geometry are rendering on top of the front geometry.

    I think I can work around this with convex objects by adjusting their placement, but not with concave objects - since they have overlapping geometry and show their own behind faces that should be hidden - and those are the majority I need to work with.

    So, I thought of having the 'back' faces clip the front faces, as an alpha input, but no luck implementing that.
    I thought of having the render come from far to near, but don't know if that is possible.
    I have read about the zwrite function but am not familiar with it to try to work with it confidently.

    I appreciate any help with this. If I could solve this from the shader it would save a ton of time.

    I'm targeting mobile.

    Obrigado!
     
  3. footnotesforthefuture

    footnotesforthefuture

    Joined:
    Apr 6, 2018
    Posts:
    5
    I think I or you missed something. Simple Lerp would be enough.

    I'm just not sure how to plug it in correctly.

    Let's say I have an image of just 2 pixels, 0,0 = blue, 0,1 = yellow.

    I want to use that image as input to say "output a smooth gradient between blue and yellow based on the UV coordinates of the output face". I'm just not sure how to do that.
     
    Last edited: Mar 8, 2021
  4. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Make sure the gradient textures you use have "none" as their compression, and have atleast 16 bit depth float values.
     
    hopeful likes this.
  5. footnotesforthefuture

    footnotesforthefuture

    Joined:
    Apr 6, 2018
    Posts:
    5
    Compression was on low quality; setting it to none helped a lot but it was still blocky. My gradient texture was 1024 * 2048 (quickly got it from some art website); I set the maximum size in the inspector to 128 and it fixed the issue pretty much entirely (if I zoom very far in I can see pixel like squares - but it may be due to my calculations and it's small enough that I don't care about it anyway)

    Thanks for pointing me in the right direction!

    I'm still not sure why it works though.

    Is anyone able to clarify:
    1. Does the amplify texture sample node interpolate between pixels? I.E. if I sample a texture at a location that is exactly halfway between two adjacent pixels, what will the returned colour be?
    2. Why could setting my texture to lower resolution help with this? Perhaps the texture I was using itself had a poor quality gradient, and setting it to a lower resolution smoothed it out?
     
  6. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    With high resolution there are larger areas for the image compression to clamp a bunch of pixels as the same brightness so dropping the resolution pretty much creates enough value difference between pixels to get rid of that banding effect. The lerping between the pixel values isn't related to ASE at all but it's directly related to texture settings. If you change the filter mode of the texture from bilinear to point, you'll get the same blocky effect since you'll be telling Unity not to lerp between the pixels.
     
    hopeful likes this.
  7. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Like the user above mentioned, this is specific to the texture parameters, not ASE or with other shaders; particularly filtering, compression, or even if you have Mipmaps disabled. The reason you might see a difference when you resize is because Unity is resizing and filtering the texture for you; you can replicate this behavior in photoshop for example by playing with the technique used for filtering.

    You can test this by setting the Mip Level directly in your texture sample node.

    upload_2021-3-9_14-36-46.png
     
  8. footnotesforthefuture

    footnotesforthefuture

    Joined:
    Apr 6, 2018
    Posts:
    5
    Excellent, I got it! Thanks both for the quick help :)
     
  9. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Boas!

    Do you really need a semi-transparent shader? A cutout (Alpha Clip, no smooth blending), would resolve the order issue.
     
    lifeisabeach likes this.
  10. lifeisabeach

    lifeisabeach

    Joined:
    Apr 26, 2020
    Posts:
    47
    That's a great suggestion, didn't think of that, it makes sense, will give it a try. Obrigado!
     
    Amplify_Ricardo likes this.
  11. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Any news on the parallax warping issue?
     
  12. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Sorry, not yet but it's high on our ticket system!
     
    Cactus_on_Fire likes this.
  13. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Hi, I want to create pixelating post shader but I'm not that good at shaders and I don't know how to implement 2 things. Some examples I can follow would be great.

    1. I want to use a palette texture so all colors that are rendered use a color from it. I also want it to be dynamic enough to be able to change how many colors are used.

    2. I want to add a dithering pattern that creates a pattern using colors from the palette. If possible I would also like to be able to set how many colors can be used in the pattern. (Like a gradient)
     
  14. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388

    Hello there,

    I recommend starting with the beginner series in order to get acquainted with the editor; it's going to be a bit tricky to build something like that right off the gates. http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials

    1. This is a very broad definition; I recommend perhaps starting with the Toon example which shows you how to use a Ramp texture. You can also use Gradient nodes but please note that it can't be changed dynamically, it's set in the shader.

    2. Keep in mind that ASE only creates Image Effects for the built-in renderer.
    Here's a pixelate Image Effect: https://wiki.amplify.pt/index.php?t...Editor/Tutorials/Pixelate_Post_Process_Shader

    Here's another pixelation ref: https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Pixelate_UV
     
  15. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    78
    Hey,
    Is there a way to display a block of text in the material inspector tab, to describe how to use the shader, for instance ? Thanks !
     
  16. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Hey there! You can add Custom Headers to properties. Other than that, you should look into creating a Custom GUI Script as shaders don't exactly control what's shown in the Material Inspector.

    Additional details: https://www.alanzucconi.com/2016/11/07/shadergui-custom-material-inspectors-unity-5

    upload_2021-3-16_14-7-24.png
     
  17. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    78
  18. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    I know, but I rather learn by making something that's useful to me. Doesn't matter if it's hard, all I need is being pointed in the right direction.
    Broad? But that's what most systems and games used when you only had 256 or fewer colors. Or do you mean it's hard to setup something like this in modern systems? I want a system that renders an image like an indexed image in Photoshop, with predefined colors. Must you use ramps for this?

    Also, I can't find the toon example, is it a new one?

    Yes, I know about that, but I asked about dithered pixelation. You know like in Photoshop when you convert an image to indexed or bitmap and you have the option to use different kinds of dithering patterns. That's what I don't know how to do.
     
  19. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Hey there, whatever works best for you, go for it! I also strongly recommend getting into other sources; our material is mainly aimed at teaching you how to use the editor. There some great sources out there such as 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.

    Since shader concepts are interchangeable, for the most part, you can also learn from Shader Graph or even Unreal Engine Material tutorials.

    Broad description, as in it really depends on what you actually want to build, in practical terms. For example, if you want to use a Color Palette per-object you need a custom set of operations per-shader to do it, if you want to do it by screen you could use an image effect shader that takes in a Lookup Table and adjusts your image based on that.(We actually have had an old image effect for something like that, built-in renderer only, Amplify Color.)

    It's not "difficult" if you have a specific set of operations in mind, it even includes a Custom Expression node in case you need to process data, but it's important to keep in mind that ASE is a tool and as such it provides the basic building blocks that allow you to build complex operations; there are no pre-made nodes for what you're looking for, with the exception of the gradient node.

    Dithered pixelation, in that sense, does not exist in this context. That, and many other type of effects, have to be implemented manually. It also depends on how you want to use it. Does it render in screen space like an half-tone effect or does it actually apply per-object, on its surface?

    Let us know, or if you have a screenshot of what you're looking to accomplish, perhaps we can provide some tips.

    EDIT: I should also mention that there are Unity shaders sources out there that do something along the lines of Palette use: https://assetstore.unity.com/packages/vfx/shaders/palettefx-ultimate-color-swapping-91488 Could be a good reference.
     
  20. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    If I have a character with a material assigned and I want to add an effect like outline, is there a way to stack shaders, or do you decide in advance that this character will make use of outline so I must combine the outline shader with the base shader? I'd just trying to get a high level sense of how one approaches this. It seems like if one wanted to combine multiple effects (fire, dissolve, outline) that the main material shader would be extremely complicated.
     
  21. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    You can't necessarily stack shaders. Do you need to toggle outlines during gameplay? If so make a single shader with the effect where you disable/hide it.

    Do some objects always display an outline and others do not? Perhaps it makes sense to make separate shaders in order to use less instructions when an outline is not required.

    I mentioned the Outline effect but this applies to all other effects. Ultimately the correct choice depends on your specific requirements.
     
  22. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Thanks for the explanation, that's a lot of info.

    I want this as a post effect and I do know how to make the pixelate shader part since it's in the wiki. The problem is the rest.

    Here you see an example I made from an ingame screenshot. I want the shader to be able to convert the image to the examples on the right.
    The top one is automatic reduction to the closest 4 colors. The middle is the same but with an automatic dither pattern.
    The bottom is the same as the middle one, but with forced 4 colors from a palette. This is the key part, I want the shader to convert whatever color is rendered by the camera and convert it to only use the ones in the palette.

    I use 4 colors in this example, but I want this to be dynamic. I also want the palette to be dynamic, like changing a LUT texture.
    {B3FA2281-E72B-43AA-B439-8663F54D2176}.png
     
  23. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Perhaps using the Posterize node could help achieve that look quickly, the HSV node might also be handy. As for the Dither you could trying controlling its intensity with the scene depth, or any other of the available textures if you're using deferred rendering. Or apply the dither per-object in screen-space with something along the lines of what we do with the Screen Space Detail sample, masking it out with a Fresnel node.






     
  24. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Hm, I don't think posterize will help much, at least if it works like in Photoshop. The important thing here is that's the colors are the exact number I specified. No approximations or smoothed pixels. If I take screenshot and count the colors in it should say the exact number I've specified. I'm not looking for a quick fix here.
    I also can't see how I can use a palette with this. I don't want to tint or anything, just a straight conversion from the color a pixel has to the closest in the palette.
     
  25. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Yes, just offering it up as a possible way to achieve a similar look.

    I would refer you to my previous posts; you don't have pre-made nodes for what you're looking for, you'll need to create those operations yourself. To do so, I'd recommend looking at existing shaders first in order to determine the required calculations.

    https://assetstore.unity.com/packages/vfx/shaders/palettefx-ultimate-color-swapping-91488
     
  26. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    204
    Thanks as well for the info. If I understand correctly, something like the outline effect needs to be built into the main shader. In other words, every gameobject in the scene that I want to be able to highlight will need the outline effect added to it. That seems like an awful lot of work. Did I understand your response correctly?
     
  27. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Yes, as an alternative, you can always look into image effect based outline effects.
    https://github.com/cakeslice/Outline-Effect
     
  28. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Thanks I'll see how far i can get. Never thought this would be so non straight forward, based on the popularity of pixel games these days. I can't be the only one wanting to use index colors?
     
  29. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    There are many solutions out there, again it really comes down to what you need. We've only seen a couple of similar questions on our end.
     
    Last edited: Mar 17, 2021
  30. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    This is ASE ver 1.8.9. After a while the errors just start accumulating even when not in gameplay.

    upload_2021-3-20_12-12-39.png
     
  31. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    In an other effort I have an emission that i need to create a Transparent cutout from. The areas that I want transparent are the dark areas so the the shader actually becomes just the lighter color. I am having trouble getting just the light areas to promote. From there I can then change the color of the promoted colors to look like a glowing silhouette borders and not the sphere. In all the posts I have seen then whole model lights up with no tranparency.
    A thought I had is to try to set a pass through range filter so I only let the brighter color through.
    upload_2021-3-20_13-50-10.png
     
    Last edited: Mar 20, 2021
  32. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    Getting closer. I cant seem to get the opacity mask to make the dark regions transparent with a transparent cutout.
    upload_2021-3-21_0-4-9.png
     
  33. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
  34. NuionFX

    NuionFX

    Joined:
    Feb 13, 2015
    Posts:
    1
    I found a Major bug (Tested in 1.8.9r1 on unity 2019.4.11f1 / also happens in older unity and ASE versions) using the node "Depth Fade" into the Masternode "Local Vertex Offset" will result in wrong code and the shader breaking. This is pretty sad since it can open the doors to some cool features like interactive objects/water/surface. It tries to access floats that are declared afterwards and then tries to use i even tho its not accessible in the context. I added images and footage below for all my findings.

    Nodes working without using offset

    Shader breaks when using offset

    Some of the errors (more come up when those are fixed though)

    how I "fixed" the code by hand, not sure if its correct but at least we got some interactions

    Result working with "fixed" code


    I would LOVE to see this fixed so we can make cool stuff with interactive water or alive particles. All sorts of things

    cheers Zer0

    ps: the example shader is attached
     

    Attached Files:

  35. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388

    This error seems to be specific to Substance, not that particular sample. Did you open our Substance sample package or install the Substance plugin in your project? There could be something in your project, not necessarily specific to our editor, that's preventing scripts from executing.

    Please don't duplicate posts here if you're already asking on the Discord channel, choose one otherwise this is going to get confusing.

    Please show us what you're using for the "Blend Mode" on the left tab, screenshot would be great.

    This is how you do a Transparent Cutout; notice the disabled "Opacity" port given the Blend Mode selection.

    upload_2021-3-22_10-50-10.png


    Thanks for the heads-up, I was able to replicate it. I will pass this on to one of our developers for additional examination.

    I must also ask that you also try not to duplicate posts here that have been shared on our Discord server. If it's critical, please use the official support email at support@amplify.pt or post it here; we get back to everyone.
     
  36. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    98
    I'd like to make a shader that reads the Normal data from the gbuffer before lighting and then modifies it and writes it back. It's part of a workflow for post-process normal decals. How would I achieve that in Amplify?

    I know how to read the value from _CameraDepthNormalsTexture at the correct coordinates and unpack it with the Decode Depth Normal node, but have no idea how to write the results back to the buffer again or ensure the shader executes at the right part of the deferred shading process before lighting is calculated.
     
  37. Cramonky

    Cramonky

    Joined:
    Apr 1, 2013
    Posts:
    186
    Hey,

    I want to use the LOD Fade node to add LOD cross fading to my shader, but I'm having some trouble with it, the LOD1 level is not fading properly. To illustrate this I made a simple shader that shows the LOD fade as white to black.


    LOD0 fades out as you would expect, starting white then fading to black before disappearing:


    LOD1 however starts as kind of a dark gray when it pops in, then fades to black, then fades back to a dark gray before finally becoming white:


    This is using the built-in render pipeline in Unity 2021.1.0b11.2079 with ASE 1.8.9.000.
     
  38. Howard-Day

    Howard-Day

    Joined:
    Oct 25, 2013
    Posts:
    137
    Hello! Is there any way to accurately sample in the unity_SpecCube0 reflection map? I set the texture sampler to use a global value named that but it just returns a basic gray texture. If I manually set the cubemap it does appear properly to the cube I've chosen...
    Thanks!
     
  39. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I would love to have a "Windowbox"-shader in Unity for archviz projects.
    A windowbox shader fakes a 3d-room onto a single flat plane and therefore saves a lot of work and performance:
    https://wparallax.com/
    http://julius-ihle.de/?p=2451

    Any chance to get an amplify-template for this?
     
  40. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Tricky, not exactly a feature we provide for general use.

    Writing to the gbuffer is possible using the multi pass template, however that template is not a surface shader so it doesn't have all the options that surface has with the Built-in renderer. You do it by first adding the option in the "additional surface options" group, just add something like "finalgbuffer:DecalFinalGBuffer" (without quotes)



    Then you need to actually add the function to your shader. Since the function is not connected anywhere you need to activate some special options for it; something like this:



    Notice how it's marked as "auto register", and Set Unique OFF, which means it will compile even without being connected anywhere, and the output type is set to void, also notice how some of the input parameters are set, it has to perfectly match the way you want the function to be. The only draw back of doing this is that you need to type your code manually instead of using nodes, if it's for decals it shouldn't be a problem since usually you only want to set a value to zero

    Hope that points you in the right direction, we don't have a lot of details to share on this topic.

    Hey there!

    I'm afraid we don't officially support Beta or Alpha Unity versions. Can you replicate this on an official release? We'd be happy to test it, as is we don't have any useful details to share based on the provided details.

    Hey there! Which renderer are you using? I believe that it needs to be decoded, perhaps a Custom Expression can help there. We do plan to add a node for this soon, similar to what Shader Graph provides.

    Not this particular technique but we did release something similar a while back. https://assetstore.unity.com/packages/vfx/shaders/fake-interiors-free-104029

    There's an interesting thread here if you want to explore Cubemap Interiors, you probably don't need a template: https://forum.unity.com/threads/interior-mapping.424676
     
  41. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,204
    Hey everyone, I have a model that has UV seams which cause textures from not continuously wrapping. I can use a triplanar node in Substance Designer that uses a mesh position and world space normal maps to fix my problem, but I rather build a shader in Amplify. Is there a node(s) that can help me with that? Thanks!

    seams.jpg
     
  42. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Hey!

    Not exactly the same but you can use Triplanar projection in Unity. http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Triplanar_Sample
     
  43. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,204
  44. Cramonky

    Cramonky

    Joined:
    Apr 1, 2013
    Posts:
    186
    Just tried it in the newly released 2021.1 official version, and it still has the same issue. To further test I tried the same shader in 2018.4 and it works as expected there:


    However versions 2019 onwards have the same issue where the LOD1 doesn't fade in correctly:


    So I don't know if they changed how LOD fading works in 2019, or if it's just outright broken.
     
  45. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388

    Hey there, please send us that example so that we may replicate the same exact conditions on our side. (support@amplify.pt)

    -Which 2019 version did you use?

    2021.1 is a Tech Stream release, not a traditional official release; in any case, we're still seeing our going to handle these "quasi-beta" releases.
     
  46. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    98
    Aha, thanks very much! I got this to work in a standard surface shader previously but ran into a catch-22 situation. I have to use opaque or cutout render types in order for the shader to use the gbuffer, but then I can't read from _CameraDepthNormalsTexture without causing an infinite feedback loop. I need to get the value of the normal behind the decal and then blend it with the decal's normal. I assume this is what the multiple passes is meant to solve?

    I also can't for the life of me figure out how to bring the results of my new normal calculation into the custom expression. Would I have to write my entire process in the custom expression (including manual texture samples etc) rather than using nodes?
     
    Last edited: Mar 25, 2021
  47. gskunk

    gskunk

    Joined:
    Sep 15, 2014
    Posts:
    2
    Trying to create a normal map from a height map. Plugging a Noise Generator(Simplex 2d) with texture coordinates into a normal from height node and I'm getting black in the node preview. This happens as well if I'm putting an image texture in as well rather than noise. Am I missing an option somewhere? Using Unity 2020.3.1F and most recent Amplify.
     
  48. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Let me see if I can get some additional insight from our devs, I'll get back to you as soon as possible.

    Hey there, some nodes don't show a preview; it's the case with Custom Expressions which are used in that node. Side note, that node is a Shader Function, you can double click it to open it. In any case, you should be able to see it on your material, is that not the case?

    upload_2021-3-26_9-44-19.png
     
  49. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,388
    Hey there, as per dev insight:

    This thread might provide some more additional details, it's a similar case.

    With a surface shader, there's no way around using the Custom Expression; if you can provide additional details to what you currently have and specific issues, perhaps our dev can assist you with the Custom Expression

    The other solution is to use the Multi Pass Unlit which allows you to write to the Gbuffer directly, no need for the finalGbuffer/Custom Expression step.

    Hope it helps, let us know.
     
  50. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Hi
    I just need a simple wave example shader for a plane (to simulate water wave)