How to convert depthmap from depth renderer to a static texture?

Welcome aboard!

In WebGL, Texture.readPixels always return RGBA data. So, you should either use CreateRGBATexture instead of CreateRTexture of create a new buffer from depth_arr that will only contain the r component.

You can call doit() in the console of the browser to create the texture and see it in the inspector.

1 Like