- Home /
Cel Shading Possible In Unity Free Version?
Hey all, I'm new to writing shaders (and Unity in general), and I'm looking to build a cartoonish shader for a game I'm starting. And while there's a wealth of information on how to create shaders with ramp-based lighting (a la Team Fortress 2), I have not yet found a good method for handling the outlines. One method I tried involved modifying the Diffuse/Outline shader on the Unity wiki, but the result is very aliased and not quite what I'm looking for. I also found out that Unity has an edge detection script, but unfortunately post processing is only available in Unity Pro and as a college student I can't really drop 1500 bucks on a whim. I'd also prefer to have the effect be shader controlled vs camera controlled anyway.
Ideally I'd like something similar to the effect outlined here: http://willychyr.com/tag/edge-detection/ (which takes inspiration from here: http://www.thomaseichhorn.de/npr-sketch-shader-vvvv/).
Is this possible in Unity Free? And more importantly, is it possible for a newcomer to Unity who only has 2 years of programming in general?
Answer by Jeff-Kesselman · Jun 22, 2014 at 12:42 AM
First off, are you aware that, as a student, you can get a year license to the academic Unity Pro for $150? You cant ship a commercial game with it but you can use it for learning and for creating portfolio pieces. You can get it at www.studica.com
It used to be the case that you needed Unity Pro to do custom shaders, but Im not sure thats true anymore. Read through here and see if the features are available in Unity Free http://docs.unity3d.com/Manual/Shaders.html
(Id check but I have pro on my machine and no way to check to see what isnt in free.)
If you ever needed Pro to write custom shaders then it must have been a long time ago! Certainly you've been able to write shaders in Unity Free from v3.5 onwards - you just can't write (nor use) full screen image effects.
Not just full screen, but anything that requires backbuffer access, which you don't get in free.
For example if you had some kind of transparency shader that modified what you saw behind the object, this would require pro.
Answer by tanoshimi · Jun 22, 2014 at 07:55 AM
The problem, as you've already found, is that it's difficult to define what constitutes an "edge" in the scene purely at the shader level - it generally requires some form of pixel-level image analysis either of the Depth Buffer or the rendered image, for which you need a RenderTexture which is a Pro-only feature.
There are some alternative approaches, one common technique is the "expanded back faces" which I think the outlined diffuse shader uses, and is improved somewhat at http://unitygems.com/noobs-guide-shaders-6-toon-shader/
Alternatively, if you're targeting DX11, you might be able to make use of a geometry shader, as at http://prideout.net/blog/?p=54
Yeah, the more I look into this, the more I realize that Pro is kind of necessary for the effect I want. I've tried the expanded back faces method and wasn't happy with how it looked. I'm also not thrilled with the standard edge detection scripts that come with Unity.
But how exactly do I do about porting the Silhouette Extraction code into something Unity can use? Would it be a script that goes on my camera?
Your answer
Follow this Question
Related Questions
Cell Shading Using 2D Renderer? 0 Answers
Cel/Toon shading with multiple light sources on mobile 2 Answers
Weird lighting with cel shader 1 Answer
Single tone shadows in forward rendering 0 Answers