Issue with depth texture rendering in Babylon Native?

I am experiencing a potential issue with depth texture rendering in Babylon Native. The following Android screenshot shows the depth texture applied to a plane in the scene behind the depth tested objects. In Babylon.js the depth texture is rendered correctly as red with greyscale depth. Here you can see it’s strange, unexpected …

cc @bghgary and @Cedric (Please be patient as they are on vacations)

1 Like

@inteja Can you provide your PG so I’m sure to be looking at the same thing as you?

1 Like

Hi @Cedric I’ve been trying to create a simple working playground using the latest Babylon React Native playground but I’ve been unable to get it to build and run. I have been able to in the past, so possibly something has changed. Attached are the console and metro logs.

logs.zip (3.6 KB)

@Cedric Until I can get a Babylon React Native example going, here’s a Babylon.js Playground that displays depth map. It’s this sort of code that is producing an incorrect depth map for me in Babylon React Native.

I’ve found the issue.
Depending on engine caps, depth is using floats (what you get in the browser) or float packed into rgba (what you see in BabylonNative).
Actually, rendering float is possible but I need to do a change in babylon.js. This will happen later this week. And then, update BabylonNative.

Until this happens, there is a workaround: After engine is created, add this line:

engine._caps.textureFloatRender = true;
3 Likes

Awesome thanks @Cedric ! I’ll try the temporary workaround and await your updates to Babylon.js & Babylon Native. I really appreciate you looking into this!

2 Likes

I tried engine._caps.textureFloatRender = true; and that did the trick, thanks!

2 Likes