Hey guys! Sorry for going missing, I somehow didn't see the responses.
Firstly I've fixed some pesky typo's in the shaders where I wrote .rbg instead or .rgb grr
Anyways!
@AlaNintendo so first up you should never use mesh normals with rim lighting on spine meshes. Actually you shouldn't really use mesh normals at all on spine animations for lighting in general. The normals will just point outwards from the mesh and make it look like a flat bit of paper (which in essenese is what a sprite is!).
By using a shader normal the shaders will treat it so the normal is constant in camera space meaning the normal is always facing into the camera even when the sprite is not. This might sound weird but it ends up making the lighting look a lot more 3d and realistic for sprites.
For rim lighting however you need a range of normals for it to work (it needs to find the 'rims' of places where the normals change dramatically).
For this on Spine Animations you need to use a normal map. I use this which works pretty nicely: https://www.codeandweb.com/spriteilluminator
For your second image I've found a bug with the way I apply fog, I need to lerp the fog color to clear depending on the pixels alpha, I've now fixed this and it'll be in the latest shaders π
What exactly is going on with ambient occlusion in the last pic? Is this a Screen Space Ambient Occlusion effect? Or something else?
@LoneWarrior I love that art style! Emission would be hella cool and something I'd love to have in my game so is prob next on the list π
I'm curious as to whats going on with the alpha fade, will look into that too.
Self shadowed sprite would be very cool but very hard to implement I think. Decent normal maps can help give that illusion but actual shadows a prob going to be too hard for now.
Shadows for vertext lighting is something I looked into very briefly and think its possible just harder than pixel lit shadows - you can use pixel lighting with hard alphas though, the animation in you gif should work pretty well with that. It's more accurate than vertex lighting and supports full shadows and as long as your sprites got solid edges work fine (to get it to work turn on write to depth and play around with the Depth Alpha Cutoff).
I use pixel lighting in most place although I've got one character thats furry and pixel lighting doesnt work with this as furr needs full alpha blending to look right so for that character I use vertex lighting. Will look into shadows for that too!
16 Sep 2016, 12:31
Ok emission was nice and easy, it's in the latest shaders on the front page π
16 Sep 2016, 16:45
@RtFishers I had a look at the alpha fade bug and think I've fixed it for vertex lighting as best I can , however you'll always get the fade to black problem when using pixel lighting.
Because pixel shading is done over multiple passes it has to use depth testing to stop drawing lit areas over the top of each other.
Because it writes to depth it blocks lighting happening on areas beneath the top most sprite. As this top sprite fades out you start seeing the unlit sprite behind it, unfortunately theres no way around this.
Unity standard shader does not allow for alpha fading in "Cutout" mode for this reason.
Anyhow if you're fading sprite in and out OR using any areas with partial alpha then I recommend using vertex lighting π
@LoneWarrior I had a look into recieving shadows in vertext lighting and alas I don't think it's possible without some crazy hacks like I did to get normal maps working in vertex mode but I don't think theres enough texture coord channels to support both at the same time!
Unity's own docs say vertex lighting does not support shadows here (although it also says it doesnt support normal maps and managed to get that one to work π )
https://docs.unity3d.com/Manual/RenderTech-VertexLit.html
Anyhow casting shadows still works fine in vertext mode, if you really want a character to recieve shadows I recommend authoring it without any faded edges and then using pixel lighting with write to depth enabled π