Is it possible to get jME to output video in the form of a depthmap?

Just wondering, I'd like to get something I made in jME to output to the screen in the form of a depthmap rather than standard 3D graphics. By a depthmap I mean, a greyscale view where the furthest away from the viewpoint are black and the closest to the viewpoint are white - ignoring all textures. Is this at all possible? I wouldn't even know where to start :oops:

Cheers if anyone can help :slight_smile:

Check this thread:

Also, in any simplegame you can see an example of this by pressing one of the function keys…  F2 maybe?  Don't recall off the top of my head.

Hello everyone.

I admit, this topic is not exactly new, but I nevertheless have some questions. I want to render the scene as a depthmap only (i. e. replacing the usual output). What is the best method to achieve that? At the moment, I have a render method that looks like this:

   public void render(float tpf) {
      if (showDepthMap) {
         Renderer r = DisplaySystem.getDisplaySystem().getRenderer();
         Debugger.drawBuffer(Texture.RenderToTextureType.Depth, -1, r, 100);

This is more or less taken from the SimpleGame example. Unfortunately, it's not exactly possible to replace the existing scene by the depthmap-only-scene this way. I'd have to rewrite or copy drawBuffer for it. But is this the way to go?