EDIT: now released and available on github, see page two for details
Although UE4 is great in many ways I feel like it is lacking for stylized/non-photo real rendering. To remedy (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:
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. 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 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 .
So I guess my question towards both Epic and the rest of the community is: Would you be interested in such a shading model?
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
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 count as two :P)
I absolutely would be interested in ! 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 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.
Arnage, is super cool. We would love to support renderer extensions like , 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. 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 would be enough to implement all of your examples, is that the case? one is quite feasible to implement and similar to the Subsurface Profile shading model.
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 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.
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 :
Toon: Blends between regular shading an toon shading (defaults to full toon)
Toon Roughness: controls the sharpness of the transition between light and shadow. By separating 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 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:
@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 .
OMG. I love cell shading so much. I use it all the time in other rendering systems. If you sold , or somehow got it integrated. I would love you forever.
What I am curious about is the versatility of shading model. I mean, sure, you called it a toon shading model, so I reckon it is pretty clear what it does at its base, but what if you try to get creative with it? Is it possible to expose various variables you are using to create your own derivatives? Like for instance, in the stepped lighting, would I be able to influence the individual steps, like turning it into a rainbow or something? One of the things I miss in the UE4 engine (and yes, I know why it is missing) is the custom lighting model thing. While possibly not a perfect copy of the possibilities, I reckon that toon shader could be a step in the very right direction to get to a ācustom lighting modelā for UE4.
is great! Iād love to get my hands on it!
I know that Epicās main focus is towards realism and PBR but I hope theyāre flexible enough to allow you to have your toon shader in their code, should you decide to donate it to Epic.