Search Unity

RealToon (An AAA Toon/Anime Shader and Stylized)

Discussion in 'Assets and Asset Store' started by MJQStudioWorks, Jun 30, 2016.

  1. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, if you are using URP,
    URP 14, Supports Forward+ and it allows you to use more lights and fast.

    About Deferred support, I'm still doing some experiments or test about it.

     
  2. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23
    I was apparently wrong about this. I was doing some stuff under-the-hood that I forgot about completely and that's what was causing this false result to show up in my testing. I should've done my tests in an empty project.

    There's only the issue of it going through the terrain, the rest with the simple quads was on me, sorry if I led you down the wrong road or wasted your time.
     
  3. Roby65

    Roby65

    Joined:
    Aug 4, 2015
    Posts:
    6
    Hello, we have a strange problem with an M1 device:


    What could it be?

    Thank you
     
  4. JVemon

    JVemon

    Joined:
    Jul 30, 2017
    Posts:
    18
    Code (CSharp):
    1. Unity: 2023.1.0a25.2386.4619
    2. TVE: 8.1
    3. RP: URP 15.0.3
    Upon installing in a brand new project (well, the URP sample scene template), and importing the package for URP 14+ support, the following occurs:

    upload_2023-1-20_22-36-5.png
     
    Last edited: Jan 21, 2023
  5. bc25252

    bc25252

    Joined:
    May 28, 2017
    Posts:
    13
    lilToon
     
  6. fishchips271

    fishchips271

    Joined:
    Feb 6, 2023
    Posts:
    1
    Is there a URP Lite version? or are there settings that make URP more mobile performant? Not having any particular issues I just want to know if it exists or not.
     
  7. Ronan-senpai

    Ronan-senpai

    Joined:
    Feb 7, 2018
    Posts:
    1
    Hi ! I'm trying to setup a Realtoon material in a DOTS project but I've encountered two errors after changing the target compilation to 4.5 :

    - Shader error in 'Universal Render Pipeline/RealToon/Version 5/Default/Default': syntax error: unexpected token ',' at Core/URP/RT_URP_Core.hlsl(105) (on d3d11)
    - Shader error in 'Universal Render Pipeline/RealToon/Version 5/Default/Default': undeclared identifier 'UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO' at Core/URP/RT_URP_Core.hlsl(105) (on d3d11)

    The material works fine on a gameobject but it turns to pink when used on an entity.
    Do you have any suggestion that could help ?
    Thank you !

    Here's
    the project settings just in case :
    Unity : 2022.2.4f1
    URP : 14.0.5
    Realtoon : v5.0.8p7
    Entities : 1.0.0-pre.15
    Entites Graphics : 1.0.0-pre.15
     
  8. JasonBrunner-SM

    JasonBrunner-SM

    Joined:
    Nov 3, 2022
    Posts:
    2
    Hi, We're currently using Real Toon on a project, primarily the DeNorSob Outline. I saw an earlier post asking about masking outlines and you had replied that the "DeNorSob Outline can't be mask and it is fullscreen".

    We're having an issue where vegetation (tree leaves, etc) doesn't match the look we'd like with the outlines and were hoping there may be a way to mask out certain materials from the DeNorSob Outline effect. I'm just writing to see if there has been any more recent thought about this, or if anyone else has come up with a way to address it?
    Thanks
     
  9. seoyeon222222

    seoyeon222222

    Joined:
    Nov 18, 2020
    Posts:
    187
    upload_2023-2-20_13-57-9.png

    2021.3.19f1 / HDRP / 5.0.8p7
    Compilation error occurs
     
  10. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi Sorry for the late reply.
    This error caused by the DeNorSob,
    I'm still fixing this error for URP 14.
    For now, delete the "DeNorSob" folder.

     
  11. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi,
    RealToon URP can be use on mobile.
    A lite version of RealToon URP is still on the works.

     
  12. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, sorry for the late reply.
    thank you for reporting this
    and sending the info's.
    I'll check this out.

     
  13. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi sorry for the late reply.
    about the problem and question.
    this only happens on Transparent materials.
    As of now I'm still finding ways to Mask it or at least not include the transparent.


     
  14. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi sorry for the late reply.
    This is currently a problem on M1.
    I'm still figuring it out what caused that.
    It might be the Outline.Feature, you can try to disable the outline feature and use a Screen Space Outline.

     
  15. seoyeon222222

    seoyeon222222

    Joined:
    Nov 18, 2020
    Posts:
    187
    I think you missed the message...
    Is it known issue?
     
  16. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, I'm not sure if you sent an email.

     
  17. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, i already fixed this and it will be available on the next patch 8
    If you need the fix now, here's what you do:

    Open the RT_HDRP_RT_ForwPas.hlsl
    Then find _RaytracingRayBias and change it to _RayTracingRayBias

    Open the file RT_HDRP_Core.hlsl
    Then find INDIRECTDIFFUSEMODE_RAYTRACE and change it to INDIRECTDIFFUSEMODE_RAY_TRACED

    (RealToon HDRP)

     
    HoshimiyaSio and Tamago-Jam like this.
  18. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23
    Any rough estimate yet when this will be worked on? And would a potential solution still be compatible with 2020.3 and URP 10.9? The see-through terrain bug is a problem, and are there any plans to support cut-out transparency?

    (Any info on what's happening next with the DeNorSob Outline would be welcome)
     
  19. eliphat

    eliphat

    Joined:
    Jul 4, 2017
    Posts:
    48
    Hi there,

    I have trouble getting the correct lighting/shadow on my character. When moving from a bright area under the directional sun light into a shadowed area the brightness of the character doesn't seem to change whatsoever.

    upload_2023-2-22_13-30-40.png upload_2023-2-22_13-30-56.png

    Values on the hair for example is similar in both cases. I'm using HDRP and RTX (SSGI + SSR + Raytraced shadow).
    upload_2023-2-22_13-32-59.png
    Thanks in advance.
     
  20. eliphat

    eliphat

    Joined:
    Jul 4, 2017
    Posts:
    48
    I found the problem is that RealToon only considers 1 directional light for lighting. And the one RealToon picks is not necessarily the brightest, main light.

    I have 1 directional sun light that casts shadow and 1 weak, fill directional light that does not cast shadow to add atmosphere to the scene. RealToon is always using the weak fill light to compute the values. So the brightness does not change when I move from bright sunlight into the shadow.
     
  21. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, sorry for the late reply, DeNorSob is still on improving stage until now and fixing some errors on the newer URP version.

    Yes the see through is the problem on a Transparent object.
    Cutout is already supported.

    Have you tried to use the Sobel Outline feature?
    On the DeNorSob.

    The default used outline is Depth-Normal Outline Feature.

     
  22. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi eliphat,
    It looks like that because the realtime shadow on the Character is not enabled or the character does not recieved shadows.

     
  23. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Currently only 1 directional light supported and will use the brightest directional light.
    Is it possible for you to send a video recorded?
    Send by message here or email.

     
  24. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    Hello, I've been trying to extend RealToon (URP 12, Unity 2021.3.16f1) to handle dissolve. I've implemented dissolve for all the passes, but unfortunately it only works when the Render Queue is AlphaTest+1 and above (2501 and above). It also seems that outline isn't working properly for a value of AlphaTest and below in the Render Queue.

    Screenshot_14.png
    Dissolve when Render Queue = Geometry (2000) - No outline is shown. Screenshot_15.png
    Dissolve when Render Queue = AlphaTest+1(2501) - Outline is shown.

    I'm just using a simple dissolve and calling clip on the values I calculate. I do it in every pass. Would you happen to know if I'm perhaps missing something?
     
    Last edited: Feb 23, 2023
  25. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23
    I thought you told me before that cutout doesn't work with the Depth Normals feature? This is what I meant by cutout:

    I'm using Sobel as well for outlines, but I still need to use the Depth Normals feature on some objects, in particular behind cutout objects that are creating squares around them.

    See the square lines around the ivy leaves in this test screenshot:


    If I turn off the Depth Normals feature everything works fine, but then I lose all of the nice lines drawn on the rock wall behind it (except those created by Sobel). Is there anything I could do to the ivy/other shaders that would avoid this problem?

    For the grass and tree leaves I simply render them on a layer the Depth Normals feature doesn't use and the square outlines go away, but that means any lines created behind them go right through them as if they aren't there (see the bottom right of the wall). I can work around this problem for most objects, but for things like the ivy I cannot:

     
  26. eliphat

    eliphat

    Joined:
    Jul 4, 2017
    Posts:
    48
    Hi,

    Here is a minimal reproducer, project Assets, Packages and Settings in
    bug-repro-realtoon-lighting.zip
    . The video is in the zip named by date-time.

    Setup:
    100K lux directional sun light, shadow map on.
    5K lux directional fill light, shadow map off.
    Both lights are cast in straight -Y direction.
    A plane (shadow caster) with HDRP default material at Y = 5.
    The target is a cube with RealToon material at (0, 0, 0).

    In the attached video:
    1. Move the plane (shadow caster) in and out, nothing changes.
    2. With the plane active, toggle the fill light. See that the cube goes dark with the fill light off (expected, as the sun light is blocked by the plane).
    3. Disable the plane. Toggle the fill light. The cube goes brighter with the fill light off. This strongly indicates that RealToon is only catching the weak fill light instead of the main sun light. When the fill light is turned off, RealToon catches the sun light, which makes the object brighter.
    4. With the fill light on, toggle the sun light. Nothing changes.

    Preview of the setup:
    upload_2023-2-23_14-54-49.png

    Thank you for taking the time.
     

    Attached Files:

  27. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi thanks for sharing a project sample and video,
    I got the project but i request you to remove the bug-repro-realtoon-lighting.zip it includes the asset.
    I'll look into the project you gave and check it/troubleshoot it.

     
  28. eliphat

    eliphat

    Joined:
    Jul 4, 2017
    Posts:
    48
    Sorry as I did not notice the licensing problem. I have edited the post and removed the attachment.
     
  29. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi sorry for the late reply, you can do a dissolve using the Cutout feature.
    Just enable the Transparent Mode the enable Cutout under the Enable/Disable Feature
    then enable Use Secondary Cutout Only Assign a Texture in the Secondary Cutout.
    For glow edge, enable Enable Glow Edge.

     
  30. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi sorry for the late reply,

    - For example this one:
    This uses the DeNorSob and the material object is Cutout enabled.
    But it only uses the Depth not with Normals it is zero out.
    The normals can't be cutout.
    11.png

    - To prevent see through on transparent objects, change the "When To Insert" to "Before Rendering Transparent"
    Take note Transparent will not have Outlines, only the Cutouts and Opaque.


     
  31. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Thank you, thank you for reporting this one, it should use the highest value light, as check it now it uses the lowest it is weird and why it is like that.
    Have you tried to use light layers?

    I'll look into this and fix it and improve it more.

     
  32. eliphat

    eliphat

    Joined:
    Jul 4, 2017
    Posts:
    48
    I wasn't using light layers before this problem. Now I used light layers to work around it -- I excluded the fill light from RealToon characters and push the 'highlight color power' and 'environmental lighting intensity' values up to compensate for the light.
     
  33. hypertd

    hypertd

    Joined:
    Mar 6, 2017
    Posts:
    2
    Any updates on the DOTS compile issue?

     
  34. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23
    Thanks for the advice, and pointing me in the right direction.

    I knew about both of those options, but I wasn't happy with either. I would either lose the nice lines on rugged surfaces like the rock wall, or I'd have to put outlines directly onto the textures for things like ivy instead of using the nice outline renderer.

    So I tried probably a dozen different solutions, and settled on a mix of two. I'll write them down here in case anyone runs into the same issue.

    The simplest part was to use the URP Normals Texture instead of the "Hidden/Internal-DepthNormalsTexture" :

    I commented out
    Code (CSharp):
    1. //drawSettings.overrideMaterial = depthNormalsMaterial;
    in the DepthNormalsFeature and added
    Code (CSharp):
    1. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
    to the DeNorSobOutline shader. Then replaced these two sections:
    Code (CSharp):
    1.     //float3 DecodeNormal(float4 enc)
    2.     float3 DecodeNormal(float3 enc)
    Code (CSharp):
    1.         /*float3 normalData0 = DecodeNormal(SAMPLE_TEXTURE2D(_CameraDepthNormalsTexture, sampler_CameraDepthNormalsTexture, bottomLeftUV));
    2.         float3 normalData1 = DecodeNormal(SAMPLE_TEXTURE2D(_CameraDepthNormalsTexture, sampler_CameraDepthNormalsTexture, topRightUV));
    3.         float3 normalData2 = DecodeNormal(SAMPLE_TEXTURE2D(_CameraDepthNormalsTexture, sampler_CameraDepthNormalsTexture, bottomRightUV));
    4.         float3 normalData3 = DecodeNormal(SAMPLE_TEXTURE2D(_CameraDepthNormalsTexture, sampler_CameraDepthNormalsTexture, topLeftUV));*/
    5.         float3 normalData0 = DecodeNormal(SampleSceneNormals(bottomLeftUV));
    6.         float3 normalData1 = DecodeNormal(SampleSceneNormals(topRightUV));
    7.         float3 normalData2 = DecodeNormal(SampleSceneNormals(bottomRightUV));
    8.         float3 normalData3 = DecodeNormal(SampleSceneNormals(topLeftUV));
    It's not quite as nice as the other DepthNormal shader (I think it's either missing depth information, or the DecodeNormal method needs to be adjusted?) BUT it uses the DepthNormals pass on every individual material, which means alpha cutouts work with it.

    The second method I used was a bit trickier. I added a custom pass to every one of my shaders with the following flag:
    Code (CSharp):
    1. Tags { "LightMode" = "DepthThreshold" }
    and then changed the shader tag in the feature:
    Code (CSharp):
    1.             //ShaderTagId m_ShaderTagId = new ShaderTagId("DepthOnly");
    2.             ShaderTagId m_ShaderTagId = new ShaderTagId("DepthThreshold");
    Every single material was given a _DepthThresholdRatio 0..1 property, and the pass returned that value to the red channel of a texture. Then in the DeNorSobOutline shader I can manipulate how strong the depth based outlines should be on an individual material basis:
    Code (CSharp):
    1.         float edgeDepth = sqrt(pow(depthDerivative0, 2.0) + pow(depthDerivative1, 2.0)) * 100;
    2.         //edgeDepth = edgeDepth > (depth0 * (_DepthThreshold * 0.01)) ? 1 : 0;
    3.  
    4.         float depthThresholdRatio = SAMPLE_TEXTURE2D(_CameraDepthNormalsTexture, sampler_CameraDepthNormalsTexture, uv).r;
    5.         edgeDepth = edgeDepth > (depth0 * (lerp(_DepthThreshold, _DepthThresholdMin, depthThresholdRatio) * 0.01)) ? 1 : 0;
    This allows for an incredible amount of control over exactly how strong I want the outlines to be on every individual object, it was definitely worth the extra work.

    There's still the problem with unity terrain not ever writing to the texture, and so outlines go through the ground, just like with the original Depth Normals feature, but I'm trying to work around that by changing the DepthThresholdRatio at the base of anything touching the terrain.
     
    Last edited: Mar 2, 2023
    MJQStudioWorks likes this.
  35. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi Thank you for this,
    I'll look into this and see what i can do more.

     
  36. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, i'm still checking this,
    It seems unity did some changes again on URP 14 DOTS.

     
  37. joy211191

    joy211191

    Joined:
    Dec 2, 2013
    Posts:
    5
    Using 2021.3 with SRP and point lights. Anything that is a part of the environment, they all seem to flicker based on where the camera is looking. The issue still persists it seems. I want outlines in the static objects around the environment as well. Please advise.

    This issue only occurs at runtime and not in the editor.
     
    Last edited: Mar 6, 2023
  38. Sir_patrickl

    Sir_patrickl

    Joined:
    Jun 24, 2013
    Posts:
    62
    Hi, do you have any updates regarding support for deferred rendering path?
     
  39. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, as of now none yet, but forward plus is already supported on RealToon URP.

     
  40. Sir_patrickl

    Sir_patrickl

    Joined:
    Jun 24, 2013
    Posts:
    62
    Ok thanks. I was asking a "global snow" asset was released for URP which would have been perfect for my project but it only supports deferred.
     
  41. unity_AB0DE69EF5EADCB7FAC7

    unity_AB0DE69EF5EADCB7FAC7

    Joined:
    May 11, 2022
    Posts:
    2
    Is there a way to adjust RealToon`s shader settings based on distance from the camera? Kind of like LOD, I want to be able to turn off the shader`s outline when the camera is further away to save on performance.
     
  42. jasonkang_unity

    jasonkang_unity

    Joined:
    Jul 7, 2022
    Posts:
    6
    Hello, MJQStudioWorks.
    I want to use two Self Lit by duplicating Self Lit. I am wondering if this is possible. I want to use this to recreate several decal effects.
     
  43. minsumandoo

    minsumandoo

    Joined:
    Aug 24, 2018
    Posts:
    7

    Turn off 'Depth Priming' from Renderer Settings and It will do.
     
    TheHeftyCoder likes this.
  44. minsumandoo

    minsumandoo

    Joined:
    Aug 24, 2018
    Posts:
    7
    Hello.
    Can you please update RealToon to support 'Perspective corrected' MatCap?

    *It is equivalent to UTS(Unity toon shader)'s MatCap Camera Mode: Perspective.
    _2023-03-21 014201.png

    Cheers.
     
  45. jasonkang_unity

    jasonkang_unity

    Joined:
    Jul 7, 2022
    Posts:
    6
    I think on top of that, RealToon would be really cool if it had multiple Matcap color blending modes like UTS.
     
  46. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    Wow, thanks! Why does it do that though when it is enabled?
     
  47. bc25252

    bc25252

    Joined:
    May 28, 2017
    Posts:
    13
    Any update about texture layers?
     
  48. unityandrew_

    unityandrew_

    Joined:
    Sep 8, 2020
    Posts:
    2
    Hello, really enjoying the asset. Thank you. I am running into compile errors when I enable Raytracing (RT GI or Reflection) using Unity 2020.3.34f1 and HDRP 10.10.1 that read:

    d3d12: Couldn't bind a global Compute Buffer in a Ray Tracing Shader from "HDRP/RealToon/Version 5/Default". Compute Buffer "_EnvLightDatasRT" was not set.

    Attached a screenshot. Any help with this? Thanks
     

    Attached Files:

  49. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, sorry for the late reply,
    What RealToon HDRP Package did you unpack?
     
  50. MJQStudioWorks

    MJQStudioWorks

    Joined:
    Oct 12, 2012
    Posts:
    655
    Hi, sorry for the late reply,
    About the texture layers, no update yet still on the process of experimenting it.