Hello, i try to cut a hole into a terrain. I use Stencil Buffer fort tha and it works in that case that i have an invsible cube that renders before the terrain and writes to the stencil buffer. Than for rendering the terrain i check the values of the stencil and only draw where no stencil value is set. The Problem is that the Terrain has Hills and you can see the cut outs through the hill. The solution Idea i tryed was to first draw the Terrain invisble but with writing to the depth Buffer and than for the Cube to do a ZTest and dont write in Stencil Buffer when the ZTest Fails. The Problem is that i can’t get it to work to write the Terrain depth into the depth buffer without drawing the terrain.