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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Minimalist - LowPoly Flat/Gradient Shader

Discussion in 'Assets and Asset Store' started by Isfaq, Jun 22, 2017.

  1. oskar_tapanywhere

    oskar_tapanywhere

    Joined:
    Jul 17, 2018
    Posts:
    4
    Thanks man. When are you planning to test this? For us just a hint of how we can achieve SRP Batching with your shaders would be incredibly helpful. We can tweak it ourselves but we could use your assistance.
     
  2. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hi, I have managed to make the shader srp batcher compatible with minimal tweaking but the only problem is, I had to get rid of the shadow caster pass of the shader. Minimalist shaders uses the unity provided shadow caster pass but this is preventing the shader from being srp batcher compatible. It only works for Unity's default shader. I will probably have to implement my own shadow caster pass to get the shadows working.

    Despite the shadows, here how you can make the shaders srp batcher compatible
    1. Surround the uniform variables in Minimalist 2.4.6/Shaders/URP/Minimalist.hlsl with CBUFFER blocks

    Code (CSharp):
    1. //region Uniforms
    2. CBUFFER_START(UnityPerMaterial)
    3.  
    4.      #if TEXTUREMODULE_ON
    5.           uniform sampler2D _MainTexture; uniform half4 _MainTexture_ST;
    6.           uniform half _MainTexturePower;
    7.      #endif
    8.  
    9.      ...
    10.  
    11.      uniform half _Fade
    12.  
    13. CBUFFER_END
    14. //endregion

    2. Get rid of the Usepass statement for the shadow caster pass in Minimalist 2.4.6/Shaders/URP/Minimalist Standard (Globalspace).shader

    Code (CSharp):
    1.  
    2.             ...
    3.             ENDHLSL
    4.         }
    5.        
    6.         // UsePass "Universal Render Pipeline/Lit/ShadowCaster"
    7.         UsePass "Universal Render Pipeline/Lit/DepthOnly"
    8.         UsePass "Universal Render Pipeline/Lit/Meta"
    9.     }
    10.    
    11.     FallBack "Hidden/InternalErrorShader"
    12.     CustomEditor "Minimalist.MinimalistStandardEditor"
    13. }
    14.  
    Do the same for Minimalist 2.4.6/Shaders/URP/Minimalist Standard (Localspace).shader

    If I find any workaround with the shadows, I will let you know.
     
  3. apple1123215

    apple1123215

    Joined:
    Jun 6, 2019
    Posts:
    2
    Hi, I am facing a problem when I use this shader on a rounded cube. I applied Solid Color on each surface and the problem is that the rounded edges look too dark. The colors shown are not the middle color of two adjacent surfaces' colors. I tried applying "don't mix shadings" but it becomes a lighted edges. I still cannot have a smooth edges that I want.

    Could you give some advice for this situation? Thanks a lot.
     
  4. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hi, It's looks like a bug. I did reproduce it and looking into it to fix the issue. I'll let you know as soon as I get a fix.
     
  5. apple1123215

    apple1123215

    Joined:
    Jun 6, 2019
    Posts:
    2
    Thx a lot
     
  6. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Holy! SRP Batcher support has been added?
     
  7. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Yes, srp batcher support is not added now and to use it, you have to us the srp batched variant of the shaders. It is experimental, I am extensively testing it and with your feedback, I will finalize it.
     
    Klausology likes this.
  8. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Awesome! Can't wait to try it out. I am still testing out your other asset, MPUImage. It's working out splendidly and once I am done with that I will definitely be trying this SRP variant out!
     
  9. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey Mr. Developer! I recently got this Stylized Water Shader asset from the asset store>> https://assetstore.unity.com/packages/vfx/shaders/stylized-water-shader-71207.

    I was trying to implement the foam-intersecting-with-gameobjects feature. I found a really strange happening that occurs with the minimalist shader.

    Screenshot 2020-12-01 at 11.16.16 PM.png


    So here you can see two cubes that intersects with the water. However, only one of the cubes has the intersecting foam effect. The strange thing is, the left-top cube uses minimalist paid asset, the bottom-right cube uses minimalist free asset. In editor, both cubes have the intersecting foam effect. However, when building to android, I get the above bug. I was hoping you could assist me in this matter.

    Additional info:
    -Using Built-in Render pipeline
    -Both cubes' minimalist material properties are the same



    Also, this is not a major issue or anything but I notice that the minimalist free asset still uses the LWRP naming instead of the URP naming.
    Screenshot 2020-12-01 at 11.24.13 PM.png
     
    Last edited: Dec 1, 2020
  10. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Sorry about the trouble, I will update the free version soon with proper URP support instead of LWRP. I will test the depth issue causing the foam to not appear and let you know as soon as I can.
     
    Klausology likes this.
  11. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey Mr. Developer! I am facing a terrible issue with minimalist gradient and realtime shadow.

    Screenshot 2020-12-28 at 5.44.19 PM.png

    Here you can see two cubes. Both cubes use minimalist shader, casting realtime shadow on to the plane. Left cube uses solid colors whilst right cube uses gradient colors. Shadows are working fine on editor. However, when I build and run on to my android device, the gradient cube does not cast any shadow:

    Screenshot 2020-12-28 at 5.45.47 PM.png

    Could you assist me in solving this issue? Did I miss something in getting the gradient cube shadow to work? I would really love to be able to use realtime shadow on the gradient cube. Thank you!

    Notes:
    -using built-in render pipeline
    -both cubes use the exact same properties with the exception of "Custom Shading" section of the minimalist shader

    EDIT: Result is same on iOS device as well. Gradient shadow does not appear on iOS device
     
    Last edited: Dec 28, 2020
  12. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Btw I am unable to find the SRP variant of the shaders in the latest minimalist package 2.7.0. (Pic 1)
    The shader I am looking at also states that it's not compatible with the SRP batcher. So I am not sure what's going on. Hope you are able to help with this. (Pic 2)

    I would also like to ask if the SRP shader works with shadow?

    Also, the imported folder still uses lists its number as v2.4.6 instead of v2.7.0

    Thank you for helping!

    (Pic 1)
    Screenshot 2020-12-29 at 9.52.05 PM.png
    (Pic 2)
    Screenshot 2020-12-29 at 10.12.53 PM.png
     
    Last edited: Dec 29, 2020
  13. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131

    Btw, this issue remains in the latest minimalist package as well.
     
  14. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hello @Klausology,
    In my testing, both Unity 2019.4.17 and 2020.2.0 imported the latest version from the package manager window. I downloaded minimalist from 2019.4 editors. I think you have to delete the existing downloaded package and redownload. Let me know if it does not work.
    Note: The readme file inside the latest version shows 2.6.0, Ignore that for now, I'll update these things in the next update.


    I am currently working on all the issues you have mentioned earlier. I'll update the package hopefully by this week.
     
  15. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131

    Hey Mr. Developer! I have just tried deleting and redownloading multiple times, also tried downloading the asset into several different fresh new projects. Couldn't get it to work. Turns out it's a bug with the package manager as seen in this thread >> https://forum.unity.com/threads/package-manager-not-showing-latest-version-from-asset-store.791718/
    So I just went and deleted the files mentioned in the thread and I am now finally able to download the latest minimalist package. :confused::confused:

    Gosh, thank you for working through the end of the year and the new year. :)


    EDIT:

    Ouh no! After updating minimalist from v2.4.6 to v2.7.0, I am noticing that the minimalist effects are rather different. I am modifying the vertices of a plane to create a wavey water effect. With the v2.4.6 minimalist version, I am able to apply various colors to the plane and have it beautifully change colors:



    After updating to v2.7.0 minimalist, I no longer see such effects :(:



    I would love to be able to use the old effects where the colors were transitioning. Is there a way to do this in the latest minimalist? Thank you again for helping with all my queries!
     
    Last edited: Dec 30, 2020
  16. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    You have to choose VertexColor in the inspector for the top side. I can see right now it's set to Solid, so it's not using the vertex colors
     
  17. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hmmm I am still unable to replicate the old minimalist effect I'm afraid )=



    EDIT:
    I've appeared to managed to get the result I want in BRP minimalist v2.7.0:


    However, I am unable to replicate the same effects in URP minimalist v2.7.0:
     
    Last edited: Dec 31, 2020
  18. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hello @Klausology
    The issues you have mentioned earlier,
    1. shadows with gradient are not appearing in the android build
    2. depth issue on water shader in android build

    I was trying to recreate these with the latest version of minimalist but in my testing, they worked fine.

    The effect you were creating with vertex colors and you have mentioned that it's not working in urp, turns out you are utilizing a bug in the brp shader. Rotation for top and the bottom gradient is not working properly in the brp shaders but you seem to have made a cool effect out of it. I will fix the rotation issue asap but your effect will break again :(

    I will try to create the effect you were doing with the old minimalist after fixing the rotation issue of the latest minimalist.
     

    Attached Files:

    Last edited: Jan 8, 2021
  19. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey developer~ So I have just tested the 2 issues on the latest minimalist v2.7.0, and you are right, they are working absolutely fine indeed. I wonder if I was facing with these issues earlier because my package manager was still downloading v2.4.6, though I no longer have access to v2.4.6 to verify if this is true. Thank you for taking the trouble to check and test for me nonetheless. I have to make sure I am downloading the correct versions of the asset from the package manager henceforth.

    Indeed indeed! After moving my project to URP, URP minimalist's gradients rotation actually make a lot more sense that I have also come to realise that I was only able to get some cool stripe effects because of a bug in the brp minimalist. No worries about the effect breaking though, I understand that I was never meant to get that effect in the first place anyway!

    It would be interesting to see if there can be alternative gradient mode that can be implemented in the future such as a radial gradient mode, or a striped gradient mode (like the one in the bug).

    Honestly, thank you so very much for doing all the work in making this asset really awesome! :p

    EDIT: Also, I was wondering if you might have any advice for users should they have a need to modify your shader. Previously in brp v2.4.6, there was only 1 shader file for the standard minimalist. So when I wanted to add a new variable for material property block, I could simply clone the original shader and add the required stuffs in the copied shader. Now in urp, what I do is clone 3 files: minimalist.shader, minimalist.hlsl, minimalistinput.hlsl, and then proceed to add the new variable for material property block. Would this be the best way to go about adding a new variable? Is there a better way to do this? Thank you!

    Attached 3 ss of the modified files showing the addition of material property block instanced stuffs.

    modified minimalist shader:
    Screenshot 2021-01-09 at 3.16.47 PM.png

    modified minimalist input.hlsl:
    Screenshot 2021-01-09 at 3.17.13 PM.png

    modified minimalist.hlsl:
    Screenshot 2021-01-09 at 3.17.31 PM.png
     
    Last edited: Jan 9, 2021
  20. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hi, Sorry I didn’t see this question of yours earlier. What you are doing is right and probably the best way. I was trying to make the code as much manageable and reusable as possible. So I followed what Unity does in their own shader libraries. Hence, that many files in URP version.
     
    Klausology likes this.
  21. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hey developer! No worries! Yes indeed, your current shader libraries are very standardised and professional for sure. Alright thank you for verifying this! Cheers! :)
     
  22. Bromm

    Bromm

    Joined:
    Nov 18, 2014
    Posts:
    13
    Hi. Is it possible to add normal and specular maps?
     
  23. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hi, the demo scenes are using the default render pipeline shaders. If you are in URP, please change the shaders of the materials beings used in the scene to a URP/LWRP variant of the shader provided with the package.
     
  24. oskar_tapanywhere

    oskar_tapanywhere

    Joined:
    Jul 17, 2018
    Posts:
    4
    Hi,

    If you switch to OpenGL, then SRP Batching fails on your shaders. This means that it does not work on Android. Check out sreenshot.

    Screenshot 2021-04-16 at 14.01.28.png
     
  25. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hello, Can you please tell me a little more about your project settings? I could not recreate this on my end. I am testing on Unity 2019.4.0 LTS
     

    Attached Files:

  26. lukeskt

    lukeskt

    Joined:
    Oct 19, 2018
    Posts:
    1
    Hello,

    Any chance of an HDRP version? Have a particular look I'm trying to achieve.

    Thanks!
     
  27. BioBurden

    BioBurden

    Joined:
    May 28, 2018
    Posts:
    103
    Hi, I'm using Unity 2021.1.14f1 with the built-in renderer and when opening a demo scene, I see this material issue.
    upload_2021-7-23_14-36-0.png

    I got the following shader error related to URP, so I deleted that folder.
    https://imgur.com/a/qwnrcx8

    However, now I see these errors:
    https://imgur.com/a/HG90MFc

    Please advise.
     
    Last edited: Jul 23, 2021
  28. RazT

    RazT

    Joined:
    Feb 7, 2019
    Posts:
    14
    Hello there :)

    is VR single-pass supported? (getting graphical doubled images, when using it). Multi-pass works but I would love to save performace for my game.

    Thank you!!!
     
  29. Wildy71090

    Wildy71090

    Joined:
    May 14, 2013
    Posts:
    2
    Hello developers and all,

    I am experiencing an odd issue where my shadows are there but they disappear when the camera zooms out. I'm using specially the LWRP variants of the shader. Are there potential problems or causes that I may have missed?

     
  30. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hi, I have recreated the issue. It is probably caused by changes introduced to a new version of URP. I am working on a fix.
     
  31. Wildy71090

    Wildy71090

    Joined:
    May 14, 2013
    Posts:
    2
    Thanks for the reply.
    In the meantime, I'll see if I can figure out a workaround.
     
  32. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hello developer, I am facing a strange issue with all the minimalist shaders in URP. This is the error that I see:

    Screenshot 2022-01-12 at 3.05.27 PM.png

    I am using URP 12.1.2. Would you be able to assist me in this matter? Thank you so much!
     
  33. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Hi, I have reproduced and fixed this issue already and the update will be available very soon for download.
     
    BlasinRee and Klausology like this.
  34. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Thank you so much! :)
     
  35. Klausology

    Klausology

    Joined:
    Aug 29, 2017
    Posts:
    131
    Hello developer, regarding this issue. Will the fix for this be available any time soon?
     
  36. Isfaq

    Isfaq

    Joined:
    Feb 2, 2017
    Posts:
    156
    Sorry, the fix I had got broken again after another URP update. I am still working on this.