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

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Just confirmed it and it fixed it. It really is a weird issue but I'll avoid Int in the future unless it's absolutely necessary. Thanks for the fast reply :)
     
  2. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    No problem, glad to help. I figured if I could field a question that was about mesh geometry in general, and not ASE specifically, that would free up time for the ASE folks to implement all those features that a certain annoying customer (ahem!...me!) keeps requesting. :)

    If it would help, I can pretty quickly generate for you some sample geometry with UV1, UV2, and UV3 populated as I described (UV1 standard unwrap, UV2 lightmap unwrap, UV3 a seamless unwrap for your decals). I'd even be willing to crank out a quick (but trivial) ASE shader to show how to use them.
     
    Amplify_Ricardo likes this.
  3. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Cool!

    Just to be clear to other users, that is the expected behavior when dividing an Int unless it'ss cast using a float; required if you want to divide two integers and want a fractional part.
     
    syscrusher likes this.
  4. owenchen1994

    owenchen1994

    Joined:
    Oct 26, 2019
    Posts:
    7
    I Tried with the regular unity cube, and now it behaves as I expedcted. But why is partical system behaves differently?
     
  5. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    This happened in one of my shaders, too, but it was a transient that I couldn't replicate after restarting Unity, so I never reported it.
     
  6. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Perhaps the "object space" for particle shaders has its origin at the emitter object, and not at the individual particle? That's just a hypothesis -- I haven't tested it.
     
  7. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
  8. _6__

    _6__

    Joined:
    Jul 13, 2015
    Posts:
    11
    Hi all,

    I've only just started playing with the amplify shader, so I haven't gone through all the training material yet. But I've been playing with the Sobel shader to get a black outline of objects on my scene, and that works great. But the edge detection picks up the edges on shadows too, which isn't what I would like.

    Can someone point me on the right direction on how I would pass the un-shadowed scene to the Sobel shader, then apply the shadow pass afterwards? I'm just looking for a general direction or example shader I can examine.
     
  9. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I was wondering if _CameraOpaqueTexture , Grab Screen Color node work with URP 2DRenderer ?
     
  10. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Hello there, hope you're having a nice learning experience!

    In this case the Image Effect has no information of what is a shadow in your scene, you could try playing with the depth/normal threshold in order to exclude artifacts or some other means.

    Perhaps this can help as we don't have any specific samples on this: https://roystan.net/articles/outline-shader.html

    Another way, but this is very hacky, would be to use one of the available Deferred Gbuffer textures Unity generates; in this case I used _CameraGBufferTexture0(Albedo) instead of the actual input of the Screen Tex template parameter.

    upload_2020-8-28_10-50-45.png

    I don't think that was working, let me check with the devs.
     
  11. Scornz

    Scornz

    Joined:
    Jun 15, 2014
    Posts:
    27
    Hello everyone,

    I am continuing to work on my "world reveal" shader, and I have been trying to get the noise to be the same across differently scaled objects. My attempt has mostly been through trying to implement triplanar textures for the noise, and it's been working great, however, the texture changes depending on the scale of the object. I am sure there is another, smarter way to go about this, but if I am being honest, I am still learning. I am just reaching out for some advice, so that the textures projected on these differently scaled objects appear the same. I am attaching a "large object" and a "small object" along with all of the shader nodes. If anyone has any advice on how I should change my approach so that this shader appears the same no matter the size of the object, I would be very appreciative.

    Large object:


    Small object:


    Both objects side-by-side:


    Shader nodes (link --> http://paste.amplify.pt/view/raw/4465d2e8)


    Thank you, and please let me know if you need anymore information!
     
  12. _6__

    _6__

    Joined:
    Jul 13, 2015
    Posts:
    11
    Thanks for the help, Ricardo, but I couldn't get the screen working. Is _CameraGBufferTexture0(Albedo) a global value I can use out-of-the-box, or do I need to set it using SetGlobalTexture() on the Sobel C# script?

    I tried various ways of the doing this, but nothing seemed to work and I just ended up with a black screen. There doesn't seem to be much help when I search Google either.


     
  13. AtomsInTheVoid

    AtomsInTheVoid

    Joined:
    Jul 27, 2015
    Posts:
    251
    If you're making a decently large world, you might wanna know there's a new way to fly around your scene all the cool kids are using. Once you see this you'll wonder why no ones thought of this before!

    Just point off in the distance and fly! Preview camera let's you know where you'll land and you can even adjust the final view before you jump. You'll save tons of time and even have fun exploring your beautiful worlds.

    https://assetstore.unity.com/packages/tools/utilities/scene-pilot-177244
     
  14. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Is there a way to use the flipbook aimation node so it lerps between frames?
     
    laurentlavigne likes this.
  15. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    hmmm switching to custom lighting i'm not getting any texture color on the object when color is linked to albedo
    upload_2020-8-29_18-49-59.png

    [EDIT] in the toon sample the custom lighting node only gets customlighting bucket connected, not albedo, not emission ... why is that?
     
    Last edited: Aug 30, 2020
  16. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    how do i make a custom outline? it's been asked a few years ago to which the answer was we're working on it... without custom outline we can't get toon edge on displacement and when doing a camera near dither fadeout we see the outline inversed hull
     
  17. _6__

    _6__

    Joined:
    Jul 13, 2015
    Posts:
    11
    Oh, ok, I was being a bit dumb. It worked fine when I used _CameraGBufferTexture0 rather than _CameraGBufferTexture0(Albedo). Thanks again for pointing me in the right direction, Ricardo :)
     
  18. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I finally got my volumetric explosions to the point where I'm half happy with it. It's completely 3d volumetric and casts self-shadows depending on the sunlight angle. The opacity, flames, smoke density and light dissipation are all adjustable and the best part is the entire thing only uses two 2K textures and nothing more :) The limitations are that on close shots you can see resolution artifacts and it doesn't cast shadows on the ground to optimize the FPS.
    If I can manage to use lerp transitions with the flipbook node, the animation will look even smoother.

     
    Squize, Kin0min and Korindian like this.
  19. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389

    Hey there,

    Maybe you can use the Object Scale to drive the Noise.


    Glad you found a solution, sorry for the confusion there, it's really my fault. I should have said "_CameraGBufferTexture0"(Albedo).

    Hey cool, does it use ASE?


    Afraid not, that's not the intended purpose of the flipbook.


    That's for baked lighting.


    Hold on, what's this post you're referencing? We've discussed outlines many times, we tried to be very clear about what kind of outline we support and the improvements/changes we've made along the many years we've been talking about it.

    ASE provides, much like Unity, the common Vertex Offset outline option; on the Shader Output parameters or directly with the Node that's been improved along the way.

    This works a bit differently on URP but it's the same principal.





    Great work, this looks awesome!

    Have you considered using a Flow Map?(we include a shader function to get you started)

    Seems to be quite useful for this kind of stuff:
     
    syscrusher and laurentlavigne like this.
  20. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    That's a good idea. I'll see if I can make it work with this system.
     
    Amplify_Ricardo likes this.
  21. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    ok, for light to bounce off of.

    Excellent. That node probably can handle proxy fade but I don't see how it can do displacement map
    I was referring to multipass in ASE but I think with the outline node what i need is there, just need to plug the right thing in the right place.
    http://paste.amplify.pt/view/raw/250a911d
    this isn't working yet: when i set alpha mode to masked and plug in the dither the outline disappears completely, i tried cull off, no good, any idea?
    upload_2020-8-31_17-9-51.png
     
  22. owenchen1994

    owenchen1994

    Joined:
    Oct 26, 2019
    Posts:
    7
    Hi~
    I am having a touble with the double-side transparent material.
    It seems that the front and back face cannot be detected corrently.
    I have attached the unity pachage.
     

    Attached Files:

  23. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    Have you tried masking the shape prior to generating the triplanar noise that way it gets fed in to the triplanar process or even applying the mask just after you sample the triplanar UV for each axis before you add each axis together? Right now youre generating triplanar and applying the mask after.
     
    Last edited: Sep 1, 2020
  24. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    why are the normals smoothed out with a amplify shader?
    original with surface shader
    Code (CSharp):
    1. Shader "SG/SG Opaque" {
    2.     Properties {
    3.         _Color ("Color",Color) = (1,1,1,1)
    4.         //_damageValue ("Damage Value", RANGE(0,1)) = 0
    5.         _MainTex ("Texture", 2D) = "white" {}
    6.         _DamageColor ("Damage Color", Color) = (1,0,0,1)
    7.         _CommandColor ("Command Color", Color) = (1,1,1,1)
    8.         _HealColor ("Heal Color", Color) = (0,1,0,1)
    9.         _BumpMap ("Bumpmap", 2D) = "bump" {}
    10.         _RimColor ("Rim Color", Color) = (0.26,0.19,0.16,0.0)
    11.         _RimPower ("Rim Power", float) = 3.0
    12.         _OutlineColor ("Outline Color", Color) = (0,0,0,1)
    13.         _Outline ("Outline width", float) = .005
    14.     }
    15.     SubShader {
    16.         LOD 900
    17.         LOD 800
    18.         Tags { "RenderType" = "Opaque" }
    19.  
    20.         CGPROGRAM
    21.         #pragma target 3.0
    22.         #pragma surface surf WrapLambert approxview  vertex:vert nodirlightmap
    23.         #pragma instancing_options assumeuniformscaling
    24.         #pragma multi_compile_instancing
    25.        
    26.         float4 _Color;
    27.         sampler2D _MainTex;
    28.         sampler2D _BumpMap;
    29.         uniform float4 _RimColor;    
    30.         uniform float _RimPower;
    31.         // flashing from damage and healing and command
    32.         uniform float _damageValue = 0;  
    33.         uniform float4 _DamageColor;
    34.         uniform float4 _HealColor;
    35.         uniform float4 _CommandColor;
    36.         uniform float _currentHealTime = 0;    
    37.         uniform float _currentDamageTime = 0;    
    38.         uniform float _currentCommandTime = 0;
    39.         uniform float _flashIntensity=10;
    40.  
    41.         half4 LightingWrapLambert (SurfaceOutput s, half3 lightDir, half atten)
    42.         {
    43.             half NdotL = dot (s.Normal, lightDir);
    44.             half diff = NdotL * 0.5 + 0.5;
    45.             half4 c;
    46.             c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
    47.             c.a = s.Alpha;
    48.             return c;
    49.         }
    50.  
    51.         struct Input
    52.         {
    53.             float2 uv_MainTex;
    54.             float2 uv_BumpMap;
    55.             float3 viewDir;
    56.             float3 vertexColor;
    57.             float factor;
    58.         };
    59.  
    60.         void vert (inout appdata_full v, out Input o)
    61.         {
    62.             UNITY_INITIALIZE_OUTPUT(Input,o);
    63.             o.vertexColor = v.color;
    64.         }
    65.  
    66.         void surf (Input IN, inout SurfaceOutput o)
    67.         {
    68.             half3 c = tex2D (_MainTex, IN.uv_MainTex).rgb;
    69.             c = c*(1-_damageValue) + _DamageColor.rgb*_damageValue;
    70.             c *= IN.vertexColor;
    71.             c *= _Color;
    72.             o.Albedo = c;
    73.             o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
    74.             half rim = 1.0 - saturate(dot (IN.viewDir, o.Normal));
    75.             half3 e = _RimColor.rgb * pow (rim, _RimPower);
    76.             half3 damage = (_DamageColor*saturate(_currentDamageTime  - _Time.y) +  _HealColor*saturate(_currentHealTime  - _Time.y) +  _CommandColor*saturate(_currentCommandTime  - _Time.y))*_flashIntensity;
    77.             o.Emission = rim*c + e + damage;
    78.         }
    79.         ENDCG
    80.  
    81.     UsePass "Toon/Basic Outline/OUTLINE"
    82.     }
    83.    
    84.     SubShader {
    85.         LOD 700
    86.         Tags { "RenderType" = "Opaque" }
    87.  
    88.         CGPROGRAM
    89.         #pragma target 3.0
    90.         #pragma surface surf WrapLambert approxview  vertex:vert nodirlightmap noforwardadd addshadow fullforwardshadows
    91.  
    92.         float4 _Color;
    93.         sampler2D _MainTex;
    94.         sampler2D _BumpMap;
    95.         uniform float4 _RimColor;    
    96.         uniform float _RimPower;
    97.         // flashing from damage and healing and command
    98.         uniform float _damageValue = 0;  
    99.         uniform float4 _DamageColor;
    100.         uniform float4 _HealColor;
    101.         uniform float4 _CommandColor;
    102.         uniform float _currentHealTime;    
    103.         uniform float _currentDamageTime;    
    104.         uniform float _currentCommandTime;
    105.         uniform float _flashIntensity=10;
    106.  
    107.         half4 LightingWrapLambert (SurfaceOutput s, half3 lightDir, half atten)
    108.         {
    109.             half NdotL = dot (s.Normal, lightDir);
    110.             half diff = NdotL * 0.5 + 0.5;
    111.             half4 c;
    112.             c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
    113.             c.a = s.Alpha;
    114.             return c;
    115.         }
    116.  
    117.         struct Input
    118.         {
    119.             float2 uv_MainTex;
    120.             float2 uv_BumpMap;
    121.             float3 viewDir;
    122.             float3 vertexColor;
    123.             float factor;
    124.         };
    125.  
    126.         void vert (inout appdata_full v, out Input o)
    127.         {
    128.             UNITY_INITIALIZE_OUTPUT(Input,o);
    129.             o.vertexColor = v.color;
    130.         }
    131.  
    132.         void surf (Input IN, inout SurfaceOutput o)
    133.         {
    134.             half3 c = tex2D (_MainTex, IN.uv_MainTex).rgb;
    135.             c = c*(1-_damageValue) + _DamageColor.rgb*_damageValue;
    136.             c *= IN.vertexColor;
    137.             c *= _Color;
    138.             o.Albedo = c;
    139.            
    140.             half rim = 1.0 - saturate(dot (IN.viewDir, o.Normal));
    141.             half3 e = _RimColor.rgb * pow (rim, _RimPower);
    142.             half3 damage = (_DamageColor*saturate(_currentDamageTime  - _Time.y) +  _HealColor*saturate(_currentHealTime  - _Time.y) +  _CommandColor*saturate(_currentCommandTime  - _Time.y))*_flashIntensity;
    143.             o.Emission = rim*c + e + damage;
    144.         }
    145.         ENDCG
    146.     }
    147.     Fallback "Diffuse"
    148. }
    upload_2020-8-31_21-47-47.png

    amplify: http://paste.amplify.pt/view/raw/2cf88175
    upload_2020-8-31_21-49-26.png
    see the green octagonal cylinder? it's all smoothed out in the ampligy shader, I thought it was precision but it's in float
    by the way: tooltips are missing:
    upload_2020-8-31_21-50-35.png
    see the normals are broken in the model so it should have hard edges light transition
    upload_2020-8-31_21-51-52.png
     
  25. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    static materials that are lightbaked are flickering!
    upload_2020-8-31_22-43-0.png
    and that seesaw in the shadow pass is weird, never seen it before, perhaps connected?
    attached is the shader
    the blinking happens during play or when i move through the scene with the sceneview camera
    shader blinking.gif
     

    Attached Files:

  26. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    New video. I can now lerp between the flipbook animations but decided not to use it since it drops the FPS a bit.
     
    syscrusher and laurentlavigne like this.
  27. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    tesselation breaking shader
    upload_2020-8-31_23-45-59.png
    all the time when using instanced properties
    updating the shader when those are on takes forever and then pink shader, every single time
    here try with this shader, you can even turn off tesselation
    when you set the _current*Time to instanced properties it'll bomb hard
    that's using the version 1.8.4
     

    Attached Files:

    Last edited: Sep 1, 2020
  28. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    That same flickering thing happened to me when I was using shader forge. The shader kept enabling and disabling the ambient light the material recieved for some reason which by the looks of your blue ambient light on the wall going on and off seems to be the same case. Eventually I had to disable ambient light and add it manually to emission. I still don't know what caused it to this day.
     
  29. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    only on static meshes too?
     
  30. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Mine were all dynamic.
     
  31. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    if you still have that shader, you could attach it on this forum, maybe that'll help the Amplify folks fix ASE
     
  32. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    It was made in shader forge so I don't think they should be bothered with it. I never had this problem in ASE though. Did you try switching the shader from forward to deferred and see if anything changes?
     
  33. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Ah interesting, not sure if that's something that actually works; let me check with one of the devs.

    An additional depth pass would be necessary to deal with the sort of overlap that you see in your current model, you may find a parameter specific for this in the Depth section of the Output node's parameters:




    That's strange; there's no normal difference between Unity's Standard and ASE that we know of, wondering if this could be specific to the shader type and how you're using it.

    Please prepare a sample with that model(texture, material, and shaders), side by side, so that we can compare it on our side.

    About the flickering, not sure if this is not related to batching; we need to see a sample.

    Please reach out to us via support@amplify.pt, one of our devs will examine it further.

    I can partially replicate that, one of our developers is going to examine the shader you shared. What's your Unity version?
     
  34. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389

    The problem there actually seems to be with the Camera Depth Fade node when used with the Outline node, one of our developers will examine it further; until then, I recommend using other methods such as this.

    http://paste.amplify.pt/view/raw/73360146 (Paste to Canvas)

    upload_2020-9-1_11-32-10.png
     
  35. Roman-Ilyin

    Roman-Ilyin

    Joined:
    Oct 9, 2013
    Posts:
    29
    Hello.

    I have shaders that give an error when building a project, but do not give an error in the shader editor and works (in editor) correctly after recompile.
    How could I see this error in the shader editor, or how could I builds it without errors? (win x64, standart pipeline)


    Shader error in 'Stinger/4HeightBlendedTriplanar': maximum ps_4_0 sampler register index (16) exceeded at line 70 (on d3d11)

    Compiling Fragment program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_ON DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK LIGHTPROBE_SH
    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


    https://drive.google.com/drive/folders/1a44H9A-104fWj2vvpy9zP-ETNSelLczA?usp=sharing <-- shader sources
     
  36. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Thanks for reaching out, that's actually expected. You’re limited to 16 sampler states per shader, this is set by the Shader Model used. By default each texture gets its own sampler state, which means you hit the 16 sampler limit after 16 textures; Unity may also add to this count internally which is probably what's happening on the build.

    There's a couple of ways around this, a common solution for terrains is to use a Texture Array. Alternatively, you can work around this by defining a sampler state and reusing it to sample multiple textures. I should point out that the latter is a recent addition, compatibility will depend on your Unity version and target platform.

    Regarding your shaders, I was not able to test them due to missing Shader Functions but your current texture sample node use is not recommended.
     
    Roman-Ilyin likes this.
  37. Roman-Ilyin

    Roman-Ilyin

    Joined:
    Oct 9, 2013
    Posts:
    29
    Thanks for a quick reply. I really forgot to add the shader functions. Now I have added them. Where could I see an example with TextureArray?
     
  38. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    There's an included Texture Array sample(built-in samples package), and a tool that allows you to create Texture Arrays. Other than that, I'd recommend looking at Unity official sources as this is something they provide.

    Check this out: https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Texture_Array
     
    Roman-Ilyin likes this.
  39. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    2018.4.26
    sent

    question: i toggled off what i could in the ASE UI but still have 110+ variants (!!) how do i skip shader variants? for example i do not use light cookies.
     
  40. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    extra info about this odd flicker: gfx.waitforpresent
    upload_2020-9-2_2-15-33.png
    that madness stops when I close ASE
     
  41. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Thanks, we will check it our ASAP.

    What do you mean? The compiler probably handles most of the things in there, if you're using Surface shaders it's comparable to using a Unity made shader.

    Just our of curiosity, did the shader start blinking after you turned off most of the options?


    Do not profile your game with the Amplify Shader Editor open, or any other Editor intensive plugin, there are numerous processes running in the background, including additional shaders in our case, which are going to influence it.

    Bottom line, do not profile your game performance in the editor, there are also Unity processes, always use a development build; performance is always worse on the editor.


    We will get back to you as soon as we check the sample you shared.
     
  42. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Check the latest ASE update on our site, we corrected an issue that prevented certain values from being used when plugged directly via the Outline node; you can now use the Camera Depth Fade node as you were before.
     
  43. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey All,
    Not sure if this has been posted or not (I couldn't find it), but there seems to be an issue with the texture array creator in 2019.3 and 2020.1 (didn't check other versions). When I run the array creator with the following settings:

    TextureArrayCreatorWindow.PNG

    I get the following error:

    Unable to retrieve image reference
    UnityEngine.Texture2D:ReadPixels(Rect, Int32, Int32, Boolean)
    AmplifyShaderEditor.ASETextureArrayCreator:BuildArray(TextureArrayCreatorAsset) (at Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs:755)
    AmplifyShaderEditor.ASETextureArrayCreator:OnGUI() (at Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs:355)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    and the resulting texture array looks like this:

    TextureArrayResult.PNG

    The problem appears to stem from the DXT1 or DXT5 formats which I am attempting to use as they match Unity's default compression for our target platform and give reasonable file sizes.

    We are currently using Unity 2020.1.2f1 and Amplify 1.8.4, please let me know if DXT1 is just not supported or if this can be fixed.

    Cheers,
    Colton
     
  44. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Thanks for the heads-up, we're aware of the possible issue and currently looking into it.

    Apologies for the inconvenience.
     
  45. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    maybe?
    I toggled them back on and flicker remain
    upload_2020-9-3_1-57-31.png
     
  46. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    No problem, we will check your sample soon.
     
  47. OscarLouw

    OscarLouw

    Joined:
    Jun 22, 2017
    Posts:
    7
    Hey fellas, stuck on something here.

    Do you know a way to get the object's surface depth in 0-1 space for use in the vertex offset port?

    The Surface Depth node is generating a texture in the fragment shader, so obviously plugging it into any calculation that ends in the vertex offset port breaks the shader compilation.

    I tried using Object to Clip Pos on Vertex Position, but I can't figure out how to transform that into 0-1 space based off the camera's far clipping plane.

    Cheers!

    EDIT: Hmm maybe I'm getting confused. Attached an image:



    If I plug the Surface Depth node directly into the Vertex Offset port, it compiles.

    If I plug the cutout texture sample setup above into the Vertex Offset port, it compiles.

    If I perform Step Antialiasing on both of them, I get this error:

    Code (CSharp):
    1. Shader error in 'TtS/GrassHull_VisionSquash': cannot map expression to ds_5_0 instruction set at line 87 (on d3d11)
    2.  
    3. Compiling Domain program with UNITY_PASS_FORWARDBASE DIRECTIONAL
    4. 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
    Any thoughts?

    Edit 2: Well I'll be damned - it was the Step Antialiasing function... Guess that does some funky stuff in the frag shader. SOLVED! haha
     
    Last edited: Sep 3, 2020
  48. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Ah interesting, let me check with the devs, not sure what could be happening internally.
     
  49. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,389
    Thanks for the sample, the flicker is caused by Static Batching when using the Outline effect. We've talked briefly about this but it's not explicit so I can see how it could be missed.

    This Unity outline effect we use is based on offsetting the vertices with its front faces culled so that it gives you the illusion of an outline. This is quite useful, the problem comes when you batch models that use the outline; in this case the shader uses the batched transform information instead of your model which can result in quite a few issues. This is also why you only see the flicker in play when the batching kicks in.

    It's recommended that you use instancing instead of batching in this case.
     
  50. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    You shouldn't use Unity's outline because it is doing it wrong: it changes outline size with object scale.
    Since you have to deal with many people using it anyway you need to add the option of a scale insensitive outline: I attached the fix that we've been using in surface shaders. As a side effect it also doesn't have this batching problem so it's a win-win. In the meantime, what's the way to redo outline like this in ASE? (and that will still work when I switch to URP)
     

    Attached Files: