Search Unity

Toony Colors Pro+Mobile 2

Discussion in 'Assets and Asset Store' started by Jean-Moreno, Mar 7, 2015.

  1. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    It's not possible out of the box, but I can help you get that effect in your shader. Please send me an email and I'll get back to you!
     
  2. rarebyte

    rarebyte

    Joined:
    Sep 26, 2015
    Posts:
    10
    hi, I importet TCP2 into our project but I'm getting a lot of override errors like that:

    Code (CSharp):
    1. Assets/JMO Assets/Toony Colors Pro/Editor/Inspectors/TCP2_MaterialInspector.cs(110,23): error CS0115: `TCP2_MaterialInspector.OnGUI(UnityEditor.MaterialEditor, MaterialProperty[])' is marked as an override but no suitable method found to override
    2.  
    3. Assets/JMO Assets/Toony Colors Pro/Editor/TCP2_GUI.cs(606,23): error CS0115: `TCP2HeaderHelpDecorator.OnGUI(UnityEngine.Rect, MaterialProperty, string, UnityEditor.MaterialEditor)' is marked as an override but no suitable method found to override
    4.  
    how can I fix that?
     
  3. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    What version of Unity are you using?
     
  4. rarebyte

    rarebyte

    Joined:
    Sep 26, 2015
    Posts:
    10
    It's Unity 2017.4.1f1
     
  5. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    I just tried to import TCP2 in a new project using Unity 2017.4.4 and I don't get any issue.
    Can you make sure you are using the latest TCP2 version? It should be 2.3.55 as indicated in the release notes of the "!ToonyColorsPro Readme.txt" file.
     
  6. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    Hi Jean, how difficult would it be to adapt your Standard PBS shader to use the height map for tessellation, rather than parallax mapping? I'd be targeting the LWRP. I'm very novice-level when it comes to shader code. :)
     
  7. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    You can use the Shader Generator to get tessellation in your shader, using the "Surface PBS" template.
    However this is not available yet for LWRP: the way shaders are written for it is quite different, and the current support is very early (and I believe it is now broken as of LWRP 4.0.0).
    The plan is to eventually have a LWRP template that has almost all the features of the Default template, and possibly after that the PBS template. But LWRP still being in beta, I want to avoid dedicating too much time to that because there are risks that the work would have to be redone when LWRP is actually released because of API/shader breaking changes.
    Also please note that currently I'm hard at work to update the Shader Generator itself, to provide a more flexible system, which means rewriting all templates from scratch and updating documentation.
    All that will take some time, so please be patient! :)
     
    chiapet1021 likes this.
  8. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    Thanks for the detailed explanation! No worries. I'm not in a rush. I realize the LWRP and SRPs in general are still very much in flux. Definitely appreciate you already working on compatibility at this early stage, even if it's going to take some time to make it happen. :)
     
  9. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    578
    Hey Jean,

    I happen to use LWRP 4.0.1 + Unity 2018.3.0b5, and if you ever start to work on this please let me know, I will test it out.

    I suspect a major rewrite is needed now that LightweightShaderGUI class is gone.
     
    Jean-Moreno likes this.
  10. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    85
    Hi, I had [color from texture] checked but the outline is still black, what else condition should be done?
     
  11. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    This option will apply the color from the texture, but will also multiply it with the outline color - just set it to white if you just want the color from the texture, or gray if you want to darken it for example.
     
  12. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    85
    Thanks for the reply.I tried to set it to white and got the result.
    May I ask another question: which pixel the [textured color] actually gets for multiplying outline?
    The nearest pixel's color on texture? Or it's a average color from the whole texture?
    I'm asking this because I thought there can be different outline colors but I didnt work it out.
    ex.png
     
  13. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    The texture is sampled per vertex, so it will not be pixel perfect.
    You can also tweak the "Texture LOD" parameter to determine which mipmap to get from the texture (0 = full resolution, 10 = smallest mipmap) to control the precision of the color fetched (the goal was indeed to get some kind of average color for the outline).
     
    zIyaGtVm likes this.
  14. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    That looks like a very old version of lightmapping in Unity!
    This is all automated now as far as I can tell (see here), and Toony Colors Pro 2 does support lightmaps (real-time and/or baked global illumination), since it's using surface shaders under the hood.

    If you want to define a manual lightmap that you may have baked in an external program or manually, then this is not supported out of the box - you would have to write your own shader code to support it as it would be specific to how the lighting is baked onto the texture.
     
  15. nojohnny123

    nojohnny123

    Joined:
    Nov 29, 2018
    Posts:
    3
    Does Toony have an option to only use self-shadows?
     
  16. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    42
    Hi, happy new year!
    After playing around the shader generator, I have some suggestions.

    Default template
    1. When specular model set to PBR Blinn-Phong and GGX, the Specular Mask is useless, which is gloss in the shader code. I think it should be removed to avoid unnecessary confuse and performance cost.
    2. When set cartoon specular to smoothstep, the property is smoothness, I think it is a typo, and there will be two smoothness slider in the UI.
    3. When Reflection Probes (unity5) is enabled, the Reflection Cubemap is useless, I think it should be removed from Properties.
    4.When use Ramp Slider mode, can you add a texture or vertex color control to ramp smoothing?
    Further more, can you add a 2D ramp editor? you can check this video
    , they use multi channel 2D ramp to get a more precise result. I think multi channel maybe too heavy for performance, but a simple 2D ramp which can control ramp smoothing is great.

    PBS template
    5.I want to use metallic workflow instead of specular, but after checking the PBS template, I can't use shadow color texture in that template, so is it possible to use shadow color texture in PBS template or use metallic in Default template?
     
    nojohnny123 likes this.
  17. nojohnny123

    nojohnny123

    Joined:
    Nov 29, 2018
    Posts:
    3
    That's a really insightful video! Have you achieved the anisotropic effect shown in that video? I'm having some trouble with it.
     
  18. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    Not yet, but I do plan to add some options for that. Send me an email if you want some help into making your own unlit variant in the meantime!

    The issue is rather that the mask should work with all the specular models. I've fixed it for the next update, thanks for the report!
    It's not a typo but the same term used for two different settings... the first one should maybe be called "size" rather than "smoothness", because this is what it controls in the end (in Unity it was originally called "shininess" which is somewhat confusing I think).
    I generally try avoid technical terms like "smoothstep" in the material inspector, because the final user might not be familiar with those terms.
    Fixed, thanks.
    This will be possible with the upcoming Shader Generator 2: most properties will be customizable through a dedicated UI and you will be able to choose and combine multiple options for them (including using vertex colors for about any property available in the generator).
    I also intend to add threshold/smoothing sliders to the texture ramp (which will effectively scale/offset its UVs), but a 2D ramp is also a good idea for finer control. I'll see if I can add a 2D option for the existing Ramp Generator, that could allow to use any number of gradients and lerp between them.
    This will also be possible using the Shader Generator 2 with that properties system.
    Speaking of, please send me an email if you want to try a beta version of it soon!
    I'd appreciate to have feedback on it before releasing it.
     
  19. nojohnny123

    nojohnny123

    Joined:
    Nov 29, 2018
    Posts:
    3
    Thanks, Jean! I could honestly just wait for it if it's in the near future!
     
  20. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    42
    I haven't try their anisotropic. But in my test, kajiya kay and GGX anisotropic is good enough for most high quality case.

    Thanks, I will PM you email.
     
  21. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,237
    Does this support 2018.3 latest? What about HDRP? LWRP? How much of features in terms of % is supported by the SRPs?
     
  22. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    TCP2 should work fine with Unity 2018.3.0.

    As for SRPs, there is an experimental LWRP template available to be used with the Shader Generator.
    I just tested it in Unity 2018.3 with LWRP 4.6.0-preview and everything seemed to work.
    It only includes some basic features though: ramp shading, outlines, stylized fresnel (rim lighting)...
    The plan is for it to eventually get feature parity with the Default template, but that will come once the Shader Generator 2 is correctly working with updated templates, and with LWRP still being in beta I don't want to spend too much time working on it in case of future breaking changes before the release, so I'll focus on this part last.
     
  23. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    225
    Hey, Jean! Is it possible to have transparency but keeping the outline visible? I don't need it for complex shapes or anything. Just a sphere, personally!

    Edit: I managed to figure it out by trying out various combinations of blending source and destination.

    The only thing is the cast shadow does not take the transparency into consideration, so it doesn't only cast the outline, which is a bummer, but I guess I'm getting too greedy here lol
     
    Last edited: Jan 21, 2019
  24. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    Hmm yes, I'm not sure how you managed that with the blending modes, but technically the outline mesh is actually a sphere too so it will be fully cast into the shadowmap.
    One solution could be to have a ring mesh that always looks at the camera and have that rendered only in the shadowmap maybe? Not ideal but could work.
     
  25. Emperor

    Emperor

    Joined:
    Feb 13, 2014
    Posts:
    24
    Hey Jean,

    I'm using a pigeon model (https://www.assetstore.unity3d.com/en/?stay#!/content/15563) with an alpha cutoff and it makes the space between the feathers of the wings transparent. The problem is that when I activate the outline of the toony shader, it fills the space between the feathers with black(color of the outline). I'd like the outline to follow the alpha cutoff. Is this possible? How do you do it?
     
  26. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    Unfortunately, this is not possible.
    The outline is effect is actually an illusion: an extruded version of the mesh along its normals is first rendered in a solid color with inverted normals, then the regular mesh is rendered on top of it.
    This means that it doesn't work for non-volumetric objects (e.g. a plane), and the illusion breaks when you introduce holes in the meshes (e.g. cutout).

    Alternatives you have:
    - draw the outline on the textures for the mesh parts that are cutout
    - use the "rim outline" option from TCP2 with a black color, it's not the same kind of outline effect though (and works best with smooth angles between the faces)
    - use a post-processing effect to draw the outlines: this would give you the most consistent results, but it's an entirely different technique (you can check out Unity's old image effect that I ported to post processing stack for this)
     
  27. Crocomodo

    Crocomodo

    Joined:
    Nov 21, 2017
    Posts:
    27
    I use smoothed normals utilities to store normals in UV2 but when I use the processed mesh with amplify shader editor, I don't see any change in UV2 but normals is store in vertex color instead. Please help, I really need to use UV2.
     
  28. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    I tested in a fresh import and it works fine on my end.
    Did you make sure that you were using the processed mesh?
    Can you send me your mesh by email so that I can try with it?
     
  29. Crocomodo

    Crocomodo

    Joined:
    Nov 21, 2017
    Posts:
    27
    You are right. I tried with standard maya cube and it works with your shader uv2 outline option.It just don't appear in UV2 on ASE.
     
    Last edited: Feb 19, 2019
  30. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    The three axis (XYZ) are actually encoded in two channels (UV), so there's a loss of precision there. As far as I remember this is because back when I made the tool years ago, Unity would only allow to set/get float2 from the vertex UV channels.
    Now that the 4 channels are available I should update the tool to not lose any precision (and can also add options for using UV3 & UV4, to retain compatibility with the lightmaps that use UV2). Added that to my to-do list.
    This is the unpacking code, looks like only X & Y are encoded in U, and Z fully uses V:
    Code (UV2 Unpacking):
    1. //UV2 for Normals
    2. float3 n;
    3. //unpack uv2
    4. v.uv2.x = v.uv2.x * 255.0/16.0;
    5. n.x = floor(v.uv2.x) / 15.0;
    6. n.y = frac(v.uv2.x) * 16.0 / 15.0;
    7. //get z
    8. n.z = v.uv2.y;
    9. //transform
    10. n = n*2 - 1;
    11. float3 normal = n;
     
    Crocomodo likes this.
  31. Crocomodo

    Crocomodo

    Joined:
    Nov 21, 2017
    Posts:
    27
    Thank you for your help.
     
  32. Rumbleboxer

    Rumbleboxer

    Joined:
    Dec 26, 2012
    Posts:
    27
    Hi Jean, longtime fan of your work and I finally bought TCP2.. this was just shortly before the sale happened so poor me. Anyway, my question is.. how do I get the shaders to work in the LWRP for unity 2019?
     
  33. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    Sorry for the bad timing on the sale!
    Currently the LWRP template is out of date, it was merely experimental so far.
    I'm working on proper support for the current version of LWRP in Unity 2019.1, and I'm hoping to release a beta in June (it will come with a brand new Shader Generator).
    Please send me an email if you want to try a private beta now though.
     
    chiapet1021 likes this.
  34. TPEUnity

    TPEUnity

    Joined:
    Jan 17, 2018
    Posts:
    18
    Is it possible to add transparency to the outline color? If so how would i go about it?
     
  35. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    You can do that using the Shader Generator: in the Stylization section, select Outline: Blended Outline. You will be able to change the alpha of the outline color to modulate the transparency.

    If using the Shader Generator 2, you need to enable Stylization > Outline, and then choose Blending: Custom.
    By default it will use alpha blending, but you can customize the blending equation in the Shader Properties tab.
     
    TPEUnity likes this.
  36. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    186
    Just tried to update to 2019.3 and non of my TCP shaders are working in URP. Any ideas on how I can fix this?
     
  37. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    Make sure that you have generated them with the LWRP template in the Shader Generator 2 (if you used the default template, then you will need to generate new shaders from scratch).
    Open them in the Shader Generator 2, choose the URP template, then update them with it (I'm afraid you will have to do this one by one).
    Then they should work with URP.

    As silly as it sounds, URP changed a few keywords from "Lightweight" to "Universal", so it's all that's needed to make them work.
     
  38. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    186
    Sounds good. Thanks! I'm also using the LWRP water shader, so I imagine I can just go into the code for that and do the same?
     
  39. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    438
    Yes this one was made manually so you'll have to change the keywords manually too; it won't work through the Shader Generator 2!
     
  40. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    186
    Thanks so much!
     
  41. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    186
    Just a quick note - I got everything working in 2019.3 with URP. The shader generator method wasn't working for me as I would wind up losing the material properties that I had set in the previous version in the process. It was easier to just open the shaders and edit them manually, keeping in mind the case sensitive nature of the replacement. I'm not sure if I was doing something wrong or not. Regardless, everything is great now, so thanks again.
     
  42. NickProkoArt

    NickProkoArt

    Joined:
    May 27, 2018
    Posts:
    1
    Hi! Can you give a couple of tips on how to do this manually? And what to I should edit inside shader?
     
  43. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    186
    Sure. Just open the shader in your text/script editor. Search for all instances of the word "lightweight" and replace them with "universal". Also, "Lightweight", with a capital "L" should be replaced with "Universal", capital "U". I did the replacing one at a time to be able to maintain case sensitivity.
     
unityunity