-
I know there is a function to download a rendered image from GPU Image GetTextureData(Texture2D texture); But is there a way to download depth from GPU? I am going to use it for image processing (not related to OpenGL). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@copark86 I'm afraid this is out-of-scope for raylib, it's a specific use-case. Still, it can be accomplished rendering the depth buffer using a shader and getting it. Here there is an issue explaining the process: #1872 A brief summary:
There is probably a simpler way to do that but not exposed by raylib, you should use OpenGL directly and call yourself |
Beta Was this translation helpful? Give feedback.
-
I did a toon shader using the same technique using normals instead of depth, but the process is identical save for an simple tweak in the shader, take a look at bedroomcoders.co.uk |
Beta Was this translation helpful? Give feedback.
@copark86 I'm afraid this is out-of-scope for raylib, it's a specific use-case. Still, it can be accomplished rendering the depth buffer using a shader and getting it. Here there is an issue explaining the process: #1872
A brief summary:
RenderTexture
with a depthTexture
instead ofRenderBuffer
(you need to changeLoadRenderTexture()
function or userlgl
directly for that)RenderTexture.depth
using a Shader to linearize the depth values of that texture.LoadImageFromScreen()
should return the drawn depth texture linearized currently on the screen framebufferThere is probably a simpler way to do that but not exposed by raylib, you should use OpenGL direct…