Announcement

Collapse
No announcement yet.

Toon shading model

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is this still available? Links take me to Page not Found

    Comment


      Originally posted by ShadowMagnus View Post
      Is this still available? Links take me to Page not Found
      Yeah, it is. You want to use Nate's version of it, though, because he ported it to all the latest versions. (Read my post above this one to find out where his github fork is.)
      The reason why you're getting page not found is because your UE4 account isn't linked to a github account.

      1. First create a github account.
      2. Click on your UE4 user name (in the forums here), and select Developer Information.
      3. Click on Synced accounts on the left.
      4. Click on the Github icon and add the github user name you registered in step 1.

      You'll then get a confirmation from github, and will now be able to access all the forks people have made of UE4.

      Comment


        Discovered some techniques to make the self-shadow on the character razor-sharp.
        Through some minor modifications to the capsule's shadow, not only can the sharpness and uniformities of the character's self-shadows be achieved, but also makes the projection shadow of the character on the ground more closely conforms to what we often see in anime—a combination of several ellipses.
        Click image for larger version

Name:	capsule_shadow.jpg
Views:	236
Size:	99.8 KB
ID:	1483596

        Comment


          Originally posted by Arnage View Post
          I know how to make a patch, but I agree that legally that would be problematic. Additionally I'm afraid you wouldn't really be able to reach most UE4 users on a site like that Sellfy.

          Anyway, I'm glad people at least like it, so before trying to figure out what to do with it I'll first continue development

          To test the versatility I've started to try and recreate some iconic non-photo-real styles in UE4 using my toon shading model, here's the first: (or does this count as two :P)

          [ATTACH=CONFIG]39881[/ATTACH]
          any chance you'd want to share the set up you had to make the Wind Waker HD look?
          Consider supporting me on patreon

          Weapon Master and VRE Merge TUT

          Life Art Studios | Discord | End of Days - VR Zombie Survival

          Comment


            Originally posted by Starkium View Post

            any chance you'd want to share the set up you had to make the Wind Waker HD look?
            It's pretty simple: I added a gradient to the emissive channel that lerps between a sky and a ground bounce color based on the world Z-axis. This gradient is then masked by a fresnel term. (And I enabled sharp shadows on the light)

            Comment


              Arnage If you have time I was wondering if you could direct me on how to use the CustomData1 pin (toon roughness) for something else.
              I wanted to use it instead to determine how lit the object is based on the light direction to the surface normal.

              I'm not sure exactly which NoL I should modify, but I'm pretty sure it's in one (or some) of these files:
              ShadingModels.ush, DeferredLightingCommon.ush BRDF.ush


              I tried changing ShadingModels.ush and DeferredLightingCommon.ush (multiplying NoL by CustomData1) but got some strange results.

              It's my understanding that, currently Lit and Unlit areas are set based on a realistic 0.5 hard-coded threshold. So 90 degrees within the light direction is lit, over 90 and it's not.

              Basically, in the end, I want to be able to change the NoL threshold to anywhere between 0 - 1 at runtime, 0 = fully lit, 1 = fully unlit, .5 half-lit half-unlit, etc..

              Could you or someone else advise where exactly I need to multiply NoL by customdata1 (and consequently, how to hardcode the toon roughness to 0 or .0001 if necessary)?
              Last edited by kusokuso1; 06-13-2018, 11:50 PM.

              Comment


                Originally posted by kusokuso1 View Post
                ArnageBasically, in the end, I want to be able to change the NoL threshold to anywhere between 0 - 1 at runtime, 0 = fully lit, 1 = fully unlit, .5 half-lit half-unlit, etc..
                So you want to do a NoL offset?
                Directly modify the Falloff_Toon_Stepped function in ToonShading.ush.

                The use of NoL offset is really necessary.
                You want to increase the Shadow bias if you want to alleviate the shadow problem.
                After Shadow bias is raised, there will be some light leakage problems.
                So you need to use the NoL offset to blacken the umbra
                Last edited by IOchair; 06-14-2018, 10:47 PM.

                Comment


                  IOchair Hey thanks a lot for the help, and sorry for the laggy reply. The shadow isn't really a problem. I mean, it's realistic right now.
                  I was just looking for a little more control over the amount of shadow in an attempt to convey character emotion.

                  See, I've been watching some animation lately (specifically old school Dragonball) and have noticed that sometimes only a small portion of characters are shaded (as if the NoL is .9) when they are mad or angry, and sometimes they're fully lit (as if the NoL is 0) when they're more happy. I just wanted to be able to control that.

                  I'll have a look at Toonshading.ush. I really appreciate the help!

                  Edit: I don't think I'm doing this right. If I set CustomData y to 0 (in material editor) then the whole mesh is shaded, which is good. But, setting CustomData.y to any value over .01 will give me the default .5 (half shaded, half lit):



                  (I commented out the branch because I don't care what Toon Roughness is. I want it always at its default 0.

                  Code:
                  float Falloff_Toon_Stepped ( float NoL, float3 CustomData )
                  {
                      float Blend = CustomData.x;
                      //float Roughness = CustomData.y;
                      float Amount = CustomData.y * NoL;
                      float Steps = 1 / CustomData.z;
                      //float NoLS = NoL * Steps;
                      float NoLS = Amount * Steps;
                      float Base = ceil(NoLS) / Steps;
                  
                      //Branch to prevent divide by zero and save some instructions when Smoothing = 0
                      //BRANCH
                      //if (Roughness != 0)
                      //{
                      //    float iR = 1 / Roughness;
                      //    float SmoothEdge = (1 - saturate((NoLS * iR) - (clamp(floor(NoLS), 0, Steps) * iR))) / Steps;
                      //    Base -= SmoothEdge;
                      //}
                  
                      Base = lerp(NoL, saturate(Base), Blend * Blend);
                      return saturate(Base);
                  }
                  Attached Files
                  Last edited by kusokuso1; 06-18-2018, 02:56 AM.

                  Comment


                    Hi,

                    I researched 3 days before finally saw this wonderful thread! I couldn't wait integrated it. However I have 2 problems that seem to be deal break for our game:

                    1) About the ambient indirect light being smooth. The solution given by the forum is to set Ambient Occlusion to 0, and set some color in Emissive to fake indirect light. Do you guy really do this? Our game is mainly night stealth scene, always having an Emissive is not an option, I really want it completely dark in shadows. In night scene if player stays in the dark, the ambient shading is really strong and gives out the low poly of the model, see the character face in the picture. Where could I completely disable the ambient indirect light? I turned off ambient occlusion in world settings, post process volume, and delete sky light actor. It removes the indirect light on static objects. But the character (skeletal mesh) always have indirect light.
                    Click image for larger version  Name:	 Views:	1 Size:	33.4 KB ID:	1490655

                    2) Self shadow seems to cause problem in certain angle. It has artifacts on the faces that are parallel to light, see the picture of pink geometries. Post #348 by erodann also had this problem but no one answered, see picture of white geometries taken from erodann's post. Setting the light's Shadow Filter Sharpen to full, as suggested by the forum, help a little, but still get very noticeable artifacts. By the way, If I turn Cast Shadow off, the artifacts are gone.
                    Click image for larger version  Name:	 Views:	1 Size:	32.2 KB ID:	1490656
                    Click image for larger version  Name:	 Views:	1 Size:	45.1 KB ID:	1490657
                    Toon render is really crucial for our small budget game, I'd appreciate if anyone could help out.

                    I tested in both version 4.18 and 4.19(merged to 4.19.2) from marynate, they both have the problems.

                    Thanks.
                    Last edited by renwei2; 06-18-2018, 12:53 PM.

                    Comment


                      kusokuso1
                      ​​​​​​​
                      The meaning of NoL offset is of course ADD offset to NoL, not multiplication.
                      Try add something to NoLS

                      renwei2
                      To solve the problem of indirect light, you still need to change the source code.
                      The problem of shadow edges is even more difficult. The artifacts on the edge of the umbra are caused by the limitations of the shadow mapping technology itself.
                      Switching the shadow filter to PCSS with the console r.Shadow.FilterMethod 1 can solve some umbral problems, but at the same time the shadow edges will also be blurred
                      Or you can increase the shadow bias a lot, but the resulting light leakage problem needs to be solved using the NoL offset I mentioned above.
                      The problem of shadow blurring can be solved by increasing the shadow map resolution and reducing the dynamic shadow distance

                      Comment


                        Considering that everyone is actually facing similar problems, I have made a list of the problems that I have encountered that have been resolved and have not yet been resolved.
                        1. Character Face Shadows (resolved): Added a Custom Material Node to modify normal in the engine.
                        2. Skylight, indirect light, and reflection are not stylized (resolved): The effect of normal on skylight, indirect light, and reflection is removed in the source code.
                        3. Outline and inner line (resolved): Add Custom data control node, specifically use two Custom data to control the post-process material.
                        4. Self-shadowing accuracy (resolved): Use ray-traced capsule shadows instead of shadow maps, combined with normal edits.
                        5. Character receiving shadow accuracy (resolved): Use a decal instead of a shadow map (remove the fade-out of the deferred decal X-axis).
                        6. Character contact shadow (unresolved): Shadows on small areas of the character, such as the projection of hair on the forehead.
                        7. Stylized eyes (unresolved): Porting some properties of the default eye material to the Toon Shading Model, adding a number of controllable fake highlights.
                        8. Stylized Perspective (unresolved): Achieve a few common perspective errors in Anime.
                        9. Stylized metal (unresolved): Makes metal objects in the scene more stylized.
                        10. Stylized edge light (unresolved): Rim light around static objects in Anime.
                        11. (And more to discover)

                        Comment


                          IOchair
                          Thanks for your answer, and the list! I'll try while still learning some of the terms (graphic programming noob).

                          By the way, do you think all these effort we're doing is the right direction to go production? It looks like the more we dig into it, the more problem we discover. It worries me because I'm working for a commercial project and not just for experiment and learning. It'd be great to hear your opinion as you seem rather experienced.

                          Thanks.

                          Comment


                            renwei2

                            First of all, it depends on what you really want.

                            If you want a stylized effect that stands out from most other games on the market today, go for a few more steps and you will be there.

                            If you want more, then you need to know the fact that since 2014, there has been no title for computer graphics paper containing "cel shading".

                            Comment


                              hey guys,I just found a technique for custom shading model development.
                              link below
                              https://forums.unrealengine.com/deve...model-test-bed

                              Comment


                                Okay, at first: This is looking very great!

                                But even if I've connect the github account to the ue account, I can't open the links :/
                                Any idea?

                                Comment

                                Working...
                                X