Finally! Here it is - my free #UE5 Lumen and Nanite compatible toon shader. 3 methods for cel shading, 7 methods for outlines, and a custom function example. 🧵Breakdown thread below (1/15) 👇github.com/chrisloop/Unre…#UnrealEngine5#gamedev
This is an unlit surface shader. The diffuse and specular colors are based on the main directional light in the scene. Very consistent results, but we can do more... (2/15) #UnrealEngine#GameDev#ToonShader
Here I desaturate the final render, mask out the shadow and change it’s color to match the cel shading bands (3/15) #UnrealEngine#GameDev#ToonShader
This time I desaturate the entire scene and posterize the result. You get really noisy edges because Lumen is raytracing, but it’s still a neat style. I tweeted a better example here
As of UE 4.2 you can do a separate render pass for just the transparent objects in your scene. Then apply any edge detection algorithm you’d like. Looks awesome with animated fractures (5/15) #UnrealEngine#GameDev#ToonShader#OutlineShader
This one really surprised me. If you turn indirect lighting intensity all the way down, Lumen shadows become crisp enough to do a nice comic style outline around the shadows (6/15) #UnrealEngine#OutlineShader
Normals edge detection is a great complement to depth edges because you can catch edges within each object like on the cube. More later on how I deal with rounded geometry getting ugly extra lines (8/15) #UnrealEngine#OutlineShader
This is a nice method when you want edges everywhere and you don’t want to fiddle with sensitivity settings (9/15) #UnrealEngine#OutlineShader
This is the most bizarre and fun edge method I use on every project. I stick a texture into the specular channel of the surface shader, then sample it in post and overlay the edges on the final render (10/15) #UnrealEngine#OutlineShader
During modeling, or using the UE Modeling plugin I assign a random value to the red channel of each faces vertex color, and again feed it into the specular channel for edge detection (11/15) #UnrealEngine#OutlineShader
Here I do a pseudo random number based on each object’s WS position, and again use that value in the specular channel. It’s much faster than manually coloring vertices, and I can fill in the missing interior edges with Normals based edges (12/15) #UnrealEngine#OutlineShader
Nanite does not support a custom depth buffer yet so I use a specular value of 0 to disable normal based outlines in post, and a range of .1 - .5 for everything else, in particular object position color. Low specular values are imperceptible. (13/15) #UnrealEngine#OutlineShader
The custom function material node allows you to do loops so you can achieve Voronoi patterns, among others. I use these patterns for edge detection detail just like with the procedural textures by @WMillArt (14/15) #UnrealEngine#gamedev
If you made it this far, thanks! I share everything I learn about shaders and gamedev here on twitter. Follow/RT me if you dig it, it'll always be free. #indiegamedev#UnrealEngine#Unity3D
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Perfect edge detection for Unreal & Unity. It's painful adjusting Depth/Normal thresholds and rendering still misses edges or picks up artifacts. The solution is a perfect input map like the colors you see here. Project files in the thread📂🧵👇 #UnrealEngine#unity3d#gamedev
Vertex colors on the models make for a perfect screen space texture for identifying and shading edges. The IDMapper Blender addon quickly identifies similar geometry, and lets you tweak the level of detail blendermarket.com/products/idmap…
Rendering the vertex colors to a texture and then sampling it for edges is a well covered topic, here is my approach for both engines. Unreal Engine 4: github.com/chrisloop/UE4_…. Unity 2020 HDRP: github.com/chrisloop/HDRP…