Don't waste your time, newly rebuilt toon shaders are on their way in v2.0.
If you insist on gathering neigbhor sample info.....I don't think you can do it as that would require an array or other storage structure to store the previous samples. You can try the vector_state and scalar_state nodes as one of them (I forget which) has the ability to return raster space info, but I don't think you can access the neighbor samples.
This is shader SDK territory as you would have to modify the direction of the eye ray, trace it, then store the result from several samples per pixel. You'd also have to sort the data somewhat to make any sense of it. mental ray does not currently support the complex store formats required via the rendertree - you'd have to write code.
Matt
Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com