A different kind of cel shader

That “pencil scratch” aesthetic is gorgeous. Is that possible with the shader you uploaded or is it with a new version you’re working on?

Cheers! I haven’t uploaded a shader, just a test build of the game. I’ve added a lot since then, if there’s some interest I’ll put the project up for you to pick through.

This is how it ended up last night. Posterized the AO layer and readded it behind the pencil lines.

Very nice!
I really like all these pencil lines!
Keep up the good work!

That shader looks awesome! I’d definitely be interested in it, if you decide to upload it.
A new video of the current version of your level would be nice too. It seems like you’ve added lots of new stuff in the meantime.

Thanks :slight_smile: I’ve been trying to get a video but Shadowplay stopped working after the first time. Has anyone been using it? What’s a good alternative?

Very “Borderlands” and very cool looking, nice work! :wink:

So the cel shader node graph is still a bit of a mess but here’s a look. The cel shader is applied as a global post-processing effect. Check Shaders/CelShader/CelShaderDesert for values you can adjust. They’re also not entirely fathomable because the shader is pretty complicated, but try adjusting them and see what each change does. Some of the values should be hard-coded so I’ll do this in a later version. The undo key is your friend.

The components of the shader are broken down into groups:
Cel Detail draws fine lines using edge detection on the final scene render target.
Cel Outline draws heavy lines using edge detection on the depth layer.
Shadow Shading uses the AO layer to create a posterization effect.

There are several other effects included in this shader such as fog tinting, depth blur and other things that I needed to happen at specific stages in the render pipeline.

Because the cel shader uses edge detection, the best way to control if lines are drawn inside your objects is by modifying their texture. You can reduce lines by blurring/de-contrasting your texture. The benefit of this over cel lines baked into the texture is that the level of detail will increase and the cel shading will change as you get closer, giving you as much detail as you’ll ever need. Likewise as you pull away, fine details will no longer be shaded. This just happens with no extra effort. You can also do things like apply falloff to different aspects of the cel shader at different distances, eg. Fine detail near, heavy lines far.

Edit: I just discovered the migrate function. That’s really cool. Here’s a much smaller package that you can apply to any of the content examples. This one has been tuned for the new Hang-glider Landscape content example.

Download: (Took the link down, going to add some more improvements)

To use it, drag the files into the content folder, add a post-process object, set it to unbound and add a misc->blendable asset. Select “CelShaderWinter”. (Example here)





Bump because of big edit.

Dude, that is awesome. Thank you for the the examples. It will help out a ton!

Mixamo really is fantastic. Worth every cent.

Looking good man! Good to see some Kiwis on here :wink:

Thanks dude, it IS nice to see some other kiwis here. :slight_smile: Speaking of NZ, have you seen the $25k game dev competition running in NZ? Sadly the non-cash part of the prize is Unity 4.3. :wink:

The details are here if any other NZers are interested: http://www.gameplanet.co.nz/news/g53f3f32d73e71/KiwiGameStarter-is-an-NZ-game-creation-comp-with-a-25k-prize/

I managed to figure out ShadowPlay, so here’s a video. Bump it up to 1080p to actually see the detail.

Really Nice work, Post pro shaders can be awesome tools. Your download link for the shader is removed, Can you update it with your current version? would love to pull it apart to try to build a water colour shader effect. Great work!

I’ll post it again once I’ve tidied it up and improved it a bit, it’s kind of unfathomable at the moment.

Download: MEGA

The node graph should be much clearer about what its doing now. Please post screenshots of what you come up with in this thread! You can’t post too many screenshots!

Debug your shader here. You can enable/disable the shader entirely, or force it to only draw lines. This in itself is a neat effect.

Cel Detail Shading
This manages the lines drawn when detail in the scene and in textures are outlined. These lines default to light. Cel detail always shades near to the camera and you can control the falloff as distance increases.

Cel Outline Shading
These are the lines drawn around objects based on differences in screen-space depth. These lines default to heavy and can have a mask texture applied to roughen the edges. Cel outlines have a band in the scene depth that can be targeted for shading. Offset is the distance from the camera. Ramp is the linear fade-in and fade-out distance.

Distance overbright
This controls a blend_overlay fog that is useful for colour-grading the scene. In the screenshot above it’s used to give distant objects a warm desert-feeling glow.

Shadow Shading
This controls the cross-hatching on your scene. The cross-hatching will target areas with AO shadows. You can also posterize your AO to give it a more cartoony feel. The values in this section have a quite narrow window where they look good, I’d recommend only adjusting them by a tiny bit at a time.

Final tip
If you’re getting too many lines drawn, try either lowering the resolution of your textures or go into photoshop and apply a smart blur. The cel shader will pick up even tiny amounts of detail with the right settings, so go nuts and blur it a lot. If you’re after a kind of water-colour fill effect, then smart blur is the way to go.

Here’s a video showing off the line art mode (it’s in the last half of the video):

Hello Antidamage,

First off, great looking shader! and thank you for your generosity in sharing it with us. I’m really liking the outcomes in your videos.

I wanted to start playing around with it, learning from your method. There’s a problem though, whenever bringing new .uasset that contains shaders into Ue4 all the material functions and textures are lost in the node graph.

example screenshot:


I thought I could figure out what material function went where but I’m having serious trouble with that as your shader is very complex.

I was wondering if it’s possible whenever you have some time to post screenshots of the material function positions in the graph please. If not, no problem, I’ll keep trying out through trial and error.

Thanks again for sharing this great shader.


Can you post a screenshot of the problem you’re experiencing? Is it a node graph issue or a configuration issue (eg. the material instance)? Do you mean the custom functions like edge detection, shading, averaging and posterization are being lose in the larger CelShader asset? Because that’d be pretty crippling.

Just in case, make sure you’re applying CelShaderDesert as a Misc asset inside an unbound PostProcessing effect.

I haven’t encountered that yet, but I always migrate from my celshader project to another project. Perhaps it’d be better if I released a sample project with the shaders in it rather than the shaders alone.

Screenshot added in post above. No issues with the material itself, only with Ue4 remebering what material function node is placed where. This only happens when importing .uasset shaders directly without migrating from a project as far as I’ve been seeing.