Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    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. ColtonK_VitruviusVR

    ColtonK_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    148
    Hey @Amplify_RnD_Rick,

    I have had an issue with a snow shader in our PS4 port for approx 2 months now (Snow is appear on the underside of objects in build but not in editor). I had a dialogue with @Amplify_Ricardo regarding this and he said the dev team would look at it. Since then I have sent direct messages but it has been radio silence.. Is there anyway you can check on the progress of this?

    Cheers,
    Colton
     
  2. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    1,387
    Hey there, sorry for the radio silence on my part; I was actually away for Gamescom and PAX West, should return to normal soon.

    Last I checked, your ticket was on our queue, I will try to find additional details.

    Apologies for the inconvenience.
     
  3. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    Hey Colton,

    We do apologize for the delay.

    I can confirm what Ricardo said. Rest assured that your ticket is still on our queue but we haven't be able to figure out what might be happening.

    Mostly because we still haven't had access to a PS4 from which we could test what you sent. On a PC build all is working as expected and that makes it more difficult to solve.

    By looking at the shader/screenshots you sent, it must be something related with the perturbed normal generated over the World Normal node.

    What I can suggest for you to do is:
    • On the World Normal node, toggle on the Normalize parameter
    • Place a Saturate node between the World Normal's Y output port and the Power's Base input port
    • Replace the Clamp node with a Saturate node as sometimes
      • I know they should do the same but sometimes PS4 gets picky with some instructions

    Also I really have to advise you to update to our latest version since much as changed from the ASE v1.5.2 you are using.
     
  4. Tibauvdb

    Tibauvdb

    Joined:
    May 20, 2018
    Posts:
    1
    Hello, I've tried to get amplify shader editor to work with HDRP but keep running into errors. I'm probably just missing something.
    I'm using Unity 2019.1.0f2 & HDRP 5.7.2 & the newest version of Amplify.

    I've set up my project to include the HDRP and a HDRenderPipeline asset is in my ProjectSettings->Graphics tab
    After this I import the Amplify shader editor

    The first errors I get here are errors about "Shader Properties can't be added to this global property sheet, Trying to Add: " here there are multiple such as _GrabTexture_TexelSize, _GrabTexture_HDR, RefractionGrab0.

    I ignore it and install the HDSRPTemplates Package. After this I get 4 new errors saying "invalid subscript 'tangentToWorld' at line x. these errors are for the new HDSRPUnlit,HDSRPPBR, HDSRPLit, lit shaders.

    When creating a shader under AmplifyShader-HD I can only choose Lit.
    When creating a lit shader and only putting a color in the albedo it creates a see through material with artifacts along edges with other materials.

    Kind Regards,
    Tibau
     
  5. IanItor

    IanItor

    Joined:
    Dec 21, 2017
    Posts:
    7
    Hi, in my shader i store custom normals in a vertex colors and convert it to a World Normal space with a Object To World node, but this way i lose the ability to plug in tangent normal map like i do it with a regular World Normal node. What kind of math happening when World Normal node accepts a normal texture map and can it be achieved inside the editor?
    VcolsToWorld.png
     
  6. MacMcDev

    MacMcDev

    Joined:
    Sep 25, 2014
    Posts:
    3
    Can anyone tell me how to get rid of this weird square-shaped stencil / artifact around lights? I've been debugging this for hours and have come up short.
    3f04e4beb4e5cf16662bb02b5bcb870b.png 385cbca47e9d36580e04328643dd7ff2.png
    A. It only happens with this ASE shader
    B.) It's not an attenuation issue, to my knowledge.
    C.) It's not a quality settings issue, as multiple pixel lights are allowed
    D.) It goes away when Additive Pass is disabled (but uh, so does everything else, making it useless?)
    E.) plugging the dot product directly into the custom lighting node still creates the artifact.

    Any suggestions would be hugely appreciated.
     
  7. IanItor

    IanItor

    Joined:
    Dec 21, 2017
    Posts:
    7
    Try to change Fog node with Indirect Diffuse Light
     
  8. slayerdude

    slayerdude

    Joined:
    Jan 12, 2016
    Posts:
    2
    Sorry for possibly dumb question, but is there a way to set different color/texture to backface? There's a special node in Unreal material editor that does that, but couldn't find similar one in amplify. Does it have to do something with multiple render passes? Please help. Thank you.
     
  9. IanItor

    IanItor

    Joined:
    Dec 21, 2017
    Posts:
    7
    Switch by face node, there is also a example shader called TwoSideWithFace in amplify official examples folder
     
  10. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    738
    Quick question, I’ve got my amplify shader working in Unity stander renderer. I was about to move it to LWRP but I see Unity announce URP. Is it recommended to wait for that to land or it just a name change.
     
  11. ColtonK_VitruviusVR

    ColtonK_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    148
    Hey @Amplify_RnD_Rick

    Thanks for the response, no worries about the delay. It seems like adding the saturate node (suggestion 2) did the trick!

    Thanks again,
    Colton
     
  12. MacMcDev

    MacMcDev

    Joined:
    Sep 25, 2014
    Posts:
    3
    Seems to work, thanks a bunch!
     
  13. sybere

    sybere

    Joined:
    Mar 26, 2015
    Posts:
    156
    Hello!

    Any way to replace Standard Surface Light and World Space Light Pose nodes for HDRP lit? or adding Custom light to HDRP lit?

    Thanks!

     
  14. MechaWolf99

    MechaWolf99

    Joined:
    Aug 22, 2017
    Posts:
    31
    Hey, so I am trying to make a shader where it applies an effect/color to everything inside the mesh that it is on, and makes the mesh otherwise invisible. I haven't been able to figure out what to even google for this. An effect sort of like this is what I am trying to achieve. An ideas?
     
  15. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,371
  16. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    738
    Does the LWRP/HDRP/URP template not support tessellation ? This is crucial to our project
     
    Last edited: Sep 11, 2019
  17. Hexaedre

    Hexaedre

    Joined:
    Jan 23, 2015
    Posts:
    109
    Hi,

    I can't make the emissive lit the lightmap when baked.

    I use Unity 2019.1.5, High Definition RP 5.16.1, HD PBR shader.
    I selected "Baked" in the Global illumination line in the inspector.
    It worked with the built in Unity HDRP/Lit shader but not with the amplify shader.

    Do I have to do something special in the shader in order to lit the lightmap ?
     
  18. Murkawski

    Murkawski

    Joined:
    Nov 30, 2014
    Posts:
    48
    Hello. I was wondering how to access Texcord0 to use vertex streams. At the moment when I use the Vertex TexCoord node, the UV channel goes from 1 to 8.

    I referenced your answer here:

    http://amplify.pt/forum/viewtopic.php?f=23&t=754&p=3199&hilit=Accessing+particle+Custom+Data#p3199

    But they're no longer is a texcoord0 to select as in the example you show there.

    And also how would you go about setting up an effect like this gradient mapping through amplify shader?

    https://simonschreibt.de/gat/fallout-4-the-mushroom-case/
     
    Last edited: Sep 12, 2019
  19. vthera_joels

    vthera_joels

    Joined:
    Nov 8, 2018
    Posts:
    6
    Is there any way to expose output node properties as a material property? Similar to how the Unity Standard shader has a drop down for Opaque, Transparent and Fade?
     
  20. ZaZy

    ZaZy

    Joined:
    Jan 14, 2015
    Posts:
    20
    Hi Amplify Team,

    Just a couple of quick bug reports regarding precision:
    * The Template and TemplateMultiPassMasterNode never assign the precision loaded in the ReadFromString method to the container parent graph like the StandardSurface node does. This results in Util classes returning the default precision of Float unless the user toggles the precision for the editing session. Hence the generated shader output will change precision when combining scalars into vectors (e.g when using append nodes).
    * The local variables of multiple operator nodes (append, break, lerp, clamp etc) are always Float as they register their own local variables but do not get the precision from the parent graph. Other operator nodes that use temp casts (i.e local values instead of local variables) like the pow node and other math operators do not have an issue.

    The unity cross-compiler is quite good at guessing what the intended precision is in simple cases but definitely starts using highp when it encounters chains of the affected nodes.
     
    Amplify_Paulo likes this.
  21. talofen

    talofen

    Joined:
    Jan 1, 2019
    Posts:
    18
    I keep getting this error on my ASE shaders:
    Code (CSharp):
    1. 'MetaVertexPosition': no matching 4 parameter function
    2. Compiling Vertex program with UNITY_PASS_META
    3. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    Currently on 2019.2.3f1, LWRP 6.9.0. But I got this error on all LWRP shaders since 2019.1
    Any suggestions?
     
  22. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    268
    I want to use Curved World with LWRP and Amplify Shader... your guide here doesn't seem to work exaclty with the newest versions of both plugins and LWRP.

    So I made my own template to add the dependency to Curved World ( I couldn't do it with the Canvas Window)

    upload_2019-9-16_17-40-8.png

    I also added the custom function but the "V_CW_TransformPointAndNormal()" method doesn't seem to exist anymore, so I looked into the Unlit.shader LWRP example included with Curved World and found this line

    upload_2019-9-16_17-42-53.png

    So I added the line 100 to my function "CURVED_WORLD_TRANSFORM_POINT" just replaced the input.positionOS for v.vertex as declared on the struct "GraphVertexInput" by the Amplify Template

    and it "Kinda works" it does in fact bends the vertices but it throws some errors

    upload_2019-9-16_17-45-53.png

    This is my Graph

    upload_2019-9-16_17-46-34.png

    this is the function

    upload_2019-9-16_17-46-57.png

    What could I've been missing? I think I almost got it.
     
  23. yaboo

    yaboo

    Joined:
    Mar 23, 2016
    Posts:
    16
    upload_2019-9-17_22-52-26.png
    Named as "MainTex" is error
     
  24. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    104
    Hi! i updated to the newest version and some shaders stoped working accordingly, for example i have this shader to simulate depth fog using only a plane, if i recompile the shader the effect stops working completely, it only works as a simple alpha not detecting camera depth.

    ScreenshotASE.png


    This how it look when is working: (its a plane with the shader and the back ground is just an empty cube)
    upload_2019-9-19_12-45-12.png

    And this is how it look after the update:
    upload_2019-9-19_12-45-35.png

    Im testing the nodes individually to see which one is broken.

    Using unity 2019.2.4f01

    Thanks.
     
    Last edited: Sep 19, 2019
    daville likes this.
  25. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    116
    I can't properly use Transform(Tangent to View), looks like it doesn't work as intended. For example in UE4 similar node does this - http://prntscr.com/p8eu7d

    But in ASE for some reason, everything goes black - https://prnt.sc/p8eujt

    How can I achieve similar behavior of this node?
     
  26. LukePeek

    LukePeek

    Joined:
    Nov 29, 2013
    Posts:
    36
    Hey! I'm trying to set up a post processing effect that is like a heat distortion, but I'm not quite sure how to get it to offset with the world camera. At the minute it looks like looking through warped glass or something, because as the camera moves the distortion stays the same, as would be expected but I want it to move with the camera, but exactly sure how best to do that.
     
  27. Artificial_Illusions

    Artificial_Illusions

    Joined:
    Jul 24, 2018
    Posts:
    17
    Hello, I am using a special glow shader: https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/mk-glow-90204 for my mobile game, I really need this shader because of the selective glow feature it has.
    Moreover, I also use ASE to animate mystery own materials and I'd like to be able to use a glitch distortion effect in conjunction with MK Glow. Is there a way to make MK Glow (or any other third party shaders) work with ASE? or vice versa?
     
  28. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,293
    Hi! I’m working with stencil buffers a bit at the moment and I was wondering if there’s a way to expose those parameters in the inspector? It would be really handy to edit things there and make the shaders a little more flexible.
    Thanks!
    Pete
     
  29. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    Hey guys,

    Apologies for the huge delay on my end answering your questions.
    I was away for the last 2 weeks and only arrived yesterday to the office.

    These first errors can be safely ignored, although we are trying to find a way to get rid of them.
    The other error you are having is that you unpacked the incorrect templates.
    Now, by default, if no HD templates are installed, ASE automatically unpacks the correct package.
    If you want to manually install the version specific to HD 5.7.2 then you should unpack the AmplifyShaderEditor\Plugins\EditorResources\Templates\SRP (Legacy)\HDSRPTemplates 572 (Legacy).unitypackage file.

    When you connect something to the Normal port what it internally does is converting that input vector from tangent to world space through a tangent to world matrix.
    Mathematically speaking, a tangent to world matrix is created with the World Normal, World Tangent and World Binormal.
    So this means that you are somewhat distorting the normal you are sending according to the object's own world normal.

    If you want to use that new world normal vector to distort a normal map, you'll need to manually create a custom tangent to world matrix
    .
    This can be a bit troublesome so I quickly created a shader function for you which does the math for you.
    You can open it and modify it at your will.
    Here it is.

    Glad that you already have fixed your issue. Thank you @IanItor for the suggestion.

    Yes you can do as IanItor suggested. Again, thank you @IanItor for your answer

    We are preparing a new set of templates specifically to URP. They will be available soon.

    Awesome! Always glad to help.

    The Standard Surface Light node is specific to Unity's default pipeline.
    Regarding World Space Light Pos node, unfortunately because of the way the HD shader is made we can only give you access to the main directional light.
    So you should use the World Space Light Dir node.
    To do your own custom lighting, you should use the HD Unlit template.


    What I would suggest is for you to use the stencil buffer.
    More specifically, that sphere's shader would write a certain value into the stencil buffer. All other objects would then read from and only render if its value is equal to the one you have written.
    We have a sample using the Stencil Buffer ( AmplifyShaderEditor\Examples\Official\StencilExample ) so you can check that out and see how to work with it.

    That user specifically wanted to access the old Grab Pass which is now a bit different.
    On your specific case you can maybe check our SRP HD Lit Refraction sample (AmplifyShaderEditor\Examples\Official\SRP HD Lit Refraction) over our HD samples package (AmplifyShaderEditor\Examples\HD SRP Samples.unitypackage).
    It is a bit outdated and using our legacy Lit template.
    Depending on your current Unity and HDRP version, they may give you some compilation errors.
    But to get ride of them just open the materials on ASE and recompile them.

    Unfortunately we don't support tessellation on SRP for now.

    Is it possible for you to pack a small sample to us so we can further examine it on our end?

    At a certain point we standardized names between the texture coordinate nodes and that one had its option names changed. UV Channel 1 corresponds to TEXCOORD0.

    Regarding the link you sent, I've taken a look at it and it linked to a more complete url (http://technical-eden.blogspot.com/2012/01/gradient-mapping-awesome-way-to-get.html)
    From I'm seeing this is just some uv manipulation and the graph shown in UDK can be directly translated to ASE.
    Hope this helps.

    I'm not quite sure on what on mean mostly because that dropdown you are referring to is achieved via Unity's own custom inspector and it's not related to material properties.
    Is it possible for you to elaborate more you what you are trying to do?

    Thank you for reporting theses issues. We are already tackling them, this will take a while as we need to address multiple situations/nodes.
    Nevertheless we will be incrementally fixing this issue over the next builds.


    That's quite strange. Are you using the latest templates inside the AmplifyShaderEditor\Plugins\EditorResources\Templates\LWSRPTemplates.unitypackage package?
    If not, I would suggest you to import them into your project and then open your shaders and recompile them with this new version.

    Unfortunately this seems to be something that changed over the Curved World API itself.
    I'm not up to par on the latest changes over that plugin. Is it possible for you to contact its developer, as he should give you a more specific answer on what you need to do?

    When declaring a sampler we also need to declare a vector containing its texture transforms ( tiling and offset ) which must be the name of the sampler plus the _ST.
    You setting the sampler name as MainTex, makes ASE creates the vector _MainTex_ST which is already an internal global variable on LW.
    Unfortunately you must, for now, set a new name for your texture sampler.

    I'll definitely have to test this out as soon as possible. Can you send me the original shader (before breaking) so I can compare what changes when compiled on our new version?

    EDIT: Also can you please let us know if you changed between LW SRP versions recently?
    I'm asking this because we reported an issue to Unity regarding fetching values from the depth buffer which falls into the LW SRP v6.9.x versions.
    They were already able to reproduce and opened a ticket over their issue tracker.

    This seems to be some kind of issue on our end. I'll take a look at it and see what might be happening

    I'm having some difficulty on visualizing the final behavior you are trying to achieve.
    Is it possible for you to share additional information on how you are creating the effect and what is the distortion behavior you want when moving the camera?
    Since you want something dependent on the camera, have you considered perhaps using a particle system, sometime like our HeatHaze sample?

    ASE can only load and edit shaders created with it.
    However, you can use third-party libraries on ASE shaders.
    You just need to add those into your shader via the Additional Directives option ( on both Standard and SRP shaders ) and then access the specific functionalities via a Custom Expression node.

    Yes, you can create properties inside the shader and then link them into each field.
    Something like this:


    EDIT: If the samples/shaders I asked for contain material that you cannot publicly share please send me over via our support email (support@amplify.pt)
     
    Last edited: Sep 24, 2019
  30. IllTemperedTunas

    IllTemperedTunas

    Joined:
    Aug 31, 2012
    Posts:
    106
    Welcome back! Guess i had good timing with this question...
    I recently added ambient occlusion to the built-in post process stack and was wondering if there was a way to disable the ambient occlusion depth check on certain materials without disrupting things too much.

    I realize this is a long shot as the post process relies on global sorting, but was hoping there might be a workaround akin to disabling motion vectors for motion blur.



    Issue occurs where the top water plane intersects with the backdrop plane.

    Thanks in advance
     
  31. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    104

    Sure, here is the working version of the shader.

    Thanks!
     

    Attached Files:

  32. LukePeek

    LukePeek

    Joined:
    Nov 29, 2013
    Posts:
    36
    Thanks @Amplify_RnD_Rick. Basically a normal heat haze, however we're also using Depth of Field so this would need to be applied after the post effect stack, as the distortion doesn't distort depth, resulting in a weird artifact around objects where the haze would be applied. I thought as it's everywhere, a full screen effect may have been easier, but as I was trrying to apply it as that, a full-screen effect, it would look more like looking through glass rather than the haze being in world-space. I was hoping there would be an easy way to offset the full-screen effect based on player movement so it still looks like it's in world space.

    I have found another solution now though, using particles, but rendering out the haze map of those particles to a render texture, then applying it as a post effect after the depth of field. I didn't really want to go down the particle route as I feel it will be a lot more intensive to run, having full screen particles, plus the post effect rather than one full screen effect. But it works, and doesn't impact too much so I'm happy.

    Although if you did have any more ideas after reading the above I'd love to hear them.
     
  33. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    Honestly I don't know if you'll be able to do that. Disabling motion vectors is a bit different since it relies on a specific shader pass used only for that, so its just a matter of manipulating it and nothing else will be affected.
    Are you trying to create AO with ASE or using our Amplify Occlusion solution?

    Thank you for sharing the shader, it was super useful.
    We did a fix a while ago where we noticed that the Screen Position node result was always being normalized even if its Type was set to Screen.
    From what I'm seeing, the shader you sent is using that node with the Type set to Screen although it should be set to Normalized since its being used over the Screen Depth ( which require normalized values ).
    You didn't noticed that at the time you created this shader since it had the bug I described earlier, so everything was fine from the Screen Depth node standpoint.
    I do apologize for this mix up on our end.


    Thank you for the additional info.
    When reading your post yesterday, one of the ideas that came up was exactly creating some kind of mask to a render texture that should then be used later on.
    I didn't want to make that suggestion right away mostly because I wanted to try and understand the effect itself and why particle systems using a grab pass was out of the question.
    But after your explanation, it does make sense what you did.
    If you want to control when the distortion happens then this needs to be through a post-process effect, receiving a mask to where to apply the effect.
    Since the particles are being used only to create that mask you can do some optimizations there. P.e. its shader can be as simple as possible, maybe using alpha cut instead of alpha blend.
     
  34. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    486
    The examples don't seem to work on 2017.X
    They just show the same white material on every model
     
  35. Juliken

    Juliken

    Joined:
    Jan 30, 2017
    Posts:
    17
    Hello, I'm currently trying to create my own shader for my game. What I want to do is to apply a stripe texture on the shadowed face.

    Here is an example :

    https://image.noelshack.com/fichiers/2019/39/4/1569492201-stripetexture.png

    I tried to use a Dot node with the normal face but my problem is I cant detect the face with projected shadow.

    Is it possible to get light data on every face ?
     
  36. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    Which examples are you referring to? I randomly tested some of our official samples and everything is working as expected.

    You need to also use the Light Attenuation node as it contains both light and shadow information.
    For a complete sample on how to properly use it, you can check our CustomLightingToon sample.
     
  37. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    486
    Does it require special libraries or should it just work in any new project? Just made a new project to test it out, imported ASE latest version on 2017.1.03f and tried all the examples. None of them seem to work. The material seems flat white color while standard materials work.
     

    Attached Files:

  38. Juliken

    Juliken

    Joined:
    Jan 30, 2017
    Posts:
    17
    Thanks you that what I was looking for
     
  39. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    No, there's no special libraries required.
    It's quite strange because on that shot you sent from the Dithering Fade sample, both of those objects are surrounded with walls using Unity's own Standard Specular material, and also those walls are incorrectly rendered.
    I've tested on multiple Unity 2017.X versions on a Windows PC and all were working as expected, so it seems that it might be something specific on your setup.
    Was there any error, or warning shown on the console when importing our package?
     
  40. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    486
    Oh, those walls aren't lit because of an issue with another package. When I add the NGSS component to the directional light they get fixed. The issue with the ASE shaders still remain though as you can see from how the material looks from the inspector. I'll have to check about any shader errors tomorrow when I get to work.
     
  41. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    104
    Thank you for the clarification, but even when using the node with the normalized output, the shader still doesn't work. as it should, im not sure what im missing, could you help with this?

    Also, that fix you made, was public? because the problem just happened with the latest version of ASE.

    Thanks!
     
  42. Ereroa

    Ereroa

    Joined:
    Apr 27, 2017
    Posts:
    1
    Is there a way to hide properties when certain toggle is off?

    My shader property is getting long and I was hoping if there is certain way to handle the properties using custom attributes rather than adding scripts for it.
     

    Attached Files:

  43. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    Sure thing. I'll take another look at it and see what else may be failing.
    Yes, that fix is already public and available over our website.

    Something like the Unity Foldout behavior?
    This may be a bit tricky. My first thought is that you would need to create a new Custom Material Property Drawer for the foldout element and somehow save its value somewhere (maybe on a shader property).
    Then you would need to make other shader properties react accordingly to it (maybe through custom attributes).
    As you can see, there's a couple of 'maybes' because I'm not certain if this will be feasible or not.
     
  44. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    I took a look at your shader and I might think I've figured out what is causing the difference.
    Although you need the normalized values to get the correct depth, because of your setup, you'll also need the raw w component.

    If you place another Screen Position node with its Type set to Screen and connect its W port to the Subtract node then both original and newly compiled shaders are similar.
    Something like this:



    The left plane is set to your original shader and the right one uses the newly compiled shader.

    Don't worry on using another Screen Position node since there's no additional cost on the shader as they share the same code internally.
     
    Last edited: Sep 27, 2019
  45. Loards

    Loards

    Joined:
    May 2, 2013
    Posts:
    104

    Wow, thank you, ill never guesses to use the normalized Type XYZW position and the W in screen Type, thank you! now it works like it should!

    Thanks!!
     
    Amplify_RnD_Rick likes this.
  46. DINKmod

    DINKmod

    Joined:
    Jan 25, 2017
    Posts:
    14
    Is there anywhere to find up-to-date documentation on the HDRP output node?

    I'm having the hardest time trying to do something incredibly simple; just create a glass shader.

    But, when I check out the documentation on the output node here: http://wiki.amplify.pt/index.php?ti...r/Scriptable_Rendering_Pipeline#Output_node_2

    It seems largely inaccurate. As if it's just out of date. There is no longer a 'Blend Mode' section of the output node, and the pull-down lists for Cull Mode and ZTest Mode under depth are completely different now.

    I guess I'm moving forward with using Unity's default shaders to create the glass materials I need, but I would very much like to be able to use ASE to create my own custom shaders for all of my materials, and I do that. But from time to time, when I need to find information on how things work, it seems like it's just completely out of date or something.
     
  47. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    Believe me, I understand your frustration. The biggest reason we haven't been able to update the documentation not only HDRP but on SRP in general, is that it's still constantly changing.
    We are continuously creating and updating templates to catch Unity's changes to each one of the pipelines and will only be able to properly update the documentation when is begins to stabilize.

    EDIT: We always try to stay up to par with Unity's own Master Nodes so, a good start would be looking at their most recent documentation.
     
    Last edited: Oct 1, 2019
  48. Juliken

    Juliken

    Joined:
    Jan 30, 2017
    Posts:
    17
    Hello I'm still working on my custom shader and I need some clarification. I'm using the custom light to make hatching shader reacting to light in real time. To do this I'm managed to make the Light Attenuation node work but I'm facing a problem. The surfaces which are in the shadow appears totally black. I tried to "up" the value of the light and it works well except with point light. I dont know why but when I add something to the value, the light created by the point light appears like a box. The limit of the light looks like a square.

    Here is my simple shader :



    And the different result :


    With no value added


    With 0.1 added to the light intensity


    With 0.1 added to the light intensity and a point light next to the mesh

    Is it normal ? I want to get a custom light but with no totally black shadows because my goal is to apply a hatching texture in shadows.

    And I still have issues to understand what the Light Attenuation node return. I dont understand why I need to connect it to the light color. The light intensity value goes from 0 to infinity ?

    Thanks you
     
  49. omarcss

    omarcss

    Joined:
    Feb 18, 2018
    Posts:
    1
    how to acheive this function in ASE which is the discard keyword to hide parts of the model

    Code (CSharp):
    1. Shader "Test"
    2. {
    3.     Properties
    4.     {
    5.         [HideInInspector] __dirty( "", Int ) = 1
    6.     }
    7.  
    8.     SubShader
    9.     {
    10.         Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" }
    11.         Cull Back
    12.         CGPROGRAM
    13.         #include "UnityShaderVariables.cginc"
    14.         #pragma target 3.0
    15.         #pragma surface surf Standard keepalpha addshadow fullforwardshadows
    16.         struct Input
    17.         {
    18.             float3 worldPos;
    19.         };
    20.  
    21.         void surf( Input i , inout SurfaceOutputStandard o )
    22.         {
    23.             float3 ase_vertex3Pos = mul( unity_WorldToObject, float4( i.worldPos , 1 ) );
    24.      
    25.             if (ase_vertex3Pos.y > 0)
    26. [B]                 discard; [/B]
    27.             o.Albedo = ase_vertex3Pos;
    28.             o.Alpha = 1;
    29.         }
    30.  
    31.         ENDCG
    32.     }
    33.     Fallback "Diffuse"
    34.     CustomEditor "ASEMaterialInspector"
    35. }
     
  50. Amplify_RnD_Rick

    Amplify_RnD_Rick

    Joined:
    Feb 15, 2016
    Posts:
    466
    When dealing with lights, a standard surface has two separate passes, Forward Base and Forward Add.
    Forward Base is used to apply the Directional Light into the object, as for Forward Add is used to apply Point Lights and Spotlights contributions.

    An Add pass is called for each one of those lights and its result is added to the light calculation ( thus the name ).

    I'm briefly describing this because to correctly do custom lighting you need to understand each one of them.

    The subgraph you connect to the Custom Lighting port will be used in both Base and Add passes and the Light Attenuation node will have different information on each.
    It let's you know if you are or not in shadow, but on the Add pass it will also contain the current light distance falloff.

    Light Color node besides the light color contains only its maximum intensity which is the one specified on the Light Component Intensity field.

    If you use only that intensity value, as soon as the object is under the point light influence, it will receive its maximum intensity independently of the distance between the object and the light.

    It's the Light Attenuation that will make that smooth transition between being more bright when close to the light and reducing its strength when moving away.

    So you multiply Light Attenuation by Light Color to have the light's maximum specified intensity when close to the light and correctly react when moving away from it.

    Moving on to the shot you shared.

    In there your final step is to add the Add property. Taking into account what I previously explained, this property is being added to the final fragment color in both the Base and Add passes.
    This means that for each point light this property value is being added into the fragment as soon as the object is influenced by the light, disregarding its attenuation.

    Since what Unity uses to check if an object is under influence of a point light is somewhat a box collider you'll get that box shape.

    Maybe you only want to add that property on the Forward Base pass, which leads me to the next tip.

    You can have different instructions running into each pass. This can be done using the Static Switch node.

    By setting the Static Switch Mode to Fetch, you'll get a Keyword dropdown with a couple of Unity keywords.

    Among them are the UNITY_PASS_FORWARDBASE and UNITY_PASS_FORWARDADD. These keywords are only active on the Base and Add Pass respectively thus can be used to separate operations between those passes.

    ScreenshotASE.png

    On this shot I sent, I'm only adding the property on the Base Pass thus when placing a point light near the object won't create that behavior you mentioned.

    Hope this helps.


    We don't have any node that does a discard operation, but we do have the Clip node, which does the similar clip operation.