Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    590
    Indeed, it won't work; the shader doesn't take any texture information into account!
     
  2. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    470
    Hi. Your shaders look great. I have 3 questions:
    1. Does Toony Colors Pro support Unity 5 beta?
      1. Do the shaders work with light probes in Unity 5? (for either real time GI or baked lightmaps). I found your guide for adding lightmap support, but I suspect the details will change for Unity 5.
    2. Any plans to add a specular color map, or otherwise expand the ability to tweak specular?
     
    Last edited: Nov 12, 2014
  3. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    They don't work out of the box, but a few changes should make them work in Unity 5.
    I don't think light probes are actually linked to lightmaps within the shaders, so they should work with light probes without modifications unless there are changes regarding them in Unity 5.
    No plans to add that particular feature, but do not hesitate to write me an email so that I can help you out (actually what do you mean by "specular color map" exactly?)
    As for updates, I'm currently working on a major update with some new features and a better usability; no ETA yet though!

    In any case feel free to email me for any request or help you may need with the shaders :)
     
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    725
    Watching for my instabuy list.
     
  5. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    470
    A texture that controls the color (RGB) and another parameter (A) of specular highlights from realtime lights. The alpha channel can control intensity, or, as in the case of Unity 5 beta 13's Standard shader, the "smoothness" of the specular highlight.
     
  6. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    What do we need to change to make your shaders unity 5 ready?
     
  7. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    I'm working on Toony Colors Pro 2, which should be released very soon if I don't encounter any major problem for the Unity 5 compatibility.

    In the meantime, I've added an entry in the FAQ so that you can update Toony Colors Pro 1 to make it work with Unity 5.
    There's only one small thing to do currently, but if you do encounter new compatibility issues then let me know and I'll update the FAQ!
     
    aigam likes this.
  8. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Hi Jean,

    a quick question. We've been using Toony Colors Pro for our production and it has been working great for us. However we've encountered an issue with the new Unity 5 Cloth simulation.

    In the outline shader, the simulated cloth produces weird outline artefacts on itself. (When outline is disabled it goes away). Is there any way to fix this?

     
  9. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    It looks like the cloth is being deformed differently than the outline.
    I tried to reproduce with a plane but didn't get the same issues.
    Could you send me the mesh/settings so that I can take a look at it myself? (please send me an email with the files attached!)
     
  10. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Files sent!
     
  11. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    I think I've found the problem, unfortunately I don't have any good solution to solve it!

    Your cape mesh is not planar (it is more like a long thin box), and when it is deformed by the cloth system, its triangles are intersecting each other. This is not visible normally due to backface culling, however if we reveal these backfaces with a debug shader, we can clearly see the intersection happening:

    The Toony Colors shader relies on the vertex normals and is culling front faces during the outline pass to give the outlining illusion and therefore you see artefacts.
    I don't know if the cloth system can be tweaked so that the mesh doesn't deform that much (i.e. its triangles don't intersect with each other) or if it's been designed to work with planar meshes only, but unfortunately I don't see any way to solve this in the shader.

    My only suggestion is to remove the outlines from the cape mesh and draw them on the texture directly, it's not perfect and you won't see outlines on the folds but it could still be better than no outline at all.
     
  12. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
  13. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
  14. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Thanks for your time. To clarify - if we make the cloth planar, then it should work?

    Cheers, I'll be sure to get your next asset?
     
  15. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Well, unfortunately no. The outline effect relies on the mesh normals to create its effect, so it needs normals that point in 3d directions (whereas on a planar mesh everything will be defined in a 2d planar space, unless you manage to modify the normals by hand so that the outline works which I'm not sure is even possible). You can see for yourself by using the default Unity plane and applying the outline material on it, it won't look so good!

    Toony Colors Pro 2 is a free update to Toony Colors Pro+Mobile, so you can just update it from the Asset Store!
     
  16. siumanchun

    siumanchun

    Joined:
    Apr 7, 2013
    Posts:
    44
    Toony Colors Pro how can Double Sided ?
     
  17. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Please update the package to get Toony Colors Pro 2 and use the Shader Generator to create your own shader with the Culling option set to Off. You will find more information about TCP2's features in the documentation.
     
  18. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    317
    I get this error upon importing to Unity 5:
    Shader error in 'Hidden/NFAA': Compiled shader code uses too many instruction slots (112). Max. allowed by the target (ps_2_0) is 96. at line 1 (on d3d9)

    Compiling Fragment program

    Any idea how to fix this? As a note, the project still compiles and I don't see any bugs, but it's just worrisome that problems might arise later.
     
  19. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    NFAA is unrelated to Toony Colors Pro, it seems to be one of the anti-aliasing image effect from Unity.
    What can have happened is Unity compiling all the shaders again upon importing the pack and realizing that this unrelated shader doesn't compile properly on directx9 platforms.

    That being said, a solution to fix this kind of error is to add the "#pragma target 3.0" line in the faulty shader (or target 4 or 5) to compile for shader model 3 hence increasing the max number of instruction slots (target 3 should be fine for most, if not all, of the modern desktop GPU but maybe not all the mobile ones).
     
    Disastercake likes this.
  20. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
  21. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Not out of the box, but it shouldn't be too hard to adapt a shader to do that. Please send me an email regarding this and I'll see what I can do for you!
     
  22. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Ok, I just send you an email. :)
     
  23. colin299

    colin299

    Joined:
    Sep 2, 2013
    Posts:
    181
    Hello,
    the shader use splitted vertex normals for lighting(direction/rim),
    and unify vertex tangent for edge pass(so the edge will not break by splitted vertex normal).

    I have a character model,
    I want to adjust the edge,so that edge looks good on some plane cloth.
    But I could not find a way to edit tangents in 3dsmax.
    so the only solution I have now is export 2 version of fbx from 3dsmax,
    one with splitted vertex normals, one with unified normals.

    Then in unity, I wrote simple script to copy vertex normal array from unifiedNormal.fbx,
    and paste to the splittedVertexNormal.fbx 's tangent.
    so that the character model now having good rim lighting,
    and also perfect edge line.

    I wonder if there is a better way to do this, because I don't know how to edit tangent in 3dsmax.
    --------------------------------------------------
    Also,I have some questions about #multi compile in shader,
    are there any disadvantage to add many #multi compile in the shader?
    because I want to extend the shader to support more feature(for example, dissolve character),and I am developing for mobile device.
    I wonder will multi compile cost appSize / performance,because each time I add a #multicompile,it doubles the possible shader number.

    Thanks you!
     
  24. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    The "Smoothed Normals Utility" is here to convert your meshes automatically, so you don't have to manually do that in 3ds Max for example.
    It will write averaged normals per-vertex on the channel of your choice: tangents, vertex colors or uv2.
    Please look at the documentation to see how it works.

    The #pragma multi_compile featureA featureB directive will create 'sub-shaders' to easily enable/disable a shader feature without having to create a whole new shader file and select it in the material drop-down list.
    It will effectively doubles the number of compiled shaders internally everytime you use it, however you can use the #pragma shader_feature featureA to do the same thing in Unity 5, however every shader variation that is not used will not be compiled nor included in your build, so you don't have to worry about performance/size issues with it!
     
    colin299 likes this.
  25. Blu_Ego

    Blu_Ego

    Joined:
    Aug 3, 2015
    Posts:
    1
    Hi there,
    I have been experimenting the shader lately, which I like very much.
    I have some questions about the alpha blending though: does it support techniques like depth peeling, or something similar? Currently I have a lot of problems with alpha sorting. I know I could use alpha testing, but I'm not a big fan of it :)
     
  26. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    I didn't know about alpha peeling, but it looks like a feature at the engine-level rather than per shader.
    The only suggestion I can make is to use the Shader Generator and select both alpha blending and alpha testing, this way you can have proper sorting and still get some soft edges (although you might still notice sorting artifacts on these soft edges).
     
  27. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Hey Jean! I'm using the Desktop version of Toony Colors Pro. I see there are options for specularity, but how can I add a specular map to have more control over the shininess of certain parts of the texture? There is only a slot to put in the MainTexture. Thanks!
     
  28. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    By default, the alpha channel of the main texture controls the specular level (or gloss in Unity's terms).
    If you want to also control the shininess through a texture, you can use the Shader Generator: when you enable the Specular feature there, you can then select if and how to use specular and shininess masks.
    Please let me know if you were looking for something else though!
     
  29. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Thanks! The Shader Generator helped!

    I have another question. Can using the Mask feature prevent the toonshadows from touching a certain part of a texture map? Like if I don't want any shadow on the face.
     
    Last edited: Sep 21, 2015
  30. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Currently, no, but I might be able to make a custom template for you to do that...
    Send me an email for more info and I'll see what I can do when I have some time.
     
    Guideborn likes this.
  31. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    I've sent the email! Just warning incase it went into spam!
     
    Last edited: Sep 23, 2015
  32. nguyennk91

    nguyennk91

    Joined:
    Sep 16, 2015
    Posts:
    10
    send you an email to ask some question regard toony pro 2
    Been 3 days so i just put a notice here in case it went to spam
     
  33. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Yes I got your email, I'll get back to you shortly!
    I generally answer within one week and I don't work during weekends, but it can take a little longer depending on my workload!
    Thanks for your patience.
     
  34. TimBorquez

    TimBorquez

    Joined:
    Mar 18, 2013
    Posts:
    81
    Just wondering, is there any performance difference between using the toon ramp sliders vs a ramp texture?
     
  35. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Technically yes, but the cost will mainly depend on your target platform (and more precisely the GPU used).
    The ramp texture approach needs a texture fetch on the pixel shader, whereas the ramp sliders approach only uses the smoothstep function (which itself is just a few arithmetic instructions I think).
    You might not see much difference if it only concerns a few objects, but you can do a test on thousands of objects and see if there's any performance drop in the FPS for example. Theoretically, the ramp slider approach should be faster.
     
  36. TimBorquez

    TimBorquez

    Joined:
    Mar 18, 2013
    Posts:
    81
    ah I see, thanks for the reply :)
     
  37. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Hello Jean, i want to create an anime game like Dragonball. But since I want to create a game for mobile I don't want to use lighting at all, but more of matcap approach since the camera is not rotating, however I want to have some outline and perhaps rim effect. I wonder if it is smart to buy your package since it is based on surf shading, or just modify yours matcap shader to have those effects?

    Ilija
     
  38. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    For the rim effect you have two options using the MatCap shaders:
    - if you want a fixed amount of rim lighting, you can directly draw that in the MatCap shaders (example here)
    - if you want some dynamic rim that you can control (color, strength, etc.) then you will have to write that in the shader directly

    For the outlines, you can add the outline pass directly to the shader. For example I think you can copy Unity's toon shader outline for a free solution, or write them yourself

    Here are the benefits I can think of you would get buying TCP2:
    - directly use the outline shader I wrote with the UsePass syntax (that's how they are used in my shaders)
    - alternatively you can add the outlines on a second material with the "Outline Only" shader provided in the pack (this doesn't work with multi-material models though)
    - you would have access to the Smoothed Normals Utility that can help fix broken outline for hard-edge meshes

    I hope that helps! :)
     
  39. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Hey, thanks for the quick response.

    I got the outline working with the matcap shaders!

    I have an question though, maybe it is a bit offtopic.

    Do you have any tips when to use toon matcaps over toon lit shaders? So i mainly develop games for mobile and i still think that surf shaders can be heavy in some cases (especially when many objects are lit).

    So what is most performance wise to use and in which scenarious (1st person, 3th person, moving camera, non rotating camera, etc)?

    PS: do you know some other toon matcap textures since i can't really find any others than from you on google.

    Thanks
     
  40. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Well, performance-wise unlit shaders (such as MatCap) will always be faster than lit ones in every situation.
    Surface shaders can perform well too for mobile though, depending on the target device, if for example you only have one directional light (and additional lights as vertex lit, there's the noforwardadd option for that).
    Then it all depends on your art style: what's the best way to render it? how can you approach that goal while keeping high performance on your platform?
    For a 3rd person game for example, you could use lightmaps + light probes for some "fake" dynamic lighting on the environments, and let the characters be real-time lit (with the main character having a few better features such as specular or normal maps).
    You could also use light probes on unlit shaders with some tinkering, to get some dynamic lighting without any real-time light.
    This blog post related to optimizing ShadowGun for mobile is still very relevant I think, despite the fast evolution of mobile specs.

    I think you'll be better off creating your own. If you look at the ones included in my package, they aren't that complicated since you only have 2 or 3 colors.
     
  41. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Thanks for the answer, i wonder if only 1 directional light (1 pass) for everything (environment) is faster than a lightmap. Since for a lightmap you need to read data from the texture per pixel and for the directional light you only need the dot product of light vector and vertex's normal per pixel. I dont know how complex the operation is to read data from texture but i think it is far more complex than a dot product.
     
  42. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Well I'm not entirely sure, and it probably actually differs depending on the GPU too!
    Lightmap is definitely bigger in memory usage, but it would also give the best lighting visually (provided you'd stay with static lighting).
     
  43. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Also, I don't even know if something like this is possible, but is it possible to have an outline, then another outline over it? I wanted to imitate something like this. A white line would appear over a black line.
     
    Last edited: Dec 5, 2015
  44. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Guideborn, add another outline pass and make the scale factor bigger.
     
    Guideborn likes this.
  45. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Outline pass? How could I do this? Also, thanks for the help!
     
  46. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    Yes, as Rusfighter said you might be able to do that with two outline passes: simply copy the Pass { ... } block (from TCP2_Outline.shader for example) and paste it in your new shader. Make sure you rename the properties such as _Outline and _OutlineColor so that you can differentiate them for each outline.
    (Alternatively you can just use the UsePass syntax, just like it's done on all TPC2 shaders that use outlines, but you would still need to copy/paste new passes in TCP2_Outline just to have different properties names, in which case you'd havce to change the Name of your new passes too)

    Also it looks like you edited your post from the email alert I got, but just in case you can have outlines appearing behind models with the 'Outline behind model' option in the Shader Generator. Note that I struggled to get the correct combination for depth write and depth test for this one to work, so it may not work correctly with other objects (especially transparent ones).

    To approximate your reference image you would need the outline behind model first in white and thicker, and then a regular black outline on top of it (I'm not entirely sure the two different outline types would work together though!).
     
    Guideborn likes this.
  47. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Hi

    im hesitating between this and unoShader, the project im working on is for mobile and PC, but i need some reflection for mobile too as we have many metallic environment (doesnt have to be accurate i guess).
    Is this something i can do with this asset, do i have to use the desktop version to do it and would this hit the performance a lot.

    I am trying to keep stuff as optimize as i can i'm pretty sure the mobile version is totally fine otherwise apart from the lack of reflection.
     
  48. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    590
    The default Mobile shader supports MatCap textures, which can simulate reflections (the technique is the same as the one used in my free MatCap Shaders pack, so you can check these out to see how it works).
    You can also generate a custom shader with support for reflection cubemaps (or Unity 5 reflection probes) using the Shader Generator, while keeping some of the mobile optimizations.

    I've never used UNOShader, but I think the main advantage is that they have unlit variations of their shaders, which Toony Colors Pro 2 doesn't have.
    Unlit shaders can be much faster than lit ones on low to mid-end mobile devices, so if you're aiming at really high performances then it might be what you need.

    Please note that you can always ask for a refund soon after your purchase if TCP2 shaders end up being too slow for your project!
     
  49. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Ok! thanks for your answer, i may end up just buying both (its not that expensive) :)
     
    Last edited: Mar 13, 2016
  50. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hey Jean, just wondering if you got my email, I'm sure you get lots so it may have gotten lost!

    Thanks :)