Thanks for the pointers.
If you want the depth for the entire scene, you'll have to change Cesium's renderer (it will be similar to czm_globeDepthTexture). The initial work we did on shadows may be useful. You'll want to take a similar approach with normals (I would use multiple render targets when available).
For ou purpose (first a "cell shader":https://en.wikipedia.org/wiki/Cel_shading and then ssao maybe) we need the depth and normals of the entire scene, not just the globe.
I was considering adding a loop for a least a second render pass just around the loop over frustrums in Scene.executeCommands and overriding the framebuffer of the draw commands to compute the necessary framebuffer. I would also need to override the appearances for the normal+depth render pass, but I don't see yet how to do that last bit cleanly.
Does that make sense for you ?
I see that the approach you took for shadow casting is different, but in our cases we don't need a second point of view on the scene.
(I would use multiple render targets when available)
That is another approach I was considering. If we could use 3 render targets, then no need to loop, we could use the normal+depth additional textures in the custom post-process as it stands and do what needs be done.
As a first step, for the cell-shading) only our 'special' appearance would need to know about the additional render targets. It would also be less intrusive and faster to implement I guess. All shader would write to gl_FragData without even knowing that there are more RT to render to, until we want all primitives to write their depth an normals there.
Any thought on that ?