How to get depthTexture correctly?

I want to use it in my shader but I want to ensure it is correctly produced by visualizing it

Certainly what you want to do is possible. I don’t have time to find the JME example that renders depth textures in the HUD for you but they exist.

In the mean time, it seems like it would be a million times easier just to debug the values in your shader. Render the depth instead of rendering your normal color “just to see”, etc… It’s also more reliable because it’s “ground truth” where as a secondary render is very likely to be one frame behind depending on how you hook it up.

1 Like

Ok
Thank you
I’ll try to use it in a Shader to see if it works
In meantime, if you could find a clue remember me

It works now.
It was a very stupid mistake, but I learnt a lot of things in the way.

1 Like

Can you please tell us what was the issue? it may help other folks too.

1 Like

It was in this code
reflectionCam.setFrustumPerspective(getCamera().getFov(), 1, 1.0f, 1000);

I was setting it as
reflectionCam.setFrustumPerspective(getCamera().getFov(), 1, 0.001f, 1000);

Near and Far Frustum is important in depth calculation

2 Likes