Question about Toon Shader order of operations

Hello I’m trying to do a Toon Shader with edge detection.

But i don’t know exactly the correct order of operations in order to get a good result.


1 - Render the mesh to a Framebuffer Object, then now I have the depth buffer in a texture.

2 - Render to the default Framebuffer the mesh again, linearize the depth buffer texture, use Sobel filter to get the edges from the depth buffer texture and apply lighting calculations.

Is this correct ?

Thank you :slight_smile: