Greetings everyone.
I'm working with JME for the first time and for an effect I am trying to create I need to grab the depth buffer. However after looking through the API and some of the passes in com.jmex.effects.glsl for a while I have not been able to find anything to accomplish this.
I'm figuring at this point I'll need to work with LWJGL to grab the depth buffer and turn it into a texture. Any tips on that would be appreciated if that is the route I need to go.
The DepthOfFieldRenderPass renders the depth buffer to a texture using a shader (i believe, at first glance). Also, look into the Debugger class as it’s used in DebugGameState.
The DepthOfFieldRenderPass does use a shader to render the depth because it needs to alter them. Useful for that pass but otherwise a waste rendering everything an additional time.
The Debugger does have a method (drawBuffer) that set us in the right direction.
A texture's rttSource field need to be set to the depth buffer, like so:
depthTexture.setRenderToTextureType(Texture.RenderToTextureType.Depth);