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:
    593
    Just the default render pipeline asset, with this "Render Objects" feature added in the renderer:
    upload_2022-7-11_16-21-48.png
     
  2. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26
    Hi there im having a problem to complie a scene it worked fin until today but I have no idea what is wrong or how I might fix it

    Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(443) (on gles)

    Compiling Vertex program with SHADOWS_DEPTH
    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
    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_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING

    Error building Player: Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(443) (on gles)

    Compiling Vertex program with SHADOWS_DEPTH
    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
    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_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING

    UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <68089899e4c84456bfc1de3436accf4a>:0
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <68089899e4c84456bfc1de3436accf4a>:0
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()




    With thanks (And I love this shader so much! I just hope I can fix it!)
     
  3. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26


    Actaully found solution UPDATE THE SHADER xoxo
    thanks and sorry for bother - will put here incase someone else has same problem
     
    Jean-Moreno likes this.
  4. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26
    Ah sorry to be back but it seems that solution only worked a while and somehow I have the same error again :(

    Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(443) (on gles)

    Shader error in 'Toony Colors Pro 2/Hybrid Shader 2': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(443) (on gles)


    Compiling Vertex program with SHADOWS_DEPTH
    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

    May I ask if you know how I can resolve it? - probably its a setting in unity? but im not sure
     
  5. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Can you try another build right after the error?
    If I recall correctly I tried to track that issue down, however on my end it used to cause the error on the first build, and then without changing anything the second build would actually work. No idea why, it sounds like an internal Unity bug...
    Hopefully it'll work on your end as well.
     
    NatCou likes this.
  6. miroshin

    miroshin

    Joined:
    Jul 23, 2022
    Posts:
    1
    Hi, I unfortunately have the same problem with Transfer Shadow. I updated TCP 2, collected several times in a row, but the problem did not go away
     
  7. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26
    Hi Jean, Sadly that solution didn't work - so I deleted the shader and reimported updated (I have done this a number of times - it seems to work for a while but then for no reason I can determine gives the above error)
    I have just tried to upgrade project to latest unity 2021.3.6f1 - to URP so will see how that goes.

    On reimport I received warning:
    Shader error in 'Toony Colors Pro 2/Hybrid Shader 2': Couldn't open include file 'TCP2 Hybrid 2 Include.cginc'. at line 358

    so manually reimport the “Toony Colors Pro/Shaders/Hybrid 2" by right clicking and refreshing the contents - this seems to clear the warning up yay!

    The shader is working again (its my favorite shader by faaaar!, and really so versatile! - even if a little temperamental at the moment - will hope this is the solution :)
     
    Jean-Moreno likes this.
  8. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26
    It failed again....Something I do notice is that only the hybrid with outline is appearing in the dropdown
    upload_2022-7-25_19-0-23.png
    even though both are in the Hybrid 2 shaders folder? ( I actually want the non outline)
    upload_2022-7-25_19-1-25.png

    Error appears here Couldn't open include TCP2 Hybrid 2 Include.cginc
    upload_2022-7-25_19-2-26.png

    The same thing happened last time on standard setup (but it's possible I made a mistake as I've never used URP).

    If I search for the Hybrid shaders, I can find them, but the non-outline shader is pink and the both shaders dissapeared from the dropdown menu where I would usually see them.

    If apply the outline shader by finding it in the folder and applying it to a material it works but - If turn off the outline on the outline shader, it has an error and turns pink. (not sure if that's expected behavior or not)

    Since I want the non outline version - I've set line width to zero so it looks like the non-outline shader. (Not sure if that impacts performance - but it works for now) - As ive mentioned it is could be something ive done but would be great to find the answer
    :p
     
    Last edited: Jul 28, 2022
  9. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26
    Sorry not trying to be spammy but maybe it helps see a timeline of events? In the end a few more mins later they had both failed - for now i'll use the standard shader but would be nice to go back to my fav toony pro shaders

    I will add these logs for now maybe in there somewhere are some hints to what it can be fixed (Me,unity,other) Sorry to have the problem - and no rush either - will be nice to have the shaders working when its possible. (but realize there is not much to go on as for hints)

    Kind regards
    Natalie

    ps amazing work in Sonder!!!

    [Worker45] Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': Couldn't open include file 'TCP2 Hybrid 2 Include.cginc'. at line 486

    Compiling Subshader: 0, Pass: Outline, Vertex program with TCP2_UV_NORMALS_FULL
    Platform defines: SHADER_API_MOBILE UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PASS_FORWARDBASE UNITY_PBS_USE_BRDF2
    Disabled keywords: FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON SHADER_API_GLES30 TCP2_COLORS_AS_NORMALS TCP2_OUTLINE_CONST_SIZE TCP2_OUTLINE_LIGHTING_INDIRECT TCP2_OUTLINE_LIGHTING_MAIN TCP2_OUTLINE_MIN_MAX_SIZE TCP2_OUTLINE_MIN_SIZE TCP2_OUTLINE_TEXTURED_FRAGMENT TCP2_OUTLINE_TEXTURED_VERTEX TCP2_TANGENT_AS_NORMALS TCP2_UV1_AS_NORMALS TCP2_UV2_AS_NORMALS TCP2_UV3_AS_NORMALS TCP2_UV4_AS_NORMALS TCP2_UV_NORMALS_ZW UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_FULL_STANDARD_SHADER UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 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 _RECEIVE_SHADOWS_OFF



    upload_2022-7-25_19-39-28.png
     
    Last edited: Jul 28, 2022
  10. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    If you right-click on the shaders folder and reimport, does it work? (like you did initially)
    It has happened to me that for some reason a shader can't find an include file even though the file does exist, and reimporting usually fix the issue.
    Did you also verify that you do have the file "TCP2 Hybrid 2 Include.cginc" in the same folder as the shaders?

    If a shader fails to compile, Unity will exclude it from the shader list so that's why you couldn't find it there.

    I'll have to dig back into the TRANSFER_SHADOW error and possibly report the bug to Unity if I can't find anything; as I stated, last time I investigated it I couldn't find anything in the code, and the error would go away every time when I made a second build, which doesn't make sense since nothing changed between the two builds...

    If one of you @NatCou or @miroshin could send me a small repro project so that I have the same setup, that'd be awesome!

    I won't be able to take a closer look until late this month or next month as I'm currently quite busy (hence my late reply, sorry for that).
     
  11. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    26
    Hi Jean
    Thanks so much for your reply - and I totally understand the deadline stress - so please don't feel pressured!
    For me at least this is just for thesis prototype - first semester (so there is time to add all that delicious colour and polish) I have to say i'm a total newb as to making a repo - but can understand the need to make one - So maybe if you pick sometime a bit later when it suits and just re-ping, unless Miroshin gets there first :)
    - if you can walk me through ill be happy to make one (sorry that i'm a bit newbie on that, it might give gray hair :p)

    Just sharing the project tested on my old android- (currently the shaders are working after fresh install :O), crossing fingers my unity behaves)
    But I will try the update and other suggestions with luck it will all workout.

    Stay well well there and thanks!

    https://www.youtube.com/shorts/cqVXdVR95EE
     
  12. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Finally had some time to give this another shot, and I did find something! The issue was on my end, although the fact that it was compiling fine on a second successive build does sound like a Unity bug.
    This error should now be gone in TCP2 v2.9.2 (@NatCou, @miroshin).
     
    HiddenTess likes this.
  13. Asarge

    Asarge

    Joined:
    Jun 2, 2018
    Posts:
    26
    I followed the dissolve tutorial and have it working in the inspector. How can I access the dissolve value in the code? I tried making it global in the shader generator but still can't seem to access it. Perhaps I'm not calling it properly but I don't have much experience on changing shader values.
     
  14. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    You need to use the variable name set for the dissolve value, so if you used the same as in the tutorial, that would be "_DissolveValue".

    You can either change that value on specific materials, so you'll need a reference to those materials and do something like:
    Code (csharp):
    1. material.SetFloat("_DissolveValue", 0.5f);
    Or if you set the variable to be global, you'll have to do:
    Code (csharp):
    1. Shader.SetGlobalFloat("_DissolveValue", 0.5f);
    Setting it to be global is useful if you want to change multiple materials with that shader at the same time, with the same value.
     
  15. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    Hi and thanks for your awesome shader. I wanted to ask how I could preload the shaders used for mobile, because it seems to lag on iOS when objects with the shader first come into sight. Or is this me doing something wrong?
     
  16. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Hello, please look at this page, there are a few options to perform shader "prewarming": https://docs.unity3d.com/Manual/shader-loading.html
     
  17. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    Thanks for the reply. So in the case for the Toony Colors Pro shader, what would the code look like as described here: https://docs.unity3d.com/ScriptRefe....ShaderWarmup.WarmupShaderFromCollection.html or here: https://docs.unity3d.com/ScriptReference/Experimental.Rendering.ShaderWarmup.WarmupShader.html ?

    Sorry for the noob questions.
     
  18. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    I've never used this new API so I won't be able to help much here, however I know about the non-script interface in the Graphics settings:
    upload_2022-10-11_13-51-29.png
    You can run the game in Editor, it will track the loaded shaders and their variants, and you will be able to save that as a shader variant collection asset. You can then reference that file in the "Preloaded Shaders" list, and as far as I know those shader variants will be preloaded when launching the application.

    The ShaderWarmup API would be more useful if you need to preload them on a scene-by-scene basis and have better control of the loading/unloading and memory management of the shaders, I guess.

    Quick note about shaders in Unity:
    - when we talk about a "Shader", it usually describes a shader file that contains multiple variants and passes (e.g. usually you'd have a main pass for rendering the model, another pass to render it in the shadow caster, another to render its depth in the depth texture, etc.)
    - "Shader variants" correspond to the actual shader programs run by the GPU, of which a single "Shader" file can contain billions due the number of permutations possible based on keywords (each keyword doubles the number of variants, keywords being features that you can toggle on/off like the normal map, specular, etc.)
    - Some of these permutations may never be actually used in the application, so that's where shader variant collection files are useful: preloading the full set of variants of a shader could drastically increase load times and memory consumption, so instead of that we can track which variants are actually used and only load these ones

    Lastly, I also added an interface in the Hybrid Shader 2 to completely disable some variants directly in the code, so that they can never be compiled and will never be taken into account by Unity: just select the Hybrid Shader 2 file in the Project view, and change the options in the inspector:
    upload_2022-10-11_14-0-4.png
     
  19. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    oh that's interesting. Thanks. I already use the preloaded shaders with the shader variant collection, yet the frame drop still happens when - for example - the outline variant first comes into sight (used on coins). In the documentation you previously posted it says that ShaderWarmup would be the only one that really supports vulkan and metal which I would need for iOS. It says: "Using the other methods can result in wasted work and GPU memory, without fixing the stalls." Which seems exactly my case for some reason...
     
  20. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Ah well, then you'll have to learn that new API and figure it out I guess :)
    I didn't know the older method didn't work for new graphics API, that's good to know.
     
    el_Guero likes this.
  21. tgrayston

    tgrayston

    Joined:
    Aug 30, 2012
    Posts:
    16
    I'm getting a similar (the same?) TRANSFER_SHADOW error, despite having TCP2 v2.9.2 installed. I'm getting it on the Hybrid Shader 2 (Outline) version rather than non-outline (I'm using Outline). Unity 2021.3.12f1, Android platform.

    Have tried Reimporting, deleting and reinstalling through package manager to no avail. Rebuilding with no changes was working on Unity 2020 but I think it's since upgrading to 2021 that that no longer helps.

    @Jean-Moreno any ideas?

    Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(455) (on gles)

    Compiling Subshader: 0, Pass: ShadowCaster, Vertex program with SHADOWS_DEPTH
    Platform defines: SHADER_API_MOBILE UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF2
    Disabled keywords: INSTANCING_ON SHADER_API_GLES30 SHADOWS_CUBE UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_FULL_STANDARD_SHADER UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 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

    Error building Player: Shader error in 'Toony Colors Pro 2/Hybrid Shader 2 (Outline)': undeclared identifier 'TRANSFER_SHADOW' at Include.cginc(455) (on gles)

    Compiling Subshader: 0, Pass: ShadowCaster, Vertex program with SHADOWS_DEPTH
    Platform defines: SHADER_API_MOBILE UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF2
    Disabled keywords: INSTANCING_ON SHADER_API_GLES30 SHADOWS_CUBE UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_FULL_STANDARD_SHADER UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 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
     
  22. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    My bad, I found out that this issue was only fixed for URP but not the built-in render pipeline, which I guess you are using?
    Try to update to the new version 2.9.3 and let me know if it works!
     
  23. tgrayston

    tgrayston

    Joined:
    Aug 30, 2012
    Posts:
    16
    Thanks that did the trick! Yes I believe I'm using the built-in render pipeline. Honestly not sure of the pros/cons of switching so I've taken an "ain't broke so don't fix it" approach. Nearly my whole game is in NGUI so not sure it makes much difference in my case?!

    Anyway, working now, thanks again. :)
     
  24. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Probably not, if you don't use any dynamic lighting.
     
    tgrayston likes this.
  25. Tu-Dinh

    Tu-Dinh

    Joined:
    Dec 12, 2012
    Posts:
    10
    Hi,

    Is there a way we can make the dissolve effect work vertically?

    Thanks
     
  26. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Most likely, yes. You'd have to add a vertical mask in the dissolve effect, the easiest being to use the vertex local Y position (or world position if you need it to be vertical based on the world).
    Send me your shader by email, and I'll show you an example if you are stuck.
     
  27. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    Hey, Jean! I have a question about something I'm not sure is doable. This shader from Fortnite displays a white outline when a black part of the texture is in front of another black part (you can see it clearly with the hands of the model). This is a technique that's often used in manga and B/W cartoons in order to prevent similar colors from blending in.

    Is something like this doable in Toony Colors Pro? Thanks!
     

    Attached Files:

  28. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Out of the box, I don't think it's doable... you could experiment with the Outline pass blending mode and have it invert the colors, but this would require the game to be fully black and white and wouldn't necessary work that well visually.
    You can control that in the Shader Generator 2 (set outline blending to custom, and then change the blending factors in the Shader Properties tab).

    The other idea that comes to mind would be to use the stencil buffer to "mark" areas where you need the white outline to show, and have two outline passes, and a separate mesh for black parts.
    The setup would be:
    • first shader pass draws the object normally
    • second shader pass draws the black parts and set the stencil buffer to a value (e.g. 1)
    • third pass is the first outline pass (black): draw everywhere, except where the stencil is 1
    • fourth pass is the second outline (white): draw only where the stencil is 1
    So it's quite heavy for just that effect, and probably a lot of efforts unless you use it a lot in the game.
    Note you can't have a second outline pass in TCP2, so that part would have to be added manually.

    The easiest though would be to have the outlines as a post-process shader: in this case, you do know the color that is behind the outline when you draw it, so it's easy to change the color based on that information.
    This doesn't exist in TCP2 but there are probably other packages or solutions on GitHub.
     
  29. cmo

    cmo

    Joined:
    Aug 10, 2012
    Posts:
    13
    Out of box, it seems like the Normal/Bump Map > Parallax/Height Map option in Shader Generator does not work (version 2.9.4, Unity version 2021.3.15f1). Attempting to set this option (normal map + height map) to a newly created shader results in the error:

    Shader error in 'Toony Colors Pro 2/User/HeightTestShader': undeclared identifier 'GetViewDirectionTangentSpace' at line 222 (on d3d11)

    In the script, that line reads:
    half3 viewDirTS = GetViewDirectionTangentSpace(half4(tangentWS, 0), normalWS, viewDirWS);

    I can't see any function similar to GetViewDirectionTangentSpace around the script. Am I doing something wrong? Seems like someone else would have already reported if heightmaps really didn't work...

    Also, minor additional bug to report: if I create a Material Layer and turn on GPU Instanced, that works fine. However, for the same Material Layer there's another GPU Instanced checkbox in Shader Properties (once the layer is turned on under a category like Albedo or Normal); turning this GPU Instanced on actually results in removing the float4 that's created for GPU Instanced by the first checkbox (its name is _Basemap_layername_ST).
     
  30. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    You are the first to report this issue actually!
    You can fix that manually by adding this line next to the other #include lines:
    Code (csharp):
    1. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ParallaxMapping.hlsl"
    This fix will be added in the next update.

    Thanks, I could track down this other bug and it will be fixed as well in the next update!
     
    cmo and hopeful like this.
  31. KonstantinKuznetsov

    KonstantinKuznetsov

    Joined:
    Nov 19, 2021
    Posts:
    1
    Hello! I've faced an issue with Rendering Mode Fade - it just doesn't make object transparent when I change alpha value in Color property. Is it known issue and how to make it work? Tried with asset versions 2.9 and 2.9.5, Unity versions 2021.3.11f1 and 2020.3.17f1
     
  32. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Looks like a bug, I'll fix that for the next version.
    In the meantime you can fix it manually by editing the "TCP2 Hybrid 2 Include.cginc" file, and finding this block:
    Code (csharp):
    1.     #if defined(_ALPHAPREMULTIPLY_ON)
    2.         color.rgb *= alpha;
    3.     #else
    4.         alpha = 1;
    5.     #endif
    replace it with
    Code (csharp):
    1.     #if defined(_ALPHAPREMULTIPLY_ON)
    2.         color.rgb *= alpha;
    3.     #endif
     
  33. cmo

    cmo

    Joined:
    Aug 10, 2012
    Posts:
    13
    One more bug report for your next version and a question on the same feature...

    The report: Surface > Texture Splatting/Blending works for albedo, but not for normal maps. (version 2.9.4, Unity version 2021.3.15f1)

    The question: I got normal blending working just fine in Material Layers, so I don't actually need the above feature to work. But beyond workflow preferences, is there any performance reason that I would prefer one or the other way of blending or overlaying normals?
     
  34. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Texture blending with normals appear to work on my end, make sure the relevant option "Normal Map Blending" is enabled:
    upload_2023-2-16_14-0-10.png

    No, the performance should be the same ; Texture Splatting/Blending existed before Material Layers so it used to be the only easy way to get texture blending working.
    Material Layers are more flexible and can work with any property beyond Albedo and Normal Map, but will require additional steps if you want e.g. height-based blending.
     
  35. cmo

    cmo

    Joined:
    Aug 10, 2012
    Posts:
    13
    Sorry, I didn't realize more replication steps were needed, it seems that if I create a shader from scratch then the blend normals option does work, but it does not with the shader I was using to test. That pre-existing shader produces this error when both Texture Splatting / Blending with Normal Map Blending and Normal/Bump Mapping are on:
    • Shader error in 'Toony Colors Pro 2/User/AllOptionsTestShader': syntax error: unexpected token '=' at line 490 (on d3d11)
    • Line 490: = lerp(, bump1, blendingSource.r);
    I tried turning off all the other options in the shader one by one and deleting my material layers; but after that it's still producing that error. I've attached a copy of the shader in case you want to try it (will delete it after you see it).

    Actually I'm going to stick with material layers so I don't need a fix here, just reporting it in case you find a problem. Thanks for your work!
     
  36. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Thanks, I could track down and fix the issue; it will come in the next update!
    You can delete the file now.
     
  37. EternalCry

    EternalCry

    Joined:
    May 7, 2018
    Posts:
    5
    Is there any way to make the sketch feature or the shader as a whole fade in or out with distance? For example, the closer the player gets to a cube the more opaque the shader becomes. Im explicitly trying to make the sketch feature do this but if only the shader as a whole can do this that is okay. To note I do not have any real-time lighting in my scene, only baked.
     
  38. Guideborn

    Guideborn

    Joined:
    Jun 15, 2013
    Posts:
    231
    When using Shader Generator 2, I am trying to set up a mask for a screenspace texture; so that only a part of the texture gets the screenspace texture while the other parts uses a different texture.

    How do I approach masking with SG2?

    I've attached an example.
     

    Attached Files:

  39. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    You can't do that out of the box, you would need to use code injection to make that work and thus know the code to make that work. This is the kind of advanced things I'd like to make possible/easier with the next iteration of the generator through node-editing eventually.

    You can use the Shader Properties system for that; you can also see this quick tutorial regarding masking specifically.
     
  40. nojohnny123

    nojohnny123

    Joined:
    Nov 29, 2018
    Posts:
    6
    I'm getting unwanted shading on my toon shader setup using SG2. I'm look for pure celshading, yet I'm getting this gradient shading in the specularity. I can't figure out why this is happening!
     

    Attached Files:

  41. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    Updated to latest version and getting now this error:

    -------- Shader Toony Colors Pro 2/Hybrid Shader 2
    -------- GLSL link error: WARNING: Output of vertex shader 'vs_TEXCOORD0' not read by fragment shader
    ERROR: Input of fragment shader 'vs_TEXCOORD1' not written by vertex shader

    What should I do?
     
  42. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Can you try with the Hybrid Shader 2, using the "Crisp" specular option, see if it gives different results?
     
  43. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    I might have an idea about this, can you send me an email with the details so that I can send you an updated file to try?
     
  44. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    Sure!
     
  45. nojohnny123

    nojohnny123

    Joined:
    Nov 29, 2018
    Posts:
    6
    Thanks for the response!

    And unfortunately, same result.
     

    Attached Files:

  46. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Can you send me a small scene with that setup by email?
    I'll look into what is causing that gradient specifically, and how we can get rid of it.
     
  47. cmo

    cmo

    Joined:
    Aug 10, 2012
    Posts:
    13
    I've got some quite severe self-shadowing artifacts on objects using TCP2 Shader Generator materials (see screenshot). I know this is really a Unity problem... that said, all the Unity-centric solutions like bias settings have failed to improve on it at all.

    So with that in mind... are there some settings in Shader Generator that you could recommend fiddling with to try to improve on this? I feel like I'm missing something here among all the options at the bottom (I've tried some like two-sided without improvement).

    upload_2023-6-5_1-3-29.png
     
  48. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    Unfortunately there's not much we can do shader-wise about the shadows, the shader directly receives the shadows processed by the shadow map system with all its artefacts, biases, etc.
    This is not related to TCP2, but in production I'd look if there would be ways to "fake" that shadow using another technique, be it a baked texture, vertex colors, or something more analytical and dynamic, and once you have that it's relatively easy to "merge" it with the main shadow map in the shader.
    But yeah, nothing built in TCP2 that could help here :/
     
  49. Knottt14

    Knottt14

    Joined:
    Mar 9, 2021
    Posts:
    3
    Hi, I wanna ask how to creat a shader that can be control by the particle system custom data module through the shader generator?
    I do not good at coding so I try to defined it in the shader properties but seem like not working at all.
     
  50. Jean-Moreno

    Jean-Moreno

    Joined:
    Jul 23, 2012
    Posts:
    593
    The particle custom data will be placed in the vertex attributes TEXCOORD data, you can see/reorder where to put that in the Custom Vertex Streams list in its inspector:
    upload_2023-10-24_19-2-5.png

    Then when authoring the shader, in the SHADER PROPERTIES tab, you can use the Vertex/UV implementation to fetch data.
    For example, here the Albedo color will be multiplied with the TEXCOORD1 (UV1) data, which you can define as a color in the Particle System:
    upload_2023-10-24_19-1-44.png

    However it looks like there's a bug currently: the generator will always use only the XY channels for UV data, instead of allowing all four channels (XYZW), so if you use either Z or W the shader won't compile.
    I'll look into fixing that for the next update.
     
    Knottt14 likes this.