reproducing blender internal toon material settings as a GLSL shader

I am not 100% comfortable with GLSL, but want to create to replicate my toon material as close as possible in glsl for use in a game engine, not asking for direct code as much as an idea of how to put it together, have wrote ok shaders from guidance before this, I particularly interested in emulating the “specular” part since it is the key to the material’s look…have tried texture ramps in game as recommended but I cant seem to hit the mark with that

material on character disregard the rim lighting have that figured already

Check the gpu.export_shader() function from the python api.

It returns a dictionary object with ‘fragment’, ‘vertex’, ‘uniforms’ and ‘attributes’ used by blender to render the material in opengl, and can be a starting point for using the material in other engines.

not familiar with python, though I should learn it, but I have been exposed to that function via game_export_GLSL_Shader which produces several thousand lines of seriously nondescript code in the frag shader no matter what options I choose, however I didn’t fully realize what was getting at first…but figured it out after a loong while, any way found the toon spec code however and strangely though I couldn’t seem to find a description for Lambert diffuse even though the others are listed…does the the glsl output a different name for that? being that the other types are clearly indentifiable. anyway while typing this I checked all the diffuse options and all worked with the effect except for toon(produced nasty artifacts) but setting “smooth” to 1 corrected that, so I learn somthing there.

Anyways get the specular code so I’m good