Search Unity

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

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    54
    hey,
    so i've been using mobile version of your shaders for my enemy characters.and i need to make their shader slowly transparent and completely disappear them after their death.
    i was wondering if any of your shader could be transparent and fade away ?
     
  2. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    You can use the Shader Generator to create a shader that supports transparency. Then you can change the color's alpha value with a script or an animation to make the fading effect.
     
  3. h00man

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    54
    thanks you so much :)
     
  4. marcos

    marcos

    Joined:
    Oct 18, 2009
    Posts:
    592
    Hi @Jean-Moreno,

    Is it possible to do height based blending of PBS materials based on vertex colours or a texture map?

    If not, could I make that request?

    Kindest,
    Mark
     
  5. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593

    Do you mean basic
    texture blending like with the default template?
    Or do you mean blending two separate materials that use the same shader, possibly having different values for every property?

    The former isn't in the PBS template yet, but it could be ported over to the PBS template without much hassle (in theory), with albedo & normal map support.
    The latter is more complex technically, and basically means having a shader that processes the properties twice with a map to blend between the two configurations - so that's a big challenge technically, especially with so many features being possible from the Shader Generator.
     
  6. marcos

    marcos

    Joined:
    Oct 18, 2009
    Posts:
    592
    Hi @Jean-Moreno ,

    Yeah, I think basic texture blending with height map would suffice. I'm doing some look dev for a Switch game, so less intense shaders is probably a good thing.

    Like this, but PBS:



    The latter shader sounds like it would be amazing too, but I don't want to suggest that path when I'm in the exploratory phase.

    Cheers,
    Mark
     
  7. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    @marcos Ok I'll see what I can do. It might take time before I can push another update to TCP2, but please send me an email if you want to test the new PBS template as soon as it's ready.
     
    marcos likes this.
  8. Gradins88

    Gradins88

    Joined:
    Nov 8, 2016
    Posts:
    5
    Hello @Jean-Moreno,

    First of all thanks for the great tool! I like this.
    I met the following problem:
    water shader, it's great, but i can't get shadows on the surface, having tried a lot of results did not work what I want.

    Is there any solution to do this? Thanks

    P.S
    the best result was given by fake plane, but I could not bring the idea to the end
     
  9. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Have you enabled shadows in the options section of the template?
    upload_2018-10-18_10-7-40.png
    Please note though that shadows can't work with:
    • transparency
    • grab pass
    • depth-based effect
    From your screenshot it looks like you are using depth based foam, so unfortunately your current shader can't work with shadows out of the box.
     
  10. dustinmtk

    dustinmtk

    Joined:
    May 17, 2017
    Posts:
    6
    Hi there!
    We love your shader - and are using it on pretty much everything we got!
    However, we ran running into an issue with transparency/alpha/dissolve enabled within the shader. We use dynamic decals quite extensively to decorate our meshes. If these meshes have alpha/transparency enabled, decals no longer render on the meshes. It appears as though they are being rendered before the alpha shader. Is there something we can do in regards to change the order in which the shader shows up in game (we're assuming that maybe that could be the issue here). Thank you!
     
  11. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    You can try to change the render queue in the material inspector.
    Typically if it uses alpha blending, it will be set to the Transparent queue (= 3000), which afaik is mandatory for Unity to render them back-to-front and thus make them work properly with opaque objects behind them.
    If changing that doesn't help, please send me an email with more details regarding the decal system, or better yet, a small reproduction project so that I can directly take a look at it.
     
  12. dustinmtk

    dustinmtk

    Joined:
    May 17, 2017
    Posts:
    6
    Thanks! We'll try and package up something soon for you to take a look at!
     
  13. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Question!

    Toony 2 has all the things I will ever need, but there is something I'd like to know. Is there a way to not have to rely on Unity lights? I can achieve nice shader effects, but a light source is required in order for them to be visible. The problem is that the unlit parts of the model are shadowed (for example if the character is facing away from the Directional Light) and personally, I feel like it breaks away from the beauty of the shader.

    I'm probably asking something silly here!

    Edit: basically, i want the shader to generate its own shadows without using scene light
     

    Attached Files:

    Last edited: Nov 23, 2018
  14. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Well you do need some vector information to calculate N.L and then calculate the ramp shading from there, so I'm not sure.
    One thing worth trying is to use the view vector: it would simulate the light direction coming from the camera, meaning that the objects would always be front lit.
    Please send me an email and I'll take a look for a customized solution when I have some time!
     
  15. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Awesome. I sent the email!
     
  16. ayk

    ayk

    Joined:
    Nov 14, 2013
    Posts:
    58
    If you were able to make this a feature, I would love it. I own Toony Colors Pro 2, but I currently use Marvelous Techniques since it doesn't require a light. But if TCP2 added that feature, it would be awesome!
     
  17. Berserker44

    Berserker44

    Joined:
    Sep 1, 2013
    Posts:
    29
    Quick question, do you know if its possible to get your shaders working with Amplify's Impostor Asset?
    Link: https://assetstore.unity.com/packages/tools/utilities/amplify-impostors-beta-119877
    Its a LOD asset that I am interested in, but it requires a shader to have an exposed Deffered path to generate the LOD. I haven't bought the asset yet but I wanted to see if you or anyone in the forum knows if its doable.
     
    Dark-1-Games likes this.
  18. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    I haven't tried Amplify Impostors, but as far as I know they require a Deferred shader to bake the impostor textures (notably the normals).
    However the real magic happens in the drawing shader, which will blend the between different baked angles based on the view direction, and do normal mapping, shadow casting, etc. which means that if you wanted to have it working with TCP2, it would involve manually editing their shader to add TCP2 features in it.
    So currently no support is planned, but I'll see if I can do anything about it.
     
  19. Berserker44

    Berserker44

    Joined:
    Sep 1, 2013
    Posts:
    29

    thank you so much Jean for the quick reply! I may try your suggestion by adding in the TCP2 features into their shader. I actually am only interested in the base toon shading so there isn't much to it.
     
  20. Object-Null

    Object-Null

    Joined:
    Feb 13, 2014
    Posts:
    70
    Hello,

    For a project i like to use the dissolve shader. but im missing a normal map input.
    anyone of you know how i can add that in the shader?

    thanks in advance
    kevin
     
  21. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    If you mean that you want a shader that has both dissolve and normal map support, then use the Shader Generator to create it - the dissolve shader in the ShaderGenerator demo scene has been created just like that.
    If you meant something else, please elaborate.
     
  22. David-Selkirk

    David-Selkirk

    Joined:
    Apr 4, 2013
    Posts:
    4
    Hi,

    I'm trying to get a specific type of transparent effect (one where only the camera-facing surface of the transparent object is visible), like the one mentioned in this or this question, but so far I've been unable to replicate this effect. Like the person in the linked question, I want to get (3) but keep ending up with some version of (2).



    Is it possible to get this working in TC Pro? Every attempt I've made has the model visible through itself, but I'm not a great shader guy so I'm hoping I'm just missing something!



    Thanks!
     
  23. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    This is a common problem with transparency and currently this is not doable automatically with TCP2. I've written down to add support for this in a future version.

    In the meantime, you can try to fix that manually - I see two relatively easy ways to do this:
    • The stencil solution outlined in your second link should work, but it can introduce problems if one part of the mesh that is behind the rest is rendered first (basically the stencil method will 'mark' each drawn pixel so that it never gets written to twice with that shader, but you can't control the rendering order of the mesh's triangles)
    • Another solution is to insert a depth-only pass in the shader, so that the depth is correctly taken into account during the transparency rendering pass, as outlined in Unity's documentation. This does add a new pass in the shader though, and it will interfere with post effects that rely on the depth texture.
    Here is a visual comparison between the different techniques:
    transparency.png
    Depth gives the best result, but is less performant.
    If Stencil works fine with your mesh, I say go with that option.

    For those techniques, just add the following code in your shader at the beginning of the Subshader block:
    Code (Stencil):
    1. Stencil
    2. {
    3.    Ref 1
    4.    Comp Greater
    5.    Pass  IncrSat
    6. }
    Code (Depth pass):
    1. Pass
    2. {
    3.     ColorMask 0
    4.     ZWrite On
    5. }
     
    David-Selkirk likes this.
  24. David-Selkirk

    David-Selkirk

    Joined:
    Apr 4, 2013
    Posts:
    4
    Thanks very much Jean, I'll give those solutions a try!
     
  25. marcos

    marcos

    Joined:
    Oct 18, 2009
    Posts:
    592
    Hi Jean,

    When using the Shader Generator, I can't seem to add emission to a PBS shader, blank shader in a blank project with only Emission enabled gives me this error:



    Any way to resolve this?

    Kindest,
    Mark
     
  26. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Emission was indeed broken for the Surface PBS template! Thanks for the report.
    This should now be fixed in the latest version (2.3.571).
     
    marcos likes this.
  27. CoolMambo

    CoolMambo

    Joined:
    May 21, 2013
    Posts:
    19
    (EDIT) its definitely related to my lightiing, demo scene works fine (EDIT)***

    any idea if there is a bug in in 2018.3.8f1 version? I cant for life of me get any of these shaders to work as expected like the demo but im not sure if its something with my lighting setup ? Ive tried point lights, directional, no lights, with skybox etc. Is it because I am using low poly models or possibly an issue with the material settings? Here is an example: Applying unitychan style 5 example to my character models material.

    upload_2019-4-7_9-55-30.png
    upload_2019-4-7_9-58-16.png

    in game with directional light above:

    upload_2019-4-7_10-7-27.png


    any ideas to help point me in the right direction would be a great help! Thanks for making a cool tool!
     
    Last edited: Apr 7, 2019
  28. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    @CoolMambo What is are lighting settings/environment for the first screenshot?
    Also I don't think that you want the Ramp Threshold to be at 0 in your material; most likely you should leave it at 0.5.
     
  29. CoolMambo

    CoolMambo

    Joined:
    May 21, 2013
    Posts:
    19
    Thanks for reply Jean it was definitely my lighting approach. That said, you have any ideas on what features I could use to create a dithering effect or voxel effect similar to pixel art? Again great tool I'm really learning a lot.
     
  30. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    That's a pretty vague question... I can say that you will be able to make some kind of dithering effects with the Shader Generator 2, but that being said would you have any examples to show? (images, videos)
     
  31. CoolMambo

    CoolMambo

    Joined:
    May 21, 2013
    Posts:
    19
    Sorry Jean. I'm the same guy who sent you the video on email and you responded there. I sent you a response as well. Dont want you to have to reply in two places.
     
  32. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi @Jean-Moreno, big fan of the asset, been playing with it for a while. I've run into a new issue that cropped up after I had to adjust my camera setup.

    When using the post-processing stack, any fog or depth-of-field effects creep into the outlines in the shader, to the point where foggy objects in the distance appear opaque where the outlines should be. Is there a way around this, without resorting to rendering to a separate camera? I suspect it has something to do with the depth buffer ignoring the inverted normals of the outline however I've got very little experience with shaders. Thanks.
     
    Last edited: May 26, 2019
  33. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Yes that's exactly the issue: by default, the outline shader won't write into the depth texture (it needs a shadow caster pass to do so).
    You can enable that pass using the Shader Generator, and enabling the "Outline" feature with the "Shadow/Depth Pass" option:
    upload_2019-6-3_10-13-32.png
     
    Noogy likes this.
  34. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Awesome, thank you! I hadn't delved too deeply into the generator before.
     
  35. Dark-1-Games

    Dark-1-Games

    Joined:
    Mar 26, 2014
    Posts:
    101
    Hi @Jean-Moreno, and thanks for the great tool!
    We're attempting to use Toony Colors Pro 2 together with Decal Master for decals, and we're having some issues.
    It seems Decal Master's decals are rendered first and then the toon shaders draw over them:

    Step before Toony shaders render, rendering a decal screenshot Screen Shot 2019-07-23 at 12.54.24 PM.png

    Toony shaders render, drawing over decals screenshot:
    Screen Shot 2019-07-23 at 1.03.02 PM.png

    Decal Master renders using the AfterLighting command buffer.


    Do you have any idea how this can be solved?
    Thanks!
     
  36. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    That's because Decal Master uses the Deferred shading rendering path, whereas Toony Colors Pro 2 works in Forward rendering.
    That's why the TCP2 shaders are rendered afterwards, and thus overwrite anything drawn with the deferred path.

    To solve your problem you'd need a decal system that works in forward, or make your own deferred version of the TCP2 shaders.
     
  37. Dark-1-Games

    Dark-1-Games

    Joined:
    Mar 26, 2014
    Posts:
    101
    Many thanks for the info.
    Decided to go with kDecals (https://github.com/Kink3d/kDecals) for now, it seems to work just fine
     
  38. enblomquist

    enblomquist

    Joined:
    Jul 25, 2012
    Posts:
    85
    Hi! I absolutely love this asset - but I was wondering if / how we could add light cookie support?

    Thanks!
     
  39. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Could you specify what doesn't work on your end and what would be your expected results?
    I just tested, and only cookies used on the main directional light seem to be problematic for me.
     
  40. ArtByMashhadi

    ArtByMashhadi

    Joined:
    Apr 25, 2019
    Posts:
    2

    Hi man,
    None of ur example pics work.
    Can u fix them pls?
    I really need to see them and compare results.

    Thx bro,
     
  41. enblomquist

    enblomquist

    Joined:
    Jul 25, 2012
    Posts:
    85
    I am using a cloud shadow asset which uses light cookies while attached to the main directional light. It seems to specifically disable the toony shader when enabled.
     
  42. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Can you send me an email with a screenshot and your setup? (Unity version, shader used, lights in the scene, etc.)
    I'll see if I can make a custom solution for you!
    jean.moreno.public+unity at gmail
     
  43. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi @Jean-Moreno, I just wanted to thank you for the excellent work on supporting URP. It's been less-than-fun converting everything else to the new pipeline but I was pleasantly surprised with Shader Generator's functionality and the resulting shaders.

    BTW, there is one issue I'm struggling with, and that's multiple light sources. Do you have a recommended setup for this? Right now my materials seem to struggle working with the right source, occasionally flickering depending on the angle. It almost seems like I'm hitting URP's scene light limit, but it only affects Toony materials. Is there perhaps a light limit in the shader?
     
    Last edited: Oct 28, 2019
    Jean-Moreno likes this.
  44. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Supposedly the SRP is responsible for sending the proper data to each material, but the shader code might have changed since when I made the template. I didn't see anything particularly different though in the current GitHub version, and I'm using the internal GetAdditionalLightsCount() function to get the number of lights so this doesn't seem to be the problem.
    Could you send me a small repro project by email, so that I can investigate in the exact same conditions?
     
  45. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Thanks, I've sent you a PM through the forum but I'll also try email.

    Update: I've been trying to see if this had something to do with UPR or 2019.3, but I was able to get similar issues with LWRP and 2019.2.
     
    Last edited: Nov 4, 2019
  46. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Thanks for the repro. I found out that this happens because of the outline pass, when it is disabled in the shader, I didn't get any flickering. Toggling SRP Batcher on/off seemed to have some influence on the issue too.

    I didn't figure out exactly what was happening*, however currently the outline pass is kind of a hack because it is a simple pass without any 'LightMode' tag, yet it is still rendered normally along with the main pass that has the 'UniversalForward' LightMode. This effectively makes the shader multi-pass, which isn't officially supported as far as I know - so that could explain the unpredictable results.

    In the future I will provide a way to do things properly using the new 'Renderer Features' system, to manually add custom shader passes to be rendered at a specific stage in the rendering.
    If you want to do that manually on your end, select your ForwardRenderer asset, and add a 'Render Objects (Experimental)' feature in the Renderer Features list.
    Use those settings:
    upload_2019-11-5_10-55-32.png

    Then in the shader code, find the Outline pass and add the correct light mode tag as such:
    Code (csharp):
    1. //Outline
    2. Pass
    3. {
    4.     Name "Outline"
    5.     Tags { "LightMode"="Outline" } // <-- add this line
    6.     Cull Front
    7. ...
    This will render all objects that have a pass with the "Outline" LightMode after having rendered them normally.
    You can even create a new material with the same shader that can be used as a unique material controlling all the outlines, by using the 'Overrides' settings of the Renderer Feature. Interestingly, if you remove the "Outline" name from the Shader Passes list, *all* objects will get an outline - so it still acts as a filter even when the material is overridden.

    * I got some flickering again at some point even with the proper outline pass setup, however this flicker also occurred with the Lit and SimpleLit shaders, so this wasn't a TCP2 issue.
    What I found out was that in some cases, the unity_LightIndices array was empty (all 0s) for some objects, which effectively disables additional lights.
     
    Noogy likes this.
  47. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Thanks for looking into this. So I applied your fixes to the repro scene and it indeed worked. Unfortunately I'm still having issues in my game. In fact the flickering happens with non-outline Toony shaders as well. I'm not sure if it's related to the complexity of the mesh or some other variable.

    Perhaps related to this bug? https://issuetracker.unity3d.com/is...entical-to-every-object-and-are-set-per-frame

    I haven't personally seen this issue with Lit shaders, but I wouldn't put it past URP to have some lighting issues. I'm hoping that it'll be ironed out out Unity's side, but I do appreciate you looking into this and streamlining the generation. Thanks.
     
  48. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Ah, bummer. Could be related yes, even though this bug is supposedly fixed.
    If you have time to make another repro project with non-outline shaders, and where the bug doesn't appear with Lit or SimpleLit shaders, then I'd be happy to give it another shot!
     
  49. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi Jean-Moreno, small update. I'm happy to say that all the lighting issues seemed to be fixed with Unity's latest URP update, so it was something on their end. ToonyPro seems to be working wonderfully, thanks!
     
    Jean-Moreno likes this.
  50. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    82
    2020-02-09 16_31_18-Window.png

    Hi, Jean-Moreno, the above is about how MARZA used TCP2 in a Japanese magazine. I am wondering whether it's possible to achieve the left image with just one base color and one shadow map? What parameters should I tweak? And do you know how to achieve something like the right image? It's said to be based on TCP2. I think I must be asking about too much, I will appreciate it if you can give me any hints, thank you.