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.

[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. gskunk

    gskunk

    Joined:
    Sep 15, 2014
    Posts:
    2
    Ah, my apologies. Was too caught up in the fact that it wasn't previewing to see that it was doing what it needed to do. Thanks for the reply.
     
    Amplify_Ricardo likes this.
  2. brummer

    brummer

    Joined:
    Jul 3, 2013
    Posts:
    28
    Could you update the documentation or at least add some short description or an example shader to the project that uses SRP additional light? There are literally 0 results on google for that node.
     
  3. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    39
    Hi,

    I am having a problem with a UI shader, the image component only takes into account the bounding box of the transparency instead of using the full image size.

    UI_Sprite.png
    Is there a way to use the entire image?
     

    Attached Files:

  4. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    Hi again, I've been doing some searching about this, so I think I know how to approach this but I don't how to do it in the editor.
    I've got this example that someone uses for a phone so I'm gonna assume this is good enough way for PC.
    https://stackoverflow.com/questions/12125223/optimising-a-palette-mapping-shader/12125320#12125320

    What I want is to use a 1d image and then convert the screen colors to the nearest one from it. But I have no idea how to get each individual color from a texture so I can use it as a lookup table.

    I also don't know how to do the actual conversion from the screen colors to the nearest in the palette. That is, which nodes to use to do the comparison math. A function that checks the distance between colors and then chooses the nearest from the texture above maybe?

    The shader also start starts with a pixelation effect using the pixelate node. Is it correct that any effect I do after this will only do calculations on the new reduced pixel count rather than the true resolution that is the actual the screen resolution?
     
  5. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey there, have you seen our low poly water sample? (built-in)
    There's also a wave Shader Function that could be help


    Yes, apologies for the inconvenience, we'll add additional details. This is only mentioned on our wiki in the Stream section, it includes a sample. We're using LW here but it's the same for URP(HDRP does not support custom lighting)
    Stream - Files

    We're also getting ready to launch additional samples for SRP, this will include a Custom Lighting example.


    Sorry, not entirely sure what you mean by "full image there" is the sprite not sliced? Perhaps we could help if we saw a full example.


    From your description, I recommend that you examine our image effects. Here you'll find specific nodes that allow you to access and manipulate the way everything is rendered. Start with the basics and work your way up to more complex effects; I recommend checking the Sobel effect.(built-in sample)

    Here's a simple example of how you can take the current screen, apply some effect to it, and output it.

    upload_2021-3-29_10-53-31.png




    As for the pixilation question, I'm afraid I don't have enough details to answer that. In any case, resolution is constant with the image effect.
     
  6. JoshWB

    JoshWB

    Joined:
    Aug 4, 2019
    Posts:
    20
    Hello, I've tried looking this up on the support forum but haven't found an answer yet...

    I'm looking to add more control to my Triplanar shader, specifically the edges that are drawn with the "falloff" node in the Triplanar Sampler. Here's what the Triplanar effect looks like now, it's very jagged:

    Capture23.PNG

    However, this is using a different shader (asset, TCP2), and there are Triplanar Parameters added via code, and the edges are adjustable to look much better:

    Capture22.PNG

    My question is, is there a way to add similar parameters to the ASE Triplanar setup? The "falloff" parameter I have below just isn't quite doing it for me:

    Capture24.PNG

    Thanks! *edit* forgot to mention this is URP 2019.4, I'm using the Universal/Unlit setup that was recommended in the ASE tutorials
     
    Last edited: Mar 29, 2021
  7. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey there, thanks for reaching out.

    Our Triplanar Node does not currently provide individual falloff control. For something like that, I'd recommend creating a custom Triplanar effect based on our "TriplanarProjection" built-in sample which does not use the Triplanar node.
     
  8. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    39
    You're right never mind, i forgot to change the Mesh Type to Full Rect.
     
  9. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    Ok, I think we have a failure of communication here. I know how to do simple image effects from all the tutorials on your wiki. And that's not what I'm asking for. Let me show you a code sample of what I have in mind.
    Code (CSharp):
    1.               uniform int _ColorCount;
    2.               uniform fixed4 _Colors[256];
    3.               uniform sampler2D _MainTex;
    4.  
    5.               fixed4 frag (v2f_img i) : COLOR
    6.               {
    7.                    fixed3 original = tex2D (_MainTex, i.uv).rgb;
    8.  
    9.                    fixed4 col = fixed4 (0,0,0,0);
    10.                    fixed dist = 10000000.0;
    11.  
    12.                    for (int i = 0; i < _ColorCount; i++) {
    13.                        fixed4 c = _Colors[i];
    14.                        fixed d = distance(original, c);
    15.  
    16.                        if (d < dist) {
    17.                            dist = d;
    18.                            col = c;
    19.                        }
    20.                    }
    21.  
    22.                 return col;
    23.               }
    This is what I want to recreate in ASE. This thing checks the color of each pixel and gets the closest value from the array _Colors by doing a distance check against all the values in the array. I don't know if a "for loop" is a good idea to use and I couldn't find a way to do that in ASE. But that is a later issue.

    This shader does not work without a script assigning colors to _Colors[]. What I want is, instead of having a script doing this, I want to use a 1d image instead of the _Colors array and compare against it directly and output the color that has the closest distance.

    {ABE5BAF2-3F2B-4EA6-B20C-F9B2A1C9D59D}.png
    Here's my shader. I want the output from Texture Sample 0 to ONLY use colors from Texture 0 above (this is a 1d texture with the color palette I want). Is this possible in ASE or is it a better idea to use code from other shaders?
     
  10. Polygoat

    Polygoat

    Joined:
    Aug 29, 2015
    Posts:
    10
  11. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Perhaps, this forum thread is dedicated to ASE support; while we try to help out whenever we can, it's really not our place to handle custom development requests unless it's specifically related to our tool in some form. In this particular case, as much as we'd like to assist, this is beyond the scope of our editor; the operations you need are not specific to ASE.

    For general shader discussion, I recommend joining our Discord server: https://discord.gg/zVdqVSp

    There are other examples out there that use a texture directly:
    -This one swaps directly from a pallete: https://forum.unity.com/threads/sha...s-pixels-colors-color-palette-swapper.212576/

    Just so there's no ambiguity here; we're not ignoring your post, this has been passed on to our devs, but it's not something we can't tackle right now as it falls out of the scope of support.

    Hi,

    Additional Directives, Include:
    upload_2021-3-30_14-15-53.png
     
  12. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    Please if it's not possible to do say so. I'm not expecting you to make stuff for me, I just want to learn.

    So lookup tables are not possible? Then if I use the array node and set its colors through a script, wouldn't that solve this problem?
     
  13. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    If you're asking if you can add a texture directly to an array, without somehow being processed, in a manner that you get an index of 256 colors, the answer is no, you get the final RGBA output of the texture.

    Of course you can use lookup tables, whatever you can do in a regular shaders should be possible with ASE even if it involves using a custom expression. You just need to know what exact operations you need for your specific requirement; this is the part we cannot answer without actually doing it ourselves.

    Perhaps this can better illustrate how LUTs are used: https://lettier.github.io/3d-game-shaders-for-beginners/lookup-table.html
     
  14. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    @Amplify_Ricardo Oh, so that's what you mean. So when you say specific operations you mean a node that does all the job for me? No, that's not what I was expecting. I actually have tried to convert shader code to ASE using the math, vector, constants etc. nodes to recreate the effects. The problem has been how to do operations where the shader does calculations on individual pixels.
    I will check your examples and more stuff. Thanks.
     
  15. Filto

    Filto

    Joined:
    Mar 15, 2009
    Posts:
    712
    Hi, I am getting some artifacts that I cannot pinpoint.

    What I want to achieve is to blend unshaded vertex colors on a baked scene. Sort of like painting "fog" on geometry. It kinda works but there are artifacts in the blended areas. Its is especially visible in the game view.

    game_scene_view.jpg

    Here is my shader code

    shader.jpg

    I am using built-in render pipeline. Any ideas what can be the culprit?
     
  16. Polygoat

    Polygoat

    Joined:
    Aug 29, 2015
    Posts:
    10
    How did I miss that one :)
    Thanks!
     
    Amplify_Ricardo likes this.
  17. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,621
    I'm having a small issue with my HDRP water shader. I know HDRP shaders are different but converting from standard to HDRP has worked pretty well for the most part except I'm having this problem with depth fade distance, I get a super bright emissive look.

    Simple-01.jpg Simple-02.jpg
     

    Attached Files:

  18. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey there!

    I would recommend starting by saving your shader with the latest ASE version available, your current version is somewhat older. (based on the version listed on the actual shader)

    Let us know if that solves the problem, if not we will need to know what's your current HDRP and Unity version.

    Thanks!
     
    florianalexandru05 likes this.
  19. gamesbydre

    gamesbydre

    Joined:
    Nov 25, 2014
    Posts:
    55
    Is there a way to enable automatic snapping to the grid, or is that available?
     
  20. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387

    No way to toggle automatic snapping, you have to hold CTRL to snap.
     
  21. Chrux

    Chrux

    Joined:
    Feb 2, 2013
    Posts:
    6
    Hi, is there any example or any way to blur a whole scene with UI (canvas with content) by another 'top-most' canvas? On the 'top-most' canvas all elements shall be sharp. I'm using URP.

    Thanks for any hint!
     
  22. Chrux

    Chrux

    Joined:
    Feb 2, 2013
    Posts:
    6
    How to make a sub graph in ASE like in ShaderGraph?
     
  23. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hello,

    We don't have an example for that at the moment but it's something you can probably assemble based on other samples. We include a simple blur example that does something along those lines:

    It uses a simple Grab Screen that offsets and overlays to "fake" the blur effect.

    You'll need a Custom Expression for actual Gaussian Blur; this is not recommended due to the excessive performance cost.(not specific to ASE, just in general)

    Shader Functions in ASE, not exactly the same but it's a similar principal. Check out our wiki for additional details: http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual#Shader_Functions
     
    Chrux likes this.
  24. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey folks, just in case you missed it, our latest update adds the option to use code files directly in Custom Expression nodes. This behavior is similar to what Shader Graph offers with "Function Nodes", let us know if you have similar parity requests.

    Available via our website, soon at the Asset Store: http://amplify.pt/download

    Release Notes v1.8.9 rev 02:

    Fixes:

    • Fixed conditional error thrown by Custom Lighting over Unity 2020.3
    • Correct template is now imported on SRP 7.6.0
    • Fixed issue on using undeclared clipPos variable on all URP Unlit versions
    • Fixed issue on usage of undeclared struct over Decal HDRP 10

    Improvements:
    • Internal AddRGBToHSVFunction is now static (API)
    • 'HD Emission' node is now imported with main package
    • Adding failsafe and error message to when used outside an HDRP shader
    • Adding File mode into 'Custom Expression' node
    • User can drag and drop a .cginc/.hsls file into the new Source field and will automatically include it on shader as an #include
    • Function call uses value set on Name
    • Can also automatically add precision suffix into call via the Precision Suffix toggle
    • Behavior similar to Shader Graph

     
  25. Jayme65

    Jayme65

    Joined:
    Dec 11, 2016
    Posts:
    93
    Hi,
    In the example below, a simple sphere inside a glass tube. Refraction index at 1 left, at 0.97 right.

    The problem comes with the artifacts (in purple on the right image)
    This is even more evident on this view (artifacts in magenta)

    How could I please get rid of it?

    The refraction is achieved simply with a Refract node (don't know if it's the best way to achieve it)
     
    Last edited: Apr 6, 2021
  26. Trecool182

    Trecool182

    Joined:
    Aug 30, 2018
    Posts:
    10
    Hello

    I have an issue with the "Billboard" node.
    I've been using it in a shader for a long time and worked without issue.

    Recently I made some changes to that shader, and i realized the billboard node has changed, and will break even if I recompile without changing anything. I can't figure-out a way to get back to my previous behavior, it seems like it is broken. Here is the desired result I had before recompiling : the mesh is centered on the pivot, and orientation does not do anything :
    iYOGPL0YyR.gif

    Opening the shader, I see the billboard node has "ignore rotation" set to true. I dont think it had this option previously, and anyway it feels like I should keep it on true for my desired behavior. However this is what happens if I recompile :
    34SHL8ZeB7.gif
    The position gets all messed up. I didn't show it in this gif, but the rotation has no effect, as expected. The problem is the position.

    If I disable "ignore rotation", here is the result
    qWZYcGV86z.gif
    It's not a billboard anymore, not sure what would be the goal of this?

    Here's a screenshot of all the nodes going to the vertex offset (set to relative mode)
    upload_2021-4-7_10-17-44.png


    Unity version : 2020.3.2f1
    Ase version : 1.8.9r1
    Render pipeline : URP

    Thank you for your help
     
  27. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey there,
    Could be working as expected, this is really specific to Unity. Can you send us the shader, and any textures, along with the material as well, for further testing? Via support@amplify.pt would be great.
     
  28. Amplify_Ricardo

    Amplify_Ricardo

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

    We did add a few fixes a couple of versions ago to tackle "Ignore Rotation" issues, not sure if it's related to this. Which ASE version were you using prior to this problem?

    It would be really great if you could send us the original shader, before saving/updating, so that we can compare differences on our end. If that's the not possible, the current shader, along with material and textures, would also be very helpful.

    We're available via support@amplify.pt.

    Apologies for the inconvenience.
     
  29. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,621
    This is strange, I tried the shader in Unity 2021.1.1f1, and the depth fade and fresnel works but I'm getting this instead, blue arrow!

    Monkeysz.jpg

    I tried saving it in the latest version and imported it back into Unity 2020.1.3f1 and it's the same. I guess I should just make my water differently.
     
  30. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey there, was it saved in Unity 2021.1.1f1 to update it to the used SRP version?

    "I tried saving it in the latest version and imported it back into Unity 2020.1.3f1 and it's the same. "

    Save it on the project you're using it so that the shader is created for the required SRP version.

    What exactly are are you referring to with the arrows?
     
  31. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    Hi, there's this thing I can't really figure out. I using custom expression to recreate some stuff from a regular shader and this line gives this error.

    fixed3 original = tex2D(_MainTex, img.uv).rgb;

    Shader error in 'test': 'tex2D': no matching 2 parameter intrinsic function;

    But if I remove .uv it works and I don't know why. The shader that uses this line works fine. So what's the difference between shader code and the code you use in custom expressions?
     
  32. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387

    Hey there, the main difference really comes down to how and where the expression is used. In this case, does it make sense to do that on the custom expression? We'll need additional context to assist you here.

    You can set a Texture as an input for the custom expression, this will take care of the sampling for you.
     
  33. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    @Amplify_Ricardo As you could guess I'm no programmer. Here is the full shader. I was just curious what makes the code not work when used in custom expression. It's a really small shader and the example is from line 29.
    Code (CSharp):
    1.  {
    2.     Properties {
    3.         _ColorCount ("Color Count", Int) = 8
    4.          _MainTex ("", 2D) = "white" {}
    5.     }
    6.  
    7.     SubShader {
    8.         Lighting Off
    9.         ZTest Always
    10.         Cull Off
    11.         ZWrite Off
    12.         Fog { Mode Off }
    13.  
    14.          Pass {
    15.               CGPROGRAM
    16.             // Upgrade NOTE: excluded shader from DX11, Xbox360, OpenGL ES 2.0 because it uses unsized arrays
    17.               #pragma exclude_renderers flash
    18.               #pragma vertex vert_img
    19.               #pragma fragment frag
    20.             #pragma fragmentoption ARB_precision_hint_fastest
    21.               #include "UnityCG.cginc"
    22.  
    23.               uniform int _ColorCount;
    24.             uniform fixed4 _Colors[256];
    25.               uniform sampler2D _MainTex;
    26.  
    27.               fixed4 frag (v2f_img i) : COLOR
    28.               {
    29.                    fixed3 original = tex2D (_MainTex, i.uv).rgb;
    30.  
    31.                    fixed4 col = fixed4 (0,0,0,0);
    32.                    fixed dist = 10000000.0;
    33.  
    34.                    for (int i = 0; i < _ColorCount; i++) {
    35.                        fixed4 c = _Colors[i];
    36.                        fixed d = distance(original, c);
    37.  
    38.                        if (d < dist) {
    39.                            dist = d;
    40.                            col = c;
    41.                        }
    42.                    }
    43.  
    44.                 return col;
    45.               }
    46.               ENDCG
    47.          }
    48.     }
    49.  
    50.     FallBack "Diffuse"
    51. }
     
  34. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hello there, this should be corrected in your latest update currently available via our website.
    http://amplify.pt/download

    This version will be available at the Asset Store around 1 week or so; definitely recommend getting it from our site.
     
  35. Amplify_Ricardo

    Amplify_Ricardo

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

    In that case, you must surely understand that, regardless of complexity or size, you cannot simply copy chunks of code without some knowledge of what you can do. As much as we'd love to assist, we only provide support as it relates to our tool.

    In this particular case, as I've mentioned in my previous post, you should let the existing mechanism Sample the texture for you. Define your property inputs, you can set their value as required and access them in the custom expression.

    upload_2021-4-8_15-29-33.png


    Don't restrict yourself to Amplify Shader Editor tutorials, shaders use standard concepts that you can learn from different sources and apply to Unity; even Unreal Engine tutorials are useful! We usually recommend Alan Zucconi's tutorials ( starting with the Gentle Introduction to Shaders ) and his much praised Shaders and Effects Cookbook, or the Catlike Coding Tutorials.

    Try to learn more about the anatomy of a shader: http://www.alanzucconi.com/tutorials https://www.alanzucconi.com/2015/06/10/a-gentle-introduction-to-shaders-in-unity3d

    These can also help:
    https://www.packtpub.com/game-development/unity-2018-shaders-and-effects-cookbook-third-edition (excelent start!)
    https://catlikecoding.com/unity/tutorials/rendering (more advanced)

    Please don't be discouraged, you're tackling an advanced topic.
     
  36. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    @Amplify_Ricardo It's not that I don't understand what I can do, it's the syntax. If it doesn't work, when you now it's correct, what are you supposed to do? If you do a search for this error you'll get nothing relevant.
    Thanks for the links though.
     
  37. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    The code is correct in the context of the shader; using it in a custom expression needs to be handled accordingly; this is going to be hard to grasp if you're not familiar with programing shaders. The anatomy/structure of a shader, and how Unity samples textures in your specific case, is a factor.

    As I mentioned before, you need to input the required data.

    To use the Sampling Macros you'll first need to enable it in the shader, plug the Texture Object, Sampler State and UV's. After this is can Sample the actual texture in the Custom Expression using the Unity Macro SAMPLE_TEXTURE2D.

    SAMPLE_TEXTURE2D( textureObj, samplerState, uvs )

    upload_2021-4-8_19-30-47.png

    Very simple example:
    upload_2021-4-8_19-29-41.png

    Without using samplers:
    tex2D( textureObj, uvs )



     
  38. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    231
    @Amplify_Ricardo Thanks again. I'll now continue smash my face against this until it works. o_O
     
  39. Jayme65

    Jayme65

    Joined:
    Dec 11, 2016
    Posts:
    93
    Any update? (mail sent 2 days ago, just to confirm)
     
  40. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hello,

    Not yet, it can take a couple of days due to the amount of request we received. You might get a reply later on the day or next Monday, I'll check the queue.

    Thank you for your patience.
     
  41. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    As per-developer insight; the Surface Shader basic refraction is created by fetching a texture created with a grab pass. What's probably happening in those extreme angles is that the calculated uv's differ too much which results in those artifacts. As is, there isn't much you can do to improve it.

    Apologies for the inconvenience; we'll keep it in mind for future improvements/alternatives but it's not something we can tackle at the moment.
     
  42. Trecool182

    Trecool182

    Joined:
    Aug 30, 2018
    Posts:
    10
    Working as expected now! Thank you for the quick and efficient support!
     
  43. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    670
    Made a cartoonish explosion effect with ASE. Going to test it on mobile soon.

     
    Amplify_Ricardo likes this.
  44. unity_MyWwvGAFstre6g

    unity_MyWwvGAFstre6g

    Joined:
    Oct 27, 2020
    Posts:
    6
    Quick Question:
    For a mobile game, I'm planning to pack information in the blue and alpha channel of the normal map, and using an unpack scale normal node.

    This works but, is the unpack scale normal node performance-heavy?

    (I'd be dumb to have something less optimized by trying to make it more optimized!)
     
  45. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    This is usually not an issue, you can either do it automatically with the Texture Sample node(upack) or manually; it's just using the internal, and required, Unity function to handle normals.
     
  46. lifeisabeach

    lifeisabeach

    Joined:
    Apr 26, 2020
    Posts:
    47
    I'm trying to create a material that I can dynamically assign colours to at play time.

    It has 10 equally spaced stripes, each of a colour including transparent, and those colours are set during play.

    I'm trying to figure a simple way of achieving the 10 stripes.
    I have a material with 3 stripes but it has many nodes already, I'm wondering if it could be simpler.
    And then set them during play.

    I appreciate any help.

    I'm targetting mobile, btw.

    Thanks!
     
  47. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Hey there, you'll need some additional scripting for something like that. https://www.ronja-tutorials.com/post/048-material-property-blocks

    An alternative would be adjust the color based on its world position. Please do elaborate, perhaps we can help better if we have a reference of what you need.
     
  48. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    Main.png
    Spring Sale is upon us!

    50% OFF all our products, bundle or individually. Be sure to use code SPRING2021 for an additional 5-10% OFF on purchases over $100. (for all assets on sale, not just ours)

    Learn more: Asset Store
     
  49. lifeisabeach

    lifeisabeach

    Joined:
    Apr 26, 2020
    Posts:
    47
    Thanks for the response!

    What I need is a material that has 10 (or more, but I think I can adapt later if I have 10 to start with) stripes.
    The stripes can have different colours and I need to set them during play.
    The stripes are all the same size, so there is no need to change their width.
    Ideally I would have a method that instantiates a new material and set the colours for the stripes.

    I could create and set the material's colours by hand, if it would be hard to achieve the instantiation and setting colours during play, but it would save me a lot of time (and offer creative freedom) to be able to do it dynamically.
    In that case, I appreciate any help creating this stripped material with 10+ stripes.

    The end result I'm looking for is similar to this image:


    Thanks again!
     
  50. Amplify_Ricardo

    Amplify_Ricardo

    Joined:
    Jul 19, 2013
    Posts:
    2,387
    I recommend starting simple, the Rectangle Shader Function(which you can edit by double clicking it) might be an easy way of creating a stripe; all you need to do is offset it and use it in a Lerp, or similar setup, to define where each color is.

    Here's a very basic example: http://paste.amplify.pt/view/raw/513484d6 (paste link to your canvas)

    upload_2021-4-14_10-39-2.png