Store in a vector/normal variable:
Let's suppose you've got a Normal texture:
normal NormalMap = 0, //the input (normal map vector starting "empty")
output closure color Bumped =0 //the output (closure, AKA the final shader)
N = normal(NormalMap, NormalMap, NormalMap); // store X, Y, Z component from NormalMap
Bumped = diffuse_toon(N, 0.5, 0); //define closure
The code above creates a closure output named "Bumped" which is based on a "diffuse_toon" shader, whose normal information are stored in the variable "N" that we declared.
"Normal" is a vector-like variable (x, y, z).
To access the respective "i" component of the NormalMap use the syntax NormlaMap[i], as it's stored as an array.
- X = NormalMap
- Y = NormalMap
- Z = NormalMap
That said, you can shorten the code by avoiding the use of the variable N, just use your own like in this example.
output closure color Bumped = 0
Here's a comparison between the result of the OSL shader and the one coming from Cycles nodes.