In my shadergraph, i am using a custom function that is compltely running fine on the previews of my nodes (as you can see on the image), but, the preview and result on a material makes it bug (you can also see it on the image)
Though I don’t understand what is wrong…
Here is my custom function:
#if defined(SHADERGRAPH_PREVIEW)
Direction = half3(0.5, 0.5, 0);
Color = 1;
#else
Light light = GetMainLight();
Direction = light.direction;
Color = light.color;
#endif
The errors thrown are the following :
Shader error in 'Shader Graphs/ToonShader': 'MainLight_float': output parameter 'Direction' not completely initialized at line 312 (on d3d11)
Shader error in 'Master': 'MainLight_float': output parameter 'Direction' not completely initialized at line 344 (on d3d11)
NB : This is supposed to be a Toon Shader, I use this function by doing a Dot Product with the Direction outputed, and with the Normal Vector (In World space).


From what I've seen, it is probably because the "GetMainLight" function is only there on URP, and I am using the built-in renderer pipeline
– Artik2442In case this is your final observation/resolution it would be great if you could post it as not a comment but a regular post and mark it as a solution.
– andrew-lukasikSadly, it is not a solution yet... The error subsided even after switching to URP...
– Artik2442