Modified Normals Test
37
   
Award
Favorite
Favorited
Unfavorite
Download
"I've spent the last 3 days trying to work on a shader for S&Box. I'm not much of a programmer so progress has been non-existant and I've been stuck on just trying to get a toon ramp (lightwarp in Source 1) working. I made a Unity shader with most of the features I wanted that mostly worked, though looking back it seems powered by magic and I'm not sure how I got it working even as much as it does. Unfortunately though, unlike Unity, Source 2 has almost no documentation whatsoever, little to no people familiar with it, and the shader feels so much more difficult to work with. Anything that does actually work wasn't even written by me, but by OgniK.

Thankfully though I did learn one thing. The image above uses the standard shaders but in my quest for writing a custom shader, I came across a document recommending something new for faces when it comes to toon shading. It suggested smoothing the normals manually to smooth out the shape and still allowed shading. I haven't messed with specific shapes yet and instead stuck to flattening them seen below:

https://i.imgur.com/j9BD1zn.png
https://i.imgur.com/re6WGq1.png


I pointed them all forward:

https://i.imgur.com/XNkVNhl.png


The normals are used to calculate light so smoothing them results in flatter shading as well. In Source 1, I used a flat lightwarp so the face didn't have harsh shading on it which makes it look awful:

https://i.imgur.com/EmW5a8a.png


Here's a comparison:

https://i.imgur.com/ybQ8cvt.png
https://i.imgur.com/rC6lFgg.png
"