simply use the z coordinete to define your depth, then the depthbuffer of the renderer will do the job for you…