Clarification, May 31st 2017: User Firewill kindly provided an answer for the first version of the problem I stated, but I think I was after a more broadly applicable solution, so I'm re-stating my problem here in the hope that it helps solicit that.
As far as I can tell when using cycles freestyle to draw lines, those lines are placed on top of the rendered scene, so none of the objects in the scene get to interact with them in any way.
So, my question is, could I use compositor to render the plane and its freestyle grid together, then "re-insert" it into the render flow so that it can interact with everything else? Giving us a result like this, but with all the benefits of freestyle:
If it helps, here's the blend file for that scene:
Thanks very much for any help you can offer.
Original question: I have a mesh terrain, and a cube that intersects it to form the surface of a lake.
To correct this I initially tried using the QI Range setting in freestyle to additionally render the lines below the water, however that came with two problems: firstly other unwanted hidden lines in the scene were also rendered (those hidden behind the hills); and secondly the lake bottom lines were drawn on top of the water, and so didn't appear to be "hidden in the depths".
Since I couldn't solve my problem with QI Range my next thought was to render the terrain and freestyle lines as one image, the water as another, and then combine them in the compositor.
However, while I've done some simple experimenting with the compositor, I can't for the life of me think how to achieve the effect I want with it. Does anyone have any advice? Or am I trying to solve this in a silly way?
Here's a blend file where you can more clearly see what I'm working with:
Update, May 30th 2017: I've done some more fiddling and broken out the land, water, and freestyle lines into their own layers. I'm rendering then combining the land and freestyle lines (which works great), and then trying to add in the water afterwards. However that step doesn't really work out as I just end up with a cube of water plonked on top of the land, and the lake floor in that part doesn't include the freestyle lines (I'm not sure how to get them in there).
Here's the file that produced all that:
I'm sure I'm missing a pretty obvious bit of knowledge about how compositing works. Could anyone with more savvy in this area explain what I should do to get all of this combined?
Thanks for any advice you can offer.