Announcement

Collapse
No announcement yet.

Toon shading model

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

    Toon shading model

    EDIT: now released and available on github, see page two for details

    Click image for larger version

Name:	ToonShading1.png
Views:	1
Size:	1.9 KB
ID:	1149973

    Although UE4 is great in many ways I feel like it is lacking for stylized/non-photo real rendering. To remedy this (and to better learn how UE4's deferred shading system works internally) I have been working on a toon shading model that should allow for a greater range of visual styles while seamlessly integrating with the rest of the rendering system.

    Here's a screenshot of some of the features that work right now:

    Click image for larger version

Name:	ToonShading2.jpg
Views:	1
Size:	90.2 KB
ID:	1149968

    There are still some issues to resolve, especially with the mobile/html5 version, but the basics are done.

    However, I'm not exactly sure what to do with it. This would seem like something that would fit well on the marketplace and the revenue would help me to further develop and support it. Sadly that seems to be technically impossible. The way the deferred shading system works means that most of my changes are all over Epic's code and can't easily be separated into their own files. And that is assuming code plugins ever get their own shader source folder, which they currently can't have.

    A second option would be to finish it up and make a pull request to get it added to the main engine repository. If the marketplace route is impossible I would prefer giving it to the community this way over not making it available at all. However, before it is anywhere near good enough for that I would have to put in quite a bit of additional work so it would be nice to know if Epic would even be interested in adding something like this.

    So I guess my question towards both Epic and the rest of the community is: Would you be interested in such a shading model?
    Last edited by Arnage; 09-13-2015, 06:44 PM. Reason: Added note to top of post

    #2
    That's pretty slick!

    I know right now code assets aren't sold on the marketplace but I think they have said that will change in the future.
    Trevor Lee

    Comment


      #3
      Originally posted by Hyperloop View Post
      That's pretty slick!

      I know right now code assets aren't sold on the marketplace but I think they have said that will change in the future.
      Thanks!

      In a recent stream Epic indeed said that code plugins should be allowed in the near future. However, as far as I understand the issues I listed would still be a problem then, as they are issues with the plugin system itself. Although it would be great to be proven wrong in this

      Comment


        #4
        Having it as a git pull would be pretty great to me!
        Bacon Man : An Adventure (UE4)

        Comment


          #5
          Sell it on Sellfy ... turn it in to a set of DIFFs and have a decent manual for the installation of it.

          Creating DIFFs is pretty straight forward and is the standard for shipping source code changes.

          The Ten Minute Guide to diff and patch

          How to create a patch

          http://git-scm.com/docs/git-diff

          Your challenge is validating that the person is licensed with Epic for Unreal Engine as per the FAQ:

          Can I share the Unreal Engine source code or tools with others?
          You can share the source code or tools, along with any modifications you’ve made, with anyone who is an Unreal Engine licensee who is authorized to access the same version of the engine as yours, e.g. the 4.x.x version number of your installed build.
          Quinton Delpeche
          Founder - Gobbo Games | Designer - The Colony 2174 (Board Game) | Developer - Riders of Asgard

          Comment


            #6
            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)

            Click image for larger version

Name:	ToonShading3.jpg
Views:	1
Size:	90.5 KB
ID:	1076570

            Comment


              #7
              I absolutely would be interested in this! I've been trying to experiment with Windwaker-style toon shading for my game, but I just gave up on it as rendering is something I know very little about and the only thing I've seen the community produce until now was outline post process materials, which is only half of what I want. So seeing this gives me some hope. I'd pick it up in a heartbeat! I don't really care if I have to pay for it. I'm just desperate for some actual toon shading in UE4. :P

              Comment


                #8
                Arnage, this is super cool. We would love to support renderer extensions like this, but unfortunately won't be able to any time soon via code plugins and the like due to the amount of work involved.

                It seems to me a nice implementation of custom shading is that there's a Custom Shading Model you can pick per Material, and each project gets to supply a material which does the custom shading given Normal, LightVector, etc. This is really difficult to implement though as there are lights that aren't punctual, like sky lights and lightmaps, where there isn't a LightVector at all. You have to write some spherical harmonic code for that and know a lot of math, so it won't be the user friendly thing that's desired.

                The next best thing is to have a 'Remapped Shading Model' which simply allows the specification of a Lookup Texture for diffuse (addressed by dot(N, L)) and specular. It seems to me this would be enough to implement all of your examples, is that the case? This one is quite feasible to implement and similar to the Subsurface Profile shading model.

                Comment


                  #9
                  Originally posted by DanielW View Post
                  Arnage, this is super cool. We would love to support renderer extensions like this, but unfortunately won't be able to any time soon via code plugins and the like due to the amount of work involved.

                  It seems to me a nice implementation of custom shading is that there's a Custom Shading Model you can pick per Material, and each project gets to supply a material which does the custom shading given Normal, LightVector, etc. This is really difficult to implement though as there are lights that aren't punctual, like sky lights and lightmaps, where there isn't a LightVector at all. You have to write some spherical harmonic code for that and know a lot of math, so it won't be the user friendly thing that's desired.

                  The next best thing is to have a 'Remapped Shading Model' which simply allows the specification of a Lookup Texture for diffuse (addressed by dot(N, L)) and specular. It seems to me this would be enough to implement all of your examples, is that the case? This one is quite feasible to implement and similar to the Subsurface Profile shading model.
                  Thanks!

                  A full custom shading model might indeed get quite complex. Maybe you could provide a number of preset methods to handle those special case lights while providing full control over the easier to understand regular light handling? I think that should be enough for most use-cases, while not being too complicated for the user.

                  Regarding a "Remapped Shading Model": that would indeed work for this case. The only thing I'm not sure about would be mobile, which would be a shame as NPR visuals tend to be quite common in mobile games. You would lose one of the already scarce texture samplers and I'm not sure you wouldn't get texture filtering artifacts due to lower precision combined with the high contrast lookup textures that would be needed for toon shading.
                  Last edited by Arnage; 05-21-2015, 06:03 AM.

                  Comment


                    #10
                    I want this so bad!!! Will you be selling this anywhere any time soon?
                    David Hache aka Mortusnyte - Youtube
                    Content Creator
                    -Match-3 Blueprint
                    -Simple Checkpoint System
                    -2D Character Engine - WIP

                    "Give me your best shot... If you're prepared for the void!" -Magus, 600 A.D.

                    Comment


                      #11
                      Only the outlines is missing.


                      Moreover this is perfect.



                      Luny
                      lunybunny.com
                      lunybunny.com

                      Comment


                        #12
                        I've updated the interaction of the shading model and settled on the following input:

                        Click image for larger version

Name:	ToonProperties.png
Views:	1
Size:	13.8 KB
ID:	1078791

                        To prevent over-complicating the material editor I reused the two clear coat properties as they work in a very similar manner. The properties work like this:

                        Toon: Blends between regular shading an toon shading (defaults to full toon)
                        Toon Roughness: This controls the sharpness of the transition between light and shadow. By separating this from the regular roughness property you can control specular response and reflections independent of the toon shading roughness.
                        Toon Step Size: create stepped lighting by lowering this below the default of 1.0. A value of 0.25 would result in four discreet steps in the lighting.

                        Additionally the mobile version now works. However, in a similar way to how the clear coat and subsurface shading models handle mobile it uses a cheaper, simplified version with less control. Here's a mobile link as an example:

                        Click image for larger version

Name:	MobileLink.jpg
Views:	1
Size:	30.5 KB
ID:	1078794

                        @lunyBunny: It wouldn't make much sense to implement an outline in a shading model. However, there are many ways to achieve outlines in UE4 that could be easily combined with this.

                        Comment


                          #13
                          This is exactly what I'm looking for. It would be so useful if shading models could be added as plugins Epic plz

                          Comment


                            #14
                            OMG. I love cell shading so much. I use it all the time in other rendering systems. If you sold this, or somehow got it integrated. I would love you forever.

                            forever.
                            Check out our game Arcus!

                            Comment


                              #15
                              I hope something like this will be integraed into the engine someday.

                              Comment

                              Working...
                              X