Announcement

Collapse
No announcement yet.

Toon shading model

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

    Great stuff Arnage, here's my initial test. Definietly like this solution more compared to all those post process blends, will be adding custom outline through post process though.



    Aaaand, an outline.

    Click image for larger version

Name:	outline.png
Views:	155
Size:	547.4 KB
ID:	1424218
    Last edited by VirtualLilies; 02-06-2018, 11:05 AM.
    VR/AR Development [Portfolio | YouTube | LinkedIn]

    Comment


      Originally posted by IOchair View Post
      another custom output node added.
      CustomNormal node make it possible to overwrite GBuffer.WorldNormal in material editor.So no more 3rd party normal editing tool like XSI was needed anymore.
      That's really interesting. Is it pointing all the normals straight up to achieve that effect?

      To skip the external normal editing is something that would be fantastic for the toon shader which is why I can't help but ask - will you be sharing your custom stuff under the MIT licence for others to use, maybe allow it to be put into the main toon shader engine builds?

      Comment


        Originally posted by Daniel Skipper Games View Post

        That's really interesting. Is it pointing all the normals straight up to achieve that effect?

        To skip the external normal editing is something that would be fantastic for the toon shader which is why I can't help but ask - will you be sharing your custom stuff under the MIT licence for others to use, maybe allow it to be put into the main toon shader engine builds?
        This effect is achieved by changing the normal direction to spherical (the center of the sphere is at a fairly low position). Because this is not a personal project, I do not have the right to share technical details.

        But the basic idea I mentioned earlier is:
        Copy and paste the MaterialExpressionClearCoatNormalCustomOutput.h and change it to your own custom node. ​​​​​​​
        shader side you modify Engine/Shaders/Private/ShadingModelsMaterial.ush

        You can try it yourself

        Comment


          According to the existing file structure, Toon Shading model can actually be implemented as a plug-in. As long as the shader file of the Clearcoat shading model is replaced by the shader file of the Toon Shading model, it can be implemented without changing the cpp file. Of course, you will lose the Clearcoat shading model, but considering that you are already in a project that has a stylized need, that should not be a problem.

          Comment


            Originally posted by IOchair View Post
            According to the existing file structure, Toon Shading model can actually be implemented as a plug-in. As long as the shader file of the Clearcoat shading model is replaced by the shader file of the Toon Shading model, it can be implemented without changing the cpp file. Of course, you will lose the Clearcoat shading model, but considering that you are already in a project that has a stylized need, that should not be a problem.
            That would be incredibly useful. Also would be nice to have support for forward renderer

            Comment


              Originally posted by motorsep View Post

              That would be incredibly useful. Also would be nice to have support for forward renderer
              http://www.tomlooman.com/disneyfaciliershadow/
              In the forward rendering, you can get the shadow information directly.
              So complex implementations like Toon shading model may not be necessary.
              At the same time, consider the lack of GBuffer, you will lose the possibility of implementing a post processing outline.
              By that time, implementing outline via vertex shader can be a big issue.

              Comment


                It should be considered that as we are still struggling with simulate old anime, the new anime has recently gone further in lighting effects.
                New anime this season, "Violet Evergarden" has introduced a stylized bounce light on the character.
                (And at the moment I can not find a way to do this in render)

                Comment


                  Now I'm working on stylized indirect lighting for dynamic object...... and can't find the code were indirect lighting added to dynamic object surface

                  Comment


                    Any Idea why the editor is running like a snail? The "Normal" editor works just fine.

                    Comment


                      Originally posted by IOchair View Post
                      According to the existing file structure, Toon Shading model can actually be implemented as a plug-in. As long as the shader file of the Clearcoat shading model is replaced by the shader file of the Toon Shading model, it can be implemented without changing the cpp file. Of course, you will lose the Clearcoat shading model, but considering that you are already in a project that has a stylized need, that should not be a problem.
                      Could you please write down the steps necessary for this?
                      Thank you =)

                      Comment


                        Finally find something about indirect lighting in BassPassPixelShader.usf.

                        Though I'm still struggling with third-order Spherical Harmonic and not able to add stylize bounce color.
                        I can make my shading model ignore bounce light color now.

                        Click image for larger version

Name:	bounce_lighting.png
Views:	164
Size:	250.4 KB
ID:	1446062Click image for larger version

Name:	bounce_lighting_ignore.png
Views:	155
Size:	236.6 KB
ID:	1446063

                        Comment


                          Originally posted by Zhentouk View Post

                          Could you please write down the steps necessary for this?
                          Thank you =)
                          I think it's way tougher than just clone and compiles Toon Shading branch.

                          1.Look at https://github.com/EpicGames/UnrealE...1-release-toon

                          2.Transfer all the diff shader code of toon shading branch to your cleatcoat shading model.

                          3.replace what custom pin in toon shading model did with clearcoat custom normal node(in ShadingModelsMaterial.ush)

                          Comment


                            Originally posted by IOchair View Post
                            You can try it yourself
                            I can also fail miserably by myself too !

                            I did have a look into it but I'm not really a coder (can usually understand the syntax but fail to implement anything from scratch - visual scripting on the other hand is wonderful), so I didn't really know where to begin. In fact as I type VS is again trying to compile the 4.19 source code after no success all day, but hopefully this time I'll have success as VS is no longer being blocked by my AV from writing the compiled .dll and .exe files.

                            Looking it up online I found one reference to somebody who was attempting to convert mesh normals to a spherical offset through openGL and the response to them was that the actual calculation is pretty straight forward, it was the normal - world location of the sphere.

                            Not entirely sure how that works since if your sphere is at 0,0,0 and your normal at say 50,50,50 then 50-0 is still 50.

                            My own thought of something to try would be to use BP to trace out from a static mesh sections normals to an encapsulating larger sphere, use the traces' hit normal, reverse it and then plug that back into the normals array and finally create the new mesh - not sure if that would work how I picture in my mind and can't test it with VS compiling anyway

                            New anime this season, "Violet Evergarden" has introduced a stylized bounce light on the character.
                            Do you have any reference images/videos of this as the few clips I saw of this when I searched YouTube, I didn't actually spot the bounce lights (maybe I saw them and they didn't register) but I was curious to see what new lighting you meant.

                            Thanks.

                            Comment


                              Originally posted by Daniel Skipper Games View Post
                              Not entirely sure how that works since if your sphere is at 0,0,0 and your normal at say 50,50,50 then 50-0 is still 50.
                              That is just some highschool math.
                              1. normal direction of any given point on a sphere is:vertexPosition - spherePosition
                              2. Then,you set a spherePos var via BP,so if you mesh is a sphere,and spherePos is just equal to it's object position.The normal direction is obvious: vertex WorldPositon - spherePos
                              3. But you know that you mesh is not a sphere,so the length of the normal vector may != 1.And you normalize it:normalize(WorldPositon - spherePos)
                              4. Finally,use this result to override GBuffer.WorldNormal(if you have that custom normal mat node).
                              5. You can also do some lerp between vertexNormal and Calculate Normal.

                              Originally posted by Daniel Skipper Games View Post
                              Do you have any reference images/videos of this as the few clips I saw of this when I searched YouTube, I didn't actually spot the bounce lights (maybe I saw them and they didn't register) but I was curious to see what new lighting you meant.
                              Click image for larger version

Name:	1.png
Views:	150
Size:	256.8 KB
ID:	1446935Click image for larger version

Name:	2.png
Views:	165
Size:	369.2 KB
ID:	1446936Click image for larger version

Name:	3.png
Views:	192
Size:	229.4 KB
ID:	1446934

                              Let me call this the NEXT GEN ANIME!!!

                              Comment


                                Been trying to port this to a plugin but I'm kinda of a newbie in messing with the rendering code in the engine now and I'm stuck. Can anyone help?

                                https://forums.unrealengine.com/deve...er-on-a-plugin

                                Comment

                                Working...
                                X