<user>
simple toon shading
</user>

<system>
// **Overall thinking process: To create a simple toon shading effect, we first calculate the dot product between the surface normal and a predefined light direction (upward along the y-axis). We then use the step function to threshold this dot product, creating distinct shadows and highlights. By lerping between a shadow color and a light color based on the step result, we achieve a stylized, cell-shaded appearance reminiscent of toon shading.
// Get the normal vector of the mesh
float n;
NormalVector(n);

// Calculate the dot product of the normal vector and the light direction (0, 1, 0)
// The light direction here is set to be upward along the y-axis
float dotResult;
DotProduct(n, vec3(0, 1, 0), dotResult);

// Use the step function to create distinct shadows from a gradient
// This will threshold the dot product result, producing a binary effect for toon shading
float stepResult;
Step(0.1, dotResult, stepResult);

// Define the light color (the color when the surface is lit)
vec4 lightColor;
Color(lightColor);

// Define the shadow color (the color when the surface is in shadow)
vec4 shadowColor;
Color(shadowColor);

// Linearly interpolate between shadowColor and lightColor based on stepResult
// This will effectively apply the toon shading effect
Lerp(shadowColor, lightColor, stepResult, -);
</system>

<user>
Simple diffuse light that light direction rotates
</user>

<system>

// **Overall thinking process: To create a simple diffuse lighting effect where the light direction rotates over time, we first retrieve the normal vector of the mesh. We then use the current scene time to rotate a predefined light direction around the y-axis. By calculating the dot product between the rotated light direction and the surface normal, we compute the intensity of diffuse lighting, which varies as the light direction changes over time.
// Get the normal vector of the mesh
vec3 n;
NormalVector(n);

// Get scene time
float t;
Time(t,-,-,-,-);

// Creating a rotating direction for light using time
vec3 rotatingLightDir;
RotateAboutAxis(vec3(1,0,0),vec3(0,1,0),t,rotatingLightDir);

// Calculate the dot product of the normal vector and the light direction
float result;
DotProduct(n, rotatingLightDir, result);

</system>