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

Toony Colors Pro+Mobile: Cartoon Shaders pack with lots of features!

Discussion in 'Assets and Asset Store' started by Jean-Moreno, Apr 15, 2013.

  1. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Hmm it looks like that option doesn't exist yet. I'll add it for the next release.
    Send me an email if you want the updated files before it comes out though - it might take some time since I just released a small update yesterday.
     
    Quills likes this.
  2. Quills

    Quills

    Joined:
    Dec 10, 2012
    Posts:
    5
    Ah thanks for the offer, would appreciate it and will send an email about this.

    Follow up question:
    I've since my last post switched to mostly using single texture triplanar maps (haven't needed walls+floor for most of the materials I'm making and it leaves more room for extra material layers!) but have run into a problem:
    While the regular Albedo/_MainTex property works fine with Triplanar UVs, the regular Normal Map/_BumpMap property seems to break whenever I use the triplanar UVs, causing a completely black texture.
    upload_2021-6-9_20-55-32.png

    Error log seems to think the highlighted line + dividing by zero is the problem:
    upload_2021-6-9_20-55-15.png

    I realize this probably isn't how you intended these properties to get used, but if there's an existing way around this or a fix you could make in the Shader Generator any chance you could update that as well?

    Thanks for your time
     
  3. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
  4. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    unity wobble flowers.gif

    You can use Toony's wind animation special effect for something similar to this. It requires the model to have a vertex colour gradient from Red (fully influence) to Black (no influence). I added vertex colour to the flowers in Blender but you can also use Polybrush within Unity.

    @Jean-Moreno I'm not sure why there's a 'ghosting' affect going on here. Any ideas?
    upload_2021-6-27_16-44-51.png
     
    Last edited: Jun 27, 2021
    Jean-Moreno and gamezuv like this.
  5. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Thank you !! Really appreciate it. gonna give this a try. I will use blender.
     
  6. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    You can toggle the "Add Shadow/Depth Pass" to fix that, so that those passes also handle the vertex displacement.
    By default it will use a simpler internal shader pass to handle all that, and thus won't have any vertex movement, causing those artifacts.

    Also thanks stepping in to explain the wind feature :)
     
  7. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi @Jean-Moreno, new to shader building and learning. How do I add a specular mask using 'shader generator 2'. Right now I am able to add it using shader generator 1 but cant find option to add mask in shader generator 2. upload_2021-7-1_22-2-11.png upload_2021-7-1_22-3-4.png
     
  8. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    For those who are new to this like me. Go to shader Properties - Find 'Specular' - Hit the '+' button sign and texture
     
  9. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Yes that's how you do it; sorry for not answering fast enough.
    Additionally, you can choose which texture channel to use with the Swizzle parameter (e.g. "RRR" for the red channel), and you can reuse the same texture for different masks if you use a Custom Material Property.
    You can also use the main texture's alpha channel by selecting "Other Shader Property > Albedo" and setting "AAA" as the Swizzle.
     
  10. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,077
    Hi, we've been using TCP2 in the past and had really good results from it. On a new project we're now using the URP and for characters we have the "Toony Colors Pro 2/Hybrid Shader Outline" material. This works fine in the editor and casts shadows correctly but on all platform builds the shadows don't get rendered.

    Is there anything obvious I might be doing wrong that's stopping the shadows working? I had a look at the logs and it does seem to strip variants but does leave some available.
     
  11. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    This is my bad, the script that will strip the shader variants from the unused pipeline will also strip the shadow casting variants if URP is used.
    I'll issue a fix soon, please send me an email if you want to get the fixed file before the update hits the Asset Store!
     
    tonemcbride likes this.
  12. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,077
    That's great thanks, will drop you a line for a temporary fix.
     
  13. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    564
    I'm using Shader Gen 2 and want to add metallic, is that possible?
     
  14. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Unfortunately no, there isn't any PBS template yet on the Shader Generator 2.
    You can use the Shader Generator 1 with the PBS template, but that only works with the built-in pipeline.
     
  15. ErisArcana

    ErisArcana

    Joined:
    May 18, 2015
    Posts:
    26
    Hello, I have a little problem with adding specular maps to each material layer in my shader. It seems that it only will use the specular map of the base texture for all of the material layers, and I can't find a way to change it.

    I have it set up where it should read the texture's alpha channel and use that as the specular map, and it works for the base layer, but for the rest of the layers, the option is greyed out, and I couldn't figure out a way around this.

    shaderhelp1.jpg
    shaderhelp2.jpg
     
  16. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Sounds like a bug in my shader property reference system... I'll take a look at it when I have some time and will get back to you on this.
     
  17. ErisArcana

    ErisArcana

    Joined:
    May 18, 2015
    Posts:
    26
    Ok thank you!
     
  18. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    I've sent you a DM with a fix, if you can confirm that it works this will be added in the next update.
     
  19. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    89
    I am so disappointed in this asset :/
    Upon adding it to my project everything just blew up, I get swarmed with "Maximum number (256) of shader global keywords exceeded, keyword TCP2_OUTLINE_LIGHTING_INDIRECT will be ignored." errors and I can't find out why.
    I have used a tool to optimize the shaders and everything should be completely ok with no more then 100 keywords being used.
     
  20. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    It sounds like your project was already using a lot of shader keywords and hit the global limit.
    Which version of Unity are you using? If 2019.1 or newer, make sure to download TCP2 from this version of Unity in the Package Manager to get the one using local shader keywords, which should dramatically reduce the global keyword usage.
    Additionally, I recommend deleting the legacy shaders (delete the folder "JMO Assets\Toony Colors Pro\Shaders\Legacy") unless you plan on using them for a specific reason (I will completely remove them in a future version soon).
    Same goes for the Standard PBS shaders ("Standard PBS" folder at the same path) if you don't plan on using it.
     
  21. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    89
    The error disappeared when I set up the Outline render effect. Thanks for the tips, Ill delete those asap now that Im aware of this strange limitation.
     
    Jean-Moreno likes this.
  22. nikrost

    nikrost

    Joined:
    Mar 25, 2019
    Posts:
    5
    Hi Jean, thank you very much for this great asset.
    Can you help me with ramp shading and baked light.
    It cant work for me? and i cant found what's wrong.
    i use URP
     

    Attached Files:

  23. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Ramp shading doesn't work with baked light: in that mode, every lighting information is provided combined from the lightmap, and thus we can't apply effects like to individual components of the lighting equation.
    We could arguably try to change the whole lightmap and apply some ramp on it but last time I tried that approach it looked really bad (and you can actually kind of do that already by processing the lightmap in e.g. Photoshop and applying the Levels filter on it).
     
    nikrost likes this.
  24. nikrost

    nikrost

    Joined:
    Mar 25, 2019
    Posts:
    5
    Thanks for answer and good tips, never thougt about editing lightmap in photoshop!
    I really love flexebility of toon cartoon generation, thanks again for poweful tool
    i have few questions, shaders that i cant make. Il be very gratefull, if you can help me with advice

    1. i wonna triplanar shader with blending ground textures by mask. it works for me with comon shader, but i had errors with triplanar options. i attached screens with error and shaders.

    2. i can't find example or make workable terrain shad. i try use it with polybrush, but polybrush can't see terain shader.
    i can't understand what's wrong, maybe you have any example of terrain shader(URP)?

    3. and extra question maybe you can help. how i can achiev this beautiful effect like in last camfires's grass (
    ) it's look like wave of specular in material, do you have tools for specalur texture animation?
     

    Attached Files:

  25. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    @nikrost polybrush is for mesh vertex colour, not terrain.

    last campfire grass.gif

    You linked to an hour long clip which didn't help your grass question, but I think it's probably a scrolling cloud noise map offsetting verts based on vertex colour. It looks like they have a normal map or a spec map for the stem.
     
    Jean-Moreno likes this.
  26. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Please send me the shader directly by email or DM, I'll take a look at it and see why there's an error.

    Indeed, as @dock mentioned Polybrush is not the same as Unity terrains.
    You can certainly make some sort of terrain texture system with Polybrush, just don't use the "Terrain Shader" option from the Shader Generator, and use Material Layers instead where each Layer corresponds to a vertex color channel (R,G,B,A). This means you'll be limited to 4 extra layers using this system.

    I'll take another shot and guess you're mentioning that specific effect:
    upload_2022-2-21_11-21-58.png
    You should be able to do this with the Shader Generator 2:
    • enable Specular
    • in the SHADER PROPERTIES tab
      • find the Specular/Specular Color property
      • add 2 "Material Property/Texture" implementations
      • for the second one, enable UV Animation : Scrolling
    The setup should look like that:
    upload_2022-2-21_13-26-10.png

    What this will do is have a fixed mask on the specular (which should be the grass pattern), and a scrolling mask multiplied with it (which should be the sinusoidal lines pattern alterning from black to white). That should allow you to get a similar effect to what's achieved in The Last Campfire.
    Since those are grayscale mask, it's a good practice to set their textures as "Single Channel" with "Red" color only, and then in the Shader Generator 2 set the Swizzle to RRR.
     
  27. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    Couple of questions!

    1. How do Color Masks work with SG2? How much can I colourize my texture using Color Masks? I tried using Colour Mask but it didin't give me more conntrol.
    I was expecting something like the Unreal implementation.

    2. Were you ever able to implement camera pane dithered transparency in SG2? I haven't followed some of the additions, but it would make a huge difference to my current project. Here's an example from Mario Odyssey, where certain materials dither based on distance from camera pane.

    upload_2022-2-25_15-4-35.png
     
  28. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    I noticed that the alpha dither shader is off slightly, so it always shows pixels even when alpha is set to 1.0

    I was able to 'fix' this by adding RGBA 0,0,0,1 to the colour, but this of course means it never fully becomes transparent. Less of an issue for 'fading objects' but it would be nice if this could be fixed in a Toony update.

    edit: the unity forum is having trouble with image uploads today, but here are the images explaining the problem and workaround.

     
    Jean-Moreno likes this.
  29. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Color Mask has to be done "manually" in SG2, I haven't added a user-friendly way to do that yet.
    It also means you decide how it should work with your own setup using the Shader Properties tab.
    The easiest way to set it up though it through Material Layers: create one layer per color channel of your mask, set the source as the mask texture (as a Custom Material Property), and then you can choose which properties to be affected by this mask.
    If you just want to multiply a different color, enable the layer for the "Main Properties/Main Color" property.
    If you want to entirely replace albedo (with a solid color or another texture), enable the layer for the "Main Properties/Albedo" property instead.

    Not yet, the interface is mostly missing a way to retrieve the pixel distance to the camera to implement this without using code injection. I can help you setting up a code injection solution in the meantime, just send me an email.

    It looks like my math calculations are a bit off... I might be able to solve that by implementing your fix in the dithering texture directly (possibly the darkest pixel there isn't entirely black or something like that).
    I also plan to add a math-only based solution for dithering to avoid sampling textures in the first place, which should improve performances for some platforms.

    Side note: I haven't been able to do much on TCP2 the last few months due to freelance work but my schedule is clearing up so I'll be able to dedicate more time on top of support in the coming weeks!
     
  30. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    Is it possible to set up a textured threshold on the XZ line between front and side walls? I'm trying to avoid that blended look.

     
  31. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    @Jean-Moreno I checked all of the Dither patterns and they do have the problem of the black pixels being 1,1,1 instead of 0,0,0, but changing this didn't help. I tried exaggerating the contrast in photoshop and they still didn't become solid, so it seems like there's a problem in the code.
     
  32. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    515
    Thanks @Jean-Moreno for support.
    I will leave here the same error to check what could be happen.
    Unity 2021.3.0f1
    Code (CSharp):
    1. Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(435) (on gles)
    2.  
    3. Compiling Subshader: 0, Pass: Pass 2, Vertex program with SHADOWS_DEPTH
    4. Platform defines: SHADER_API_MOBILE UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF3
    5. Disabled keywords: INSTANCING_ON SHADER_API_GLES30 SHADOWS_CUBE UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF2 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING
    6.  
     
  33. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    I tried to figure out why this error was popping up, and it didn't make sense... the macro in question isn't supposed to be called for those keywords.
    What's weirder is that if I started a second build right after the failure, the second build would actually succeed as expected.
    It's probably a Unity bug but no idea where it comes from...

    Can you try to build again after the failure and let me know if it then works?
     
  34. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    Hi! This is a highly specific question, but is there any way to generate a shader that renders a 1x1 colour dither over the unlit colour surface? This is assuming a low resolution camera/render texture. I'm trying to recreate some of the dithered surfaces in Star Fox on SNES, and other 16-bit polygon renderers.

     
  35. ksgy

    ksgy

    Joined:
    Apr 21, 2021
    Posts:
    6
    Hi,
    I want to use the Hybrid Shader but I also need Curved World 2020 Support... is it possible to integrate the two?
    If I just use the shader generator I get less flexibility than what the Hybrid Shader already comes with.
     
  36. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    It's only possible if you do the integration by hand (I'm not sure if CW2020 has a guide for that...), the Hybrid Shader is not compatible with the Shader Generator 2.
    I plan to work on that for the next iteration of the Shader Generator, i.e. allow generating or starting from the Hybrid Shader as a base.
     
  37. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Yes you can do that in the Shader Generator 2, just use "Unlit" as the ramp style, and then in the SHADER PROPERTIES tab, find the "Main Properties/Albedo" one and change the UVs of the main texture to be "Screen Space", with "Scale by Texel Size" enabled:
    upload_2022-9-7_9-28-43.png
    You can optionally change the swizzle to "RRRR" so that you can use a single-channel red texture for your dither pattern.
    In your case you'd just use a 2x2 cross pattern with two black and two white pixels.

    (if you want to keep the ability to use an albedo texture on top, just add a new texture with those parameters instead of changing the albedo one, but if you're trying to replicate StarFox I'm guessing you don't need any)
     
    dock likes this.
  38. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    598
    That’s fantastic!! Thanks for the detailed breakdown.
     
  39. andacoban

    andacoban

    Joined:
    Apr 10, 2022
    Posts:
    5
    Hello my friend and I bought your Toony Color Pro 2 and we have face with some problems when we apply the material to our characters. There is glitch and noise on the texture which we do not want it. Could you help us about it. First image standard URP shader for material second image on the right is Toony Color applied Shader.
     

    Attached Files:

  40. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    That looks weird... can you post your material settings please?
     
  41. andacoban

    andacoban

    Joined:
    Apr 10, 2022
    Posts:
    5
    Here is the Inspector picture of the material. I think it happens because of we have used another shader which bend the world. When we turn our URP to Highfidelity(Universal Render Pipeline Asset) it happens. Here is the link which we use to bending shader. We want to use both bending and Toony Colors Pro 2. Could you help us. Thanks

     

    Attached Files:

  42. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    How does the implementation of the bending world asset work with TCP2?
    My guess is that the main pass does bend the world, but the shadow caster pass doesn't, so the received shadows aren't properly aligned and show those artefacts.

    Alternatively you can use the code injection system to add your own world bending system, or use the Shader Generator 2 which has an option to toggle Curved World 2020 support, which is another commercial asset to perform world bending.
    If you can provide me the documentation for your bending asset I might be able to help further.
     
  43. andacoban

    andacoban

    Joined:
    Apr 10, 2022
    Posts:
    5
  44. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    I don't think there's any link between the artefacts and the usage of the bending shader, they shouldn't be able to interfere.
    The only thing that could affect rendering as a whole in the bending script would be this line:
    Code (csharp):
    1. cam.cullingMatrix = Matrix4x4.Ortho(-99, 99, -99, 99, 0.001f, 99) * cam.worldToCameraMatrix;
    but I doubt it is the cause of the artefacts we see in your first screenshot.
     
  45. andacoban

    andacoban

    Joined:
    Apr 10, 2022
    Posts:
    5
    Okay thanks I think I am not able to use bending shader with Toony Colors Pro 2
     
  46. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
  47. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    Unfortunately there's not much to do here, using the technique described in the other thread to scale the screen position with the render scale value won't prevent those patterns from appearing: it will just scale the dither pixels based on the render scale, but internally the shader doesn't know it will be upscaled eventually, and you can't "create" pixels at this stage.

    The whole point of dithering is to alternate values for every screen pixel, however when using render scale, the rendered pixels aren't aligned with the screen pixels anymore, thus causing Moiré patterns.
    The results aren't as bad when the scale is at a nice multiple of the screen, e.g. when using 0.5 or 2.0 (2.0 actually gives the best results because the pixels are mixed together when downscaling and thus we don't see the dithering anymore, but obviously at a high rendering cost).

    If you know your render scale value is going to be a fixed known value, maybe you could find a very specific noise pattern that will play nicely with that value and avoid or mitigate Moiré patterns - but I'm just guessing here, I'm not good enough at those maths to know if that's possible or not... (summoning @bgolus, his near-infinite wisdom could help here, and I'm curious to know if my idea makes sense... thank you if you can help us Ben!)
     
    Noogy likes this.
  48. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
    Thanks @Jean-Moreno. Yeah I've been struggling to find a formula to generate a clean dither pattern taking the renderscale and resolution into consideration but haven't had much luck, always a bit of occasional artifacting depending on those factors.
     
  49. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
    Actually, is there anyway to dissolve/dither/fade out without relying on a fixed dither pattern? I've seen several shaders seem to successfully 'fade' out regardless of renderscale, and they don't seem to rely on any pattern. Some sort of procedural clipping.
     
  50. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    584
    I guess you could animate the noise/dither pattern over time, but it might still be quite noticeable unless you are running at a very high framerate. Else you can just use alpha blending, instead of binary alpha testing.
    If you have examples of those shaders you are referring to, please post videos/screenshots of them!