Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Thanks for the shader, I can confirm it happens and it will help a lot debugging it. It should be fixed for the next release. Sorry for the inconvenience :(

    [edit] Fixed it, definitely comes in the next build

    The issue with vertex to frag is due some bugs from unity. Well I call them bugs but to be honest they could very well be design decisions. Basically Unity expects the tessellation function in a specific format, that format does not allow for custom interpolators, in fact it doesn't allow for a lot of things, in some cases we can get around it by using automatic ones but the vertex to frag node generates it's own interpolator so it doesn't work if tessellation is on. There's nothing we can do for now besides preventing vertex to frag to do its work. In the future we intend to recreate the tessellation functions with the template system and that way we have total control so it should be possible then. As a side not we are now working on multipass support for templates and there's a few other priorities to templates next so expect tessellation support in them after those.
     
    Last edited: Jan 30, 2018
    TheWalkingDevTA likes this.
  2. TheAlmightyPixel

    TheAlmightyPixel

    Joined:
    Jun 21, 2014
    Posts:
    263
    Sorry if this is a little off topic, but I've ran into a little issue with the POM-node, and I was wondering if there's something about it that I'm missing.

    I have a screen-space texture (one of the deferred g-buffers), which I'm feeding to a shader as a global variable. When I plug the texture into the albedo like so:
    Graph Albedo Only.PNG

    The result is this:
    Albedo Only.PNG

    It works perfectly, looks alright from all angles etc. However when I try doing Parallax Occlusion Mapping with the same texture and UV's like so:
    Graph POM.PNG

    It looks like this:
    POM Result.PNG

    The albedo (black checkers) comes out correctly, but the POM-effect/displacement is happening in a completely different place.

    Am I perhaps feeding the POM-node UV's that are in the wrong space or something? It seems odd how the albedo comes out fine and it uses the same UV's. I'm not a shader wizard by any means so I might just be doing something stupid as well.

    Thanks!
     
  3. Crocomodo

    Crocomodo

    Joined:
    Nov 21, 2017
    Posts:
    29
  4. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I can't figure out what is wrong, I've replicated the shader and tested using a regular texture instead of a global property and the results look ok to me (tho they make no sense in my case)

    Unity_2018-01-31_11-02-45.png
    I'm using the screen position node instead of the individual nodes but I tried both ways and got the same result. I also suspected the issue was coming from the lack of assignment in the texture coordinates node to the albedo texture, but it doesn't make any relevant difference. The other thing it's different and that is my last hope is that I'm fetching the G channel from the my black and white checkers texture while you are getting both R and A channels for different things. I'm even getting the G channel in the POM node. I understand that the channels you are getting have the information you need but suspect there's something going on with the information you are getting. That's my theory anyway.

    Try confirming the result by changing the mask texture.

    Indeed that's something we can't do yet. There's some extra parameters there. But we can add those with relative ease so you can expect it soon ;)
     
    Crocomodo likes this.
  5. Amplify_RnD_Rick

    Amplify_RnD_Rick

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

    We've uploaded a new build into our website.

    Here are the release notes:
    Release Notes v1.4.3 dev 03:
    • Fixes:
      • Fixed issue on 'Vertex Tangent' node internally outputting float4 data in templates instead of float3
      • Fixed Shader Function category typos
      • Fixed issue on ports accessing already destroyed nodes for previews
      • Fixed issue on precision type used in shader functions
    • Improvements:
      • Added ZWrite and ZTest options to 'Outline' node
    We were already able to consistently replicate the issue reported here about some errors being thrown on the ParentNode class when going into Play mode.

    It is being a bit more trickier to solve than we initially estimated and we weren't able to provide a fix on this build, but rest assured that we are working on it and will upload a new package as soon as it is solved.

    Happy shader creations!
     
  6. Rafmorais

    Rafmorais

    Joined:
    Jan 13, 2015
    Posts:
    38
    Hey guys!
    First of all, I've been playing with ASE for the past few weeks, and it is an awesome tool! I want to learn more!
    I've been following a few tutorials here and there and now I'm trying to adapt the fire presented in this video

    The author was kind enough to share the nodes in UE4
    https://data.simonschreibt.de/gat065/update3/rimeFire_01.png

    I was happy to understand the steps presented in the video and I was trying to achieve a similar result in ASE but I'm kinda stuck right here! I'm not sure what I'm doing wrong but I'm sure that it is my fault! haha...
    ANy help or tips would be awesome! Thanks in advance!
     

    Attached Files:

  7. TheAlmightyPixel

    TheAlmightyPixel

    Joined:
    Jun 21, 2014
    Posts:
    263
    I managed to do some changes to the global mask texture. Now the data comes through fine and I can use it with the POM-node, thanks for the suggestion!

    Result.PNG

    However now I've ran into another issue. The POM result seems to follow the camera, and I'm not sure how I could fix this. The result also gets squished if I zoom in and shrinks if I zoom out. Could it have something to do with the "ViewDir"-node (tangent) passed into the POM-node?



    Any ideas? The set up is the same as previously.

    Thanks again!
     
  8. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Hey there, first and foremost, you are using a VERY outdated version of the editor, with such an old version I can't guarantee the issue hasn't been solved already and maybe whatever I say next is irrelevant. Please get either a new version from the store or one of our dev builds from our download page here.

    That said, there are a few things to note about that example, first is that UVs between unreal and unity have their Y channel inverted, you can see from the imaged you shared in which the UVs seemed to be flipped on the Y axis. For the most part this is not an issue, but considering you are doing some math with those values it may very well be the case that some operations need something changed, like a sign or inverted value. The other thing is that I actually tried recreating the graph but there's some missing information in the image you provided, the panner nodes for example are using some built in speed values that I don't know what they are. So I can't really say for sure what is going on.

    Just by looking I would say you could either try subtracting instead of adding before the append node. That should work out for you.

    And this does not happen when you are not using the POM node? Are you using any plane reference value other than 0 in the POM node? (its the last input) What values does your height has? POM expects a 0 to 1 range where 1 is the the surface height and 0 is the parallax effect INSIDE the surface, so 0 represents the "lowest" point.

    Also, try using the screen position node instead of calculation the value manually (see the image in the previous post). That "swimming" seems to be some sort of inverted value. It could be the view dir but unless you did something with it, it should be working. Can you perhaps send the shader or maybe a reproducible project? (check my signature for emails)
     
  9. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Hello!
    When I move the vertex (vertex offset), the shadows are not seen correctly, what do I need to achieve the correct shadows in the displaced object?
    Thank you!
     
  10. Rafmorais

    Rafmorais

    Joined:
    Jan 13, 2015
    Posts:
    38
    Hello!
    Paulo, thanks a lot.!
    First of all, I have not a clue why I was using that super old version, I did a fresh install and I think it's the right one now.
    Also, you're right, using the subtract did the job...
    Thanks a lot guys!
     

    Attached Files:

    Amplify_Paulo likes this.
  11. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    1,192
    Hi, so I'm running Unity 2017.3.0f3 and I installed the latest Amplify Shader Editor (1.4.3_dev03) as well as the samples into a fresh project. All the shaders that I've created previously that I know work only show white in the viewport and game windows. I've even open example scenes and they're also white as well. What am I missing?

    Thanks.
     
  12. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Did you change the zdepth writing in some way? Are shadows in the wrong place or simply non-existent? Also, be advise that some options, like blend modes, don't write to depth so they can't have shadows unless you cheat.

    I just re-checked on a new project and everything seems fine. Also, keep in mind that the editor only creates and edits shader files. Unless you manually open them and re-save them the editor is not capable of changing all your shaders in your project. If you say you all your shaders are white, either they did not import correctly or some global setting is messing them up, and considering that even unity shaders are white then your project must be corrupt in some fashion.

    Try creating a new project and check for a unity standard shader, is it white? then import ASE package and check that shader again.
     
  13. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387

    Don't miss out on the latest sample and Shader Function included in the Amplify Shader Editor package. Simple to use, drag and drop, Radial UV Distortion.

    Get it now: Download Page
     
    Hitch42, blitzvb and hopeful like this.
  14. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    hi guys,
    I have a question for you.
    I'd like to make an animated black&white mask that using a greyscale gradient input texture.



    This is what I'd like to do.
    The texture source is the gradient that drive the animation, and the output should be that black&white mask that moves from right to left (and back) using the input greyscale as a positional reference whre change color from black to white.

    Do you think is doable with ASE? Have you something to suggest to replicate it?
    Thanks in advance for any advice.
     
  15. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356

     
  16. HellGate94

    HellGate94

    Joined:
    Sep 21, 2017
    Posts:
    132
    Hey, so far im very happy with AES
    i got some suggestions that i would like to see in it in the future:

    • Snap to Grid for Nodes
    • Reroute Node allowing to connect to multiple other nodes (similar to how a custom node who passes trough the input to output would behave)
    • Shader function disable inlining option
    • Array variable support (loops would be nice as well)
    • Refraction settings (chromatic aberration switch, ior / pixel offset switch)
    • Quality and feature level switch (like in ue4 https://docs.unrealengine.com/lates...bility/ScalabilityReference/SC_SwitchNode.jpg)
    • Vertex to Fragment with Tessellation support
    • Texture Array creator to create custom mutable objects that create the final texture array instead of a window (to change textures easily)
    • World Normal to Tangent Normal node (custom node creates a function that does not allow access to hidden unity variables needed for that)
    • Deffered Light functions (similar to how ue4 does it. idk if that would be possible)
    keep it up :)
     
  17. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Are there any collections of shaders that are available for the Amplify Shader Editor beyond the sample shaders?
     
  18. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160

    Thank you @Ziboo but trying to make the request easy to show you, I've created a too simple case.
    Actually, the gradient as an arc shape, imagine a quarter of a circle. Do you think it will be UVs useful yet?
     
  19. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Hey there, thx for the suggestions!

    Some notes on them.
    1. You can already snap nodes to grid, start dragging a node or a collection of them with shift or control, then hold both to turn drag on. To be honest, now that I had to explain to you it does feel convoluted. We'll try to find a better alternative for sure.
    2. Not sure what you mean by rerouting, isn't that the relay node or the reg/get combo?
    3. What would be the purpose for this? Shader functions right now can use any node in them and are able to optimize the code as intended, by having them generate an actual function it would be a pain to deal with some nodes and we would need to scrap some of the optimizations we do.
    4. Yeah, this we are lacking for sure. It a though one to solve so right now the only way is to use custom expressions :| we need to work on this.
    5. You mean having a toggle at compile time or at the material level? We shy away of introducing new keywords unless strictly necessary.
    6. Thats not a ASE feature. ASE can already switch between values, unity does not provide any quality setting inside the shader, but there's nothing stopping you from provide that value (whatever it is) to the shader and using it accordingly.
    7. As I explained previously this can't be solved right now, it's a limitation on unity's tessellation function, we are aware of it and we want to recreate them to add more custom stuff to them but that will need the new template features that we are working right now.
    8. Not sure if I understand this one, do you mean creating an asset file that can be reopened?
    9. The current world to tangent matrix node does not create a function, it actually re-defines a function that already exists but wasn't always available. Not sure what you mean by hidden variables tho.
    10. We have thought about it before. Maybe for SRP? not sure because this always involves something outside the shader world.
     
  20. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Do you mean like this?

    2018-02-02_11-25-00.gif
    It depends on how exactly do you need it. It's also possible to do some antialiasing on the edge of black and white, this is just the simplest cases I could think of.

    Check the atan2 doc page for another similar example.
     
  21. HellGate94

    HellGate94

    Joined:
    Sep 21, 2017
    Posts:
    132
    1. oh nice could not find it in the docs. i think a magnet button similar to how blender does it would work the best
    2. the relay node yes. right now you can only move the line around but it would be so much better if i can have 1 input and many outputs like any normal node (https://i.imgur.com/C5YKDLQ.png)
    3. Makes sense. it would help mainly with debugging the generated code by making it more "human like" and readable.
    4. nice to hear that :)
    5. i would suggest something like ue4 does it by placing some checkboxes or dropdowns in the shader (https://i.imgur.com/FqciWy6.png)
    6. hmm i see. i guess they don't have that because you can overwrite the default quality settings
    7. roger that
    8. yes pretty much. if you want to update or add a texture you have to fill in everything again inside the creator window and overwrite the file. would be much user friendly if it would store all the settings in a scriptable object or something like that and then just hit generate to create the actual texture array object
    9. nevermind i mixed up the matrix multiplication order (since its different based on the way the matrix stores its values). that was the reason for the wrong results and me thinking this is not what i'm searching for
    10. yea it's a shame unity does not support that out of the box. hope they will change that soon. i guess post shaders are on the same list
     
    Amplify_Paulo likes this.
  22. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Sorry, missed your post.

    No, not exactly. You can find a few shaders in this thread but they are not organized or anything. Our samples are our go to solution to a starting point for shader creation. Were you looking for something more specific?
     
    antoripa likes this.
  23. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    348
    Simple question, do Grab Screen Color and Screen Depth have the same input? I noticed the first one wants a float2 named "UV" while Screen Depth wants a float4 "Pos". Consequently I got some problems synchronizing these two.
     
  24. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I'm looking to create some high performance and high quality metals and plastics.
     
    KRGraphics likes this.
  25. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    hi ASE guys, is there a way we can add a depth pre pass to make transparent objects render correctly?

    this is exactly what I mean:

    https://forum.unity.com/threads/transparent-depth-shader-good-for-ghosts.149511/

    taken from that post:

    thanks!
     
  26. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Thank you... but again I failed to explain my needs.... :) anyway now I've learned something new. :)
    Sorry..when I spoke about arch...I was actually thinking about a not perfect arch... to be more clear now and to excluse something "easy" mathematically explained shape, think to a gradient shape like a snake... :)
    Anyway I think I'll try with the Step node that it seems "my best friend" :)

    Have you any tips for this? Using the step node I see that it could be useful to do antialiasing.
    Thanks in advance
     
    Last edited: Feb 3, 2018
  27. Crocomodo

    Crocomodo

    Joined:
    Nov 21, 2017
    Posts:
    29
    I can make Silhouette Shader with ZWrite and ZTest for Outline node now. Great works! I am so happy with this plugins.
     
  28. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Hi, sorry for the delay.

    1.- No, I don't changed zdepth.
    2.- Shadows exists, but doesn't mach geometry.
    3.- I haven't used blend modes.

    To clarify: I multiplyed vertex normal * my custom garyscale texture and insert in to vertex offset slot, I don't know if this is the best (or correct) way to add a displacement map.
    Any Ideas to fix the shadow problem?
    Thanks!

    Edit:
    If I disconnect the Normal input of the shader, the shadows are OK, but... for my project I need per pixel normals :(
     
    Last edited: Feb 4, 2018
  29. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Probably I've found a bug...or at least something I can't understand the reason.
    I have this node setup



    And in the ASE window, the node preview is correct and it performs like this video

    https://drive.google.com/uc?id=1Ajt0WqCIQi53AROE80Cj8SBYGwTSWmOe

    The problem is that when I press Play I see all blck without any changes in the material.
     
  30. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Fair question. They are similar but not the same. The screen color wants the screen position sure, but it wants it in a very specific way because there are a few differences between openGL and directX and in the end it only really needs the X and Y components. So in other words, it needs the screen UVs because in the end this node is sampling a texture like any other, only this texture has the dimensions of your screen and has a copy of what was rendered in it already. Hence the UV port name. And because it requires a few alterations we call it grab screen position, which is an actual node and should be used in conjunction with grab screen color. Do notice however that this node outputs a float4 value and not a float2, this is simply due to some optimizations to who does the normalization of the UVs, both grab screen position and grab screen color have a normalize option and only one should be on.

    The screen depth node is a bit different. In theory you should only need the X and Y components but apparently there are some issues with some platforms that require more that two components. Also, this does not need the special considerations that the first case did so here you would use the screen position node instead. So in theory this should also be a UV input but to make the distinction more clear we call it pos. We are open to suggestions tho, this isn't all set in stone.

    And the standard unity PBR does not provide what you want? I know I'm repeating myself can you be even more specific? :D For instance, maybe you are looking for a specific BRDF model? Maybe you don't care about GI? Or maybe you don't like the look of these shaders and you saw something somewhere else? I would say unity default shader is actually pretty great for default plastics and metals.

    Yes, first set your blend mode to transparent, then set it to custom. By doing this the editor will assume the previous option of transparent and change the advance options accordingly. Setting it to custom is needed so you can change the default depth options.

    Then go the depth option and check where it says "extra depth pass". This will create the depth pass that you need.
    Unity_2018-02-05_10-54-02.png

    The antialiasing can be done by using the fwidth and a divide node. Keep in mind this cost some extra performance so use it with caution and do some performance tests :p

    Unity_2018-02-05_11-04-45.png
    I'll save you the trouble and in attachment goes this very shader function. Use it like you'd use a step node.
     

    Attached Files:

    Cleverlie and marcatore like this.
  31. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Can you send me the shader? from your description alone everything seems fine. Something else must be cause that. Here's what I got in a fast example (notice how the shadows are correct)
    2018-02-05_11-17-34.gif

    Uau you found something weird and interesting :D
    As soon as I saw your graph I knew it had to do with remainder node but I wasn't expecting the preview to work. The issue is that remainder requires integer values to work, it doesn't work with float values, so what you see when you compile should be correct. Or so I thought, strangely enough it does work with float values as a long is not a surface shader, thats the reason the preview is working, because it's using simple vertex frag shaders. Remainder has given us troubles before, we even considered removing it at some point in favor of Fmod node, which pretty much does the same thing but uses a cg function instead of an operator. We'll be doing a build today and we'll do some changes to the remainder node so that it generates an fmod call when used surface shaders. If you are in a hurry you can do this by substituting the remainder node by the fmod node.

    I've done some SDF shaders before and think the solution is much simpler than you first believe, simply use a custom expression node. With that node you can set it up to be a regular function by return a value so you can place your for loop and whatever you require for the SDF to working in just one node. You can then place that node inside a shader function and reuse the shader function everywhere you want. Just be careful with those constants, either set them inside the function yourself or place them as parameters to the function in the custom expression node. Also be careful with the input names as they are used inside the function.

    You seemed to be hinting at that but maybe you weren't aware custom expression can actually generate functions? The only thing we haven't been able to do properly is to only generate the function once and not multiple times for each use. Performance wise is the same but it does not generate a pretty code.

    [edit] I just realized that you want the function calls to have a constant name and I dismissed it. But I don't think you need that, at least I don't see why would you. Either way can't you do it by having multiple outputs in the template? Each one would represent the various data you require to call your function which would already exist in the template or am I missing something again?

    Here's a simple example:

    Unity_2018-02-05_12-12-11.png
     
    Last edited: Feb 5, 2018
  32. Wekthor

    Wekthor

    Joined:
    Apr 30, 2011
    Posts:
    162
    Hi, i have a question about the Texture Array tool which comes with this plugin. Its great and all, it works well with the shader i created with Amplify, but there is a problem. I found out that the size of the Texture array is 60 MBs on disk with only 6 1k textures in it.
    I am not sure how is that even possible since with RGBA32 the texture size is supposed to be smaller. Also is it something i should use for our game, since it seems its huge memory overload to use TextureArray with 10 MBs per texture at 1k res. Can you please elaborate how all this works and affects performance.
    It would be huge help as we are deciding if to use this workflow and it could be huge problem later on if we use it now and find out it destroys our memory.

    Thanks
     
  33. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I think I finally get it. We had a small discussion about how can we support this. It's not easy and most likely we will add support in little steps. First we will add the ability to get a local variable from a template, like getting the position for the SDF calculation. Then we'll change custom expression node to be able to right back to one of these local variables. These two should already allow you to be able to do SDF in the editor albeit in a hackish way. The for loop will need more thought so no promises there, we first need to figure out how to run the body of the loop and deal with arrays.

    To be honest, that just might be due to texture format issues I was having in 5.4 that might not be no longer relevant. Let me study the issue further so I can give you a proper answer, it might just be a question of adding the remaining texture format types.
     
    hopeful and brisingre like this.
  34. Wekthor

    Wekthor

    Joined:
    Apr 30, 2011
    Posts:
    162
    Thanks for looking into it. Btw i tried adding DXT1 i think ( or DXT5 ) as a format, but it complained about not being able to use compression for SetPixels32. I am sure you know a bit more about it than me, i just tried to quickly hack it into compression :) It was great tho, since the Texture array asset went from 10 MBs ( for one 1k texture with RGBA32 format ) to 300 kbs, that would be awesome, if it was possible. Because that would mean we could use the workflow with Texture Arrays.
     
  35. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    I made a quick blog post about a setup I have established to code shaders on the go with ASE : https://podeplace.blogspot.com/2018/02/i-am-spending-quite-some-time-each-day.html
    While commuting each day, I mostly stand up, so a tiny 8" tactile tablet, with Unity 2017.1 and Amplify Shader Editor allows me to test and prototype a few ideas.

    I'm using a cheap Teclast X80 Pro (Intel Cherry Trail Z8350 (1.44GHz) and 2 GB RAM...), and yes, it works !
     
    Amplify_Paulo likes this.
  36. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I've been able to compress them, but I'm still having issues with them, Unity is spewing out errors in the process but the textures seem fine. I'm updating this and either today or tomorrow I might have this ready with some extra goodies on the side ;)

    Wow that's pretty awesome, even I didn't know it would work. We might be able to add some support for some gestures, tho I would first need so similar setup to test on. Pinching for zooming is a no brainer but the various click combinations might be tricky, what would be the most annoying thing besides zooming in your opinion?
     
  37. Wekthor

    Wekthor

    Joined:
    Apr 30, 2011
    Posts:
    162
    Thats awesome, many thanks great sir :)
     
  38. Amplify_RnD_Rick

    Amplify_RnD_Rick

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

    We've just uploaded a new build into our website.

    Over the last week we did some unannounced updates over the website build so here are the complete release notes from all of them.

    Release Notes v1.4.4 dev 01:
    • New Shader Function:
      • Radial UV Distortion
        • Sample with the same name was also added to demonstrate its usage
    • Improvements:
      • Custom Pragmas, Includes and Defines are now also included on the Outline pass
      • Automatically removing crlf from copy-pasted code over the 'Custom Expression' node
      • Custom Render Type can now be specified on the Render Type dropdown over the Output node properties
    • Fixes:
      • Fixed issue on excluding Add Pass independently of Debug port connection
      • Fixed issues on 'Remainder' node

    This build was also submitted to the Unity Asset Store and will be available soon over there.

    Happy shader creations!
     
    marcatore, hopeful and brisingre like this.
  39. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    Uhmmm, complex issue. That generation is needed because while you might not need it now at some point there'll be nodes that need to generate temporary variables in the shader. Like samplers that generate global UVs to be shared among other samplers.

    You can however move the
    Code (CSharp):
    1. /*ase_frag_code:i=v2f*/
    inside the loop or somewhere that makes sense but you might still have problems if you need different local variables in different scopes of the code. We need to figure out a good way to deal with those situations. Injecting the code in the previous line might not solve the issue for various reasons. Nodes are aware of global-local variables (variables in the scope of the function) but not for variables in different scopes so an issue can happen where a node might be using a variable that only exists in a different scope.

    This was never an issue because so far there weren't any cases with for loops that change the scope. Thx for all your tests, we'll definitely need to find a good overall solution. For now just try changing where that tag is and see if it helps.

    [edit] Just looked better at your code and noticed it might not work in your case. Still, tomorrow morning (GMT+0 here) we'll have a internal discussion about this very issue. Your case is pushing boundaries here :p and thank you for your patience.
     
    Last edited: Feb 6, 2018
    brisingre likes this.
  40. Igualop

    Igualop

    Joined:
    Mar 1, 2017
    Posts:
    30
    I've downloaded the version from the Asset Store and noticed that the ChangeLog.txt only lists up until v1.3.9 dev 01 and that some files went missing (I was using v1.4.3 dev 01).

    I've tried reopening Unity (2017.2.1p3) and downloading it again and the problem persists.
     
    Amplify_Paulo likes this.
  41. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    When sampling a texture which is set to 'Clamped', outside the [0,1] range, the last row of pixel is stretched to the edge of the 3D model (as it should do). What's the best way to output some black color (or any color) when sampling a texture outside [0,1] ? (For example when using a parallax offset node, for various reasons I can input UV to the Texture object that are outside the usual range).

    Edit : a quick screenshot to illustrate what I'm talking about : https://imgur.com/H2MYKvi
     
  42. bojlahg

    bojlahg

    Joined:
    Dec 29, 2011
    Posts:
    13
    There are some problem with AssetStore. Trying to download/update ASE from AssetStore. Resulting download is package version 1.39 instead of 1.44.
     
    Amplify_Paulo likes this.
  43. SixThreeZero_Studios

    SixThreeZero_Studios

    Joined:
    Jul 18, 2017
    Posts:
    106
    Heya,

    So I've been helping @brisingre pick at this issue in my spare time, and while we have come up with various solutions and workaround to make it all work there is really one thing that seems like it would be the answer to all the problems, potentially easier (we hope) to implement, and open up some pretty useful possibilities in general. As brisingre said expanding the template tags, and adding a touch of functionality.

    Ideally the distance field would ideally be able to be written with nodes, and generated as a singular separate function in the shader inside a specific function block. This would solve all the problems as you could then write a custom template with an injection point for the contents of the function.

    You can ALMOST actually do this with the current template tags, if you are careful and only use nodes that chain their output down. The problem though is we are abusing the tag system. We have created a function in the template, and use a tag in that function to hook the function output into. This works, except any variables that are registered do not get registered in the function, its registers them "where its supposed to".

    So it would seem to us, the potentially easiest, and most flexible solution to not only do this, but open up other possibilities would be to expand the tags available to templates a little bit, and a small tweak (Ok, i imagine its small maybe not) to when/how local variables are registered.

    So here is the specifics of how we think it should work.

    Proposed New Template Tags/Functionality

    /*ase_local_var:Name*/
    These tags when placed in a template would mark places that local variable registrations are output to.
    When you use the "register local variable node", you would get a drop down or something somewhere to select "default" location, one of these tagged locations, or "No Output" (more on no output later)

    The only shortcoming here is nodes that register their output to a local variable would need a way to know where to register the their local variables. There are a variety of ways to do this, from simply having an "output" drop-down which relates to template tags on all nodes as brisingre said, or by intelligently backtracking from which template port tag the chain was hooked in to.

    /*ase_code:Name*/
    This tag accepts any data type to be connected to the port. Whatever the output of the nodes you hook up to it, it is dropped right HERE in the code.

    /*ase_data_target:Name;Type*/ default /*end*/
    A target-able port which requires a specific type and drops the code RIGHT HERE.

    /*ase_function:FunctionName;ReturnType;ParameterType1;ParameterType2;etc*/
    This registers a function in your shader template, and exposes it to the graph. The function definition right here is exactly what is needed to make a node out of this function, so it should be possible to dynamically generate nodes based on functions found in shader templates instead of having people make expression to use them.

    And since we can put our other tags inside these functions inside the template, the internals of it are dynamic, and are driven by what is hooked up to its ports. Now we can use nodes in our graph, for functions we are designing in the same graph and have them written to a singular static function (and have multiples of them).


    Now obviously a lot of this depends on how easy it is to add new tags to the template system, and how easy it would be to make variables be targeted to these tags, we are hoping not to difficult.

    I think with those 4 tags, and adding the ability to target the code that is output when a local variable is made, you can now pretty much do anything. I know anything is vague and open, but it really kinda opens up that much possibility.

    Really the big thing out of all this is some way to target where local variables are generated as everything else can kinda be hacked around, but the variables put a dead stop on a lot of it.


    Going One Step Nuttier

    If you wanted to get REALLY crazy, and we are, you can take all this a little further, which is beyond anything need for the scope of the original problem, but takes everything into even more awesome areas we think.

    This is where the "No Output" for the targeting of variables when you register a local variable comes in.
    If you selected "No Output" for the target of the registration of the local variable, the output of the port of that node would be the actual code to create the variable not the variable name as usual.

    Now you are outputting lines of code as strings. Start building them up, and you now have the contents of a function. But why do this? I thought the new template tags solved this? It does, but only for predefined functions within already within the template.

    If there were another node which allowed you to specify the name and signature of a function and took this built up input and output it all together, you have now completely dynamically generated a new unique singular static function from nodes in the graph. Now since we know the name and signature of the function this "Function Generation" node is generating, we can if i understand correctly use expressions to create a "fake node" that calls into this dynamically generate function.

    This "Function Generator" node would build up the code, and send it to its output, which you would hook up into and /*ase_code*/ port from the template. Or optionally a "function" port type could be added for "usability" to ensure people don't hook up the wrong things to the wrong places.


    Thanks for listening, hope that lays everything out nice and neatly.
     
    brisingre likes this.
  44. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    I can confirm it, we are very sorry about his. Something must have happen at the submission process and the version we wanted to submit got deleted without us realizing leaving only an older version for unity 5.4 :| We are currently fixing this asap. Extremely sorry for this inconvenience.
     
    Igualop and brisingre like this.
  45. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    I found the error (bug?) the problem appears when you use Tessellation + Normalmap + Displacementmap! :eek:
    If I change mi low poly object with a highpoly version and remove Tessellation on the shader, everythin is OK.
    It's the correct behaviour? I don't whant to load a very high poly object.

    P.D: To reproduce the error, simply use a low poly object and activate Tessellation on your example shader.
     
  46. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    @Igualop and @bojlahg
    We have updated the package in the store to the correct one, sorry for all the troubles.

    That is relatively easy to do. You simply need to filter the result with the border of the UVs so you can use the step node to test values and return either 0 or 1 if the values are inside or outside the 0-1 range. If a different range is needed you need to use different test in the step nodes.

    Like this:
    2018-02-07_11-06-09.png
    Hope that helps ;)

    @brisingre and @SixThreeZero_Studios
    First and foremost, thank you for all your suggestions and interest in the subject. It's been a good stress test for us in our template implementation.

    We analyzed your suggestions and discussed what could be done. These are our main takeaways from it:
    1. Whatever is the solution we implement, it as to be done in different stages, for two reasons: one, because it's just not one thing that needs to be done but multiple ones, and some a lot more complex than others. and two, because we are currently changing the template system to support multiple subshaders and shader passes which is by itself a big code change so adding another complex system on top at the same time would be overkill.
    2. Like you pointed out the biggest issue by far is having the ability to write local vars into different parts of the code. This by itself is one of the big ones that will require a lot of changes and because of the reasons in #1 we decided to work on it AFTER the multipass is finished. Every other feature seems to be have a dependency on this one so this has priority over others.
    3. There is at least two of the changes that we thought to be small enough that we can do now without interfering with the rest. This is the ability to access a template local variable and the ability to make the name of a custom expression static so it only generates once. Not a big thing I know, but these are the small steps that we need to take and it's fast enough to add for the next build or so.
    4. Writing for loops or turning whole groups of nodes into functions are even further into the roadmap. This is because this will need a lot more careful thought to not mess with the rest of the editor. Not only we need to figure out how to deal with arrays, function body and function generation we also need to evaluate a bunch of nodes because a lot of them create local code that would not run inside a loop or a function.

    I do want to point out tho that there are lots of nodes that generate local variables and not just registers nodes, so the solution can never go through selecting through a list where the code will be generated because would mean that all nodes would need that option which is too confusing. We are however considering intelligently inserting the respective local variable code before each output tag and somehow figure out the scope to know when a local variable needs to be generated more than once depending on the scope. We are considering checking for the indentation but we'll know better when we get there. We also want it to flexible enough that it doesn't only work when used with loops but in any other weird case.

    Another thing I want to point out is that the custom expression nodes already allows to execute code without assign anything, its the "call mode" toggle. Theoretically you can even use it to assign something to a template variable. Unfortunately its one of the nodes that generates local variables so it would break without proper scope.

    All in all, some of things will take a bit longer but we'll get there eventually. Hopefully in proper time for your projects.

    thank you once again ;)
     
    Igualop likes this.
  47. Andrey_Graphics

    Andrey_Graphics

    Joined:
    Oct 29, 2015
    Posts:
    140
    how to smooth? upload_2018-2-7_18-42-14.png upload_2018-2-7_18-44-53.png
     
  48. Amplify_Paulo

    Amplify_Paulo

    Joined:
    Jul 13, 2017
    Posts:
    297
    That's a compression, resolution and precision issue. Make sure your map uses a format that compresses well. You can also try not using compression at all but it will cost you memory. Also, if the map is simple an 8-bit image then you might not have enough precision to represent different values. Save it as a 16-bit, one channel image for best results. You might have to author your texture again to add the extra details. You should also make sure you texture is in linear space, both when creating and in the importer.
     
  49. Andrey_Graphics

    Andrey_Graphics

    Joined:
    Oct 29, 2015
    Posts:
    140
    thank you, the format RGBAFloat much better upload_2018-2-7_19-28-18.png upload_2018-2-7_19-26-43.png
     
  50. Amplify_RnD_Rick

    Amplify_RnD_Rick

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

    A new build was just uploaded into the website.

    Here are the release notes.

    Release Notes v1.4.4 dev 02:
    • Fixes:
      • Fixed issue on templates where vertex normal was being declared as a float4 on vertex data
      • Fixed PS4 issue on billboards generated code
        • Updated Orientation Based Sprite sample to include fix
    • Improvements:
      • Changed texture array creator to support compressed formats
      • Added custom inspector for texture arrays to allows previewing their contents on the inspector window
      • Added new Set Unique option into 'Custom Expression' node
        • If toggled off, generated internal function doesn't use unique id on its name

    Happy shader creations!
     
    Last edited: Feb 7, 2018
    hopeful likes this.