Hi!
I've been messing around with ShaderLab and ShaderGraph, trying to make a 2D Cell/Toon Shader, that replicate the one in [Laigter][1]. (awesome software btw)
### Where I'm at: ###
Currently I have a working hlsl shader, that with a few alterations using the unity template, I was able to render the effect with some wild, but good results. ![alt text][2]
The code below is a snippet of what I am doing in the fragment shader responsible for the normal map:
![alt text][3]
### Objective: ###
Now I was hoping to be able to do the same effect in shader graph, mostly for iteration reasons.
Shortly, I am looking for [this][4] using 2D lights (and without fresnel). aka [this][5]
For what I understand the custom node in the [link][6] above (see below) doesn't work for 2D lights, I was wondering if there's is a replacement function for `GetMainLight(0)` or something.
#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED
void CalculateMainLight_float(float3 WorldPos, out float3 Direction, out float3 Color)
{
#if defined(SHADERGRAPH_PREVIEW)
Direction = float3(0.5, 0.5, 0);
Color = 1;
#else
Light mainLight = GetMainLight(0);
Direction = -mainLight.direction;
Color = mainLight.color;
#endif
}
#endif
I will also leave some links that were useful during my research:
- https://godotshaders.com/shader/cel-toon-shading-for-2d-sprites/
- https://www.youtube.com/watch?v=gY1Mx4kkZPU&t=300s
- http://indreams-studios.com/post/writing-a-spritelamp-shader-in-unity/
Thanks! :D
[1]: https://azagaya.itch.io/laigter
[2]: /storage/temp/187882-question-01.png
[3]: /storage/temp/187883-question-02.png
[4]: https://www.youtube.com/watch?v=lUmRJRrZfGc&t=110s
[5]: https://www.youtube.com/watch?v=Uic6JKppf-o
[6]: https://www.youtube.com/watch?v=lUmRJRrZfGc&t=110s
↧