Note: This shader is a work in progress, some features are currently missing, broken or incomplete.
RyShade is an NPR (non-photo realistic) shader for stylized, anime and toon assets that attempts to render assets 'half-way' between PBR (physically based rendering) and toon shading.
Rendering assets in this manner comes with a few benefits over rendering using a traditional toon shader, or PBR shader:
- Unlike in toon shaders, environment and indirect lighting is accumulated in the shader, resulting in good lighting in a variety of lighting conditions.
- The shader maintains detail better than many toon shaders.
- Optimized approximations can be used without being visually intrusive, such as in the case with subsurface scattering. This makes the shader more optimized than PBR shaders, which is especially useful for virtual reality games.
This shader attempts to create a 'standard' NPR shader format, similar to how there is a standard for PBR shaders. To achieve this goal this shader takes inspiration from numerous stylized and toon shaders used in games such as Valorant[2], Genshin Impact[1], and popular shaders such as the Poiyomi Toon Shader[3].
A main feature of this shader is that it has implementations for Blender, Unity and VRChat (Unity's built-in render pipeline) which allows users to see the final result while modelling Blender, then export their work seamlessly to Unity. This is possible because the shader is kept as simple as possible, without sacrificing functionality.
If you would like to help support this add-ons development you can...
- Donate to my PayPal
- Star and follow the repository on Github
- Share RyShade
- Report issues and give suggestions through the Github issues page
Cheers!
-
The base lighting of this shader is calculated using the Half-Lambert[7][9] lighting model, which helps prevent the rear of objects from losing their shape and looking too flat. This lights assets in a stylied way with a more constant ambient lighting effect, thus providing a good middle-ground between realistic and toon lighting. This lighting technique, or a variation of it is used in many successful games such as Genshin Impact[1], Valorant[2], Team Fortress 2[8] and popular shaders such as the Poiyomi[3] shader.
-
Specular highlights are calculated using GGX microfacet distribution[4]. This allows the shader to represent smooth and rough materials. The GGX normal distribution method was selected specifically because of it's compatability with Blenders material nodes[12], but it's also generally considered to be better than some alternatives like the Blinn-Phong[13] method.
-
Metalness is also calculated using GGX microfacet distribution[4] where the result of the GGX calculation is multiplied into the shader output. This isn't a physically accurate way of calculating metalness[5], but provides good results in the toon shader. In a PBR approach users would mark metallic objects as 0 (not metallic) or 1 (fully metallic) and generally nothing in between for more physically accurate results. With this shader it would be correct to have a value between 0 and 1, to produce lighter shades of metallic looking materials. It may also be good to note that you could effectively think of the metallic property in this shader as reflectivity.
-
The shader calculates artificial subsurface scattering by using a modified lambert lighting[6][10], many games such as valorant[2] and Uncharted 4[11] use a version of this approach.
-
The shader supports emission (for glow).
-
The shader supports transparency (cutout).
-
The Unity implementation uses ORM (occlusion, roughness, metallic) channel packing to optimize texture memory optimization.
-
The shader provides 'artist friendly' properties to create different material types, in a similar manner to PBR shaders.
-
Lastly, I documented, commented and linked to references / learning resources to help users modify the shader if they need something custom.
- Genshin Impact Shader UE5
- Valorant Shaders and Gameplay Clarity
- Poiyomi Shader
- Microfacet BRDF: Theory and Implementation of Basic PBR Materials [Shaders Monthly #9] - GGX Microfacet Distribution
- Catlike coding Rendering Part 4 (covers PBR lighting calculations in Unity, and a fairly accurate approximation of metallic and specular workflow)
- Fast Subsurface Scattering for Unity URP by John Austin
- Half Lambert lighting from Valve
- Stylization with a Purpose The Illustrative World of Team Fortress 2 by Jason Mitchell
- Lighting Models by Jordan Stevens
- Unity documentation - Surface Shader Lighting Examples
- Advances in Realtime Rendering SigGraph 2016 The Process of Creating Volumetric-based Materials in Uncharted 4 by Yibing Jiang (Naughty Dog) slide 22
- Blender Manual for the Glossy BSDF
- Blinn-Phong Reflection Model
Q: Why is this shader free?
I believe in free and open-source software so everyone has the freedom to create!
Q: Why not use other existing shaders such as the Poiyomi shader for a Unity to Blender workflow?
Like many shaders the Poiyomi shader has only an implementation for one software, there is no implementation for Blender. This means it's not possible to see your model with the shader that will be used in the final product. Not having the shader in Blender also means your can't render promotional material or cinematics for your asset in Blender as the final result that would be exported into Unity would look visually different. RyShade has an implementation for both Blender and Unity, which makes the asset transition between the two software seamless.