How to write a custom lighting shader in Godot 3.0?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By madicecream
:warning: Old Version Published before Godot 3 was released.

I have the same question. I’m writing a custom toon shader and I have been using the “unshaded” render_mode and doing all the work in the fragment function and sending it all out out as ALBEDO. I’ve hit a wall though and cannot get the veiw direction/ eye vector. No camera location available in the vertex function built ins either. I noticed there was a VIEW available in the light function but I have no clue how to use it.

I have put the light function at the end of test shaders and set values to “DIFFUSE_LIGHT” and “SPECILAR_LIGHT” but they do not effect the shader at all. is there some sort of render_mode flag that needs to be set first?

sentimetalboy | 2017-12-03 06:36

@sentimetalboy where are the possible render_modevalues explained?

snwflk | 2017-12-29 08:01

@snwflk The possible render modes are listed here:

http://docs.godotengine.org/en/latest/learning/features/shading/shading_language.html#shader-types-in-depth

They are used like this at the top of the shader:

shader_type spatial;
render_mode unshaded, cull_disabled;

sentimetalboy | 2017-12-29 17:27