George_Toledo's picture
+0

That's basically it...

Is there a way to do this that I am overlooking, or if not, is there a possibly an existing patch that could be modified to write to the depth buffer?

I would like to make something in the fragment shader that depth tests against objects created with regular VUO node shapes and imported models.

edit: In QC, one could do this by writing to gl_FragDepth. I just remembered about the parabox node...I'll try and see if it works there.

1 Answer

jstrecker's picture
+0

Fragment shader writing to the depth buffer — Yes, looks like gl_FragDepth works in Vuo. We did a small test by hacking the Shade with Wireframe code to write to the depth buffer, and that worked.

Fragment shader reading from depth buffer — Because of how OpenGL works, you'd have to do this in two passes. First, use Render Scene to Image to get both the regular image and the depth image. Then feed both images into the fragment shader, either via a custom node or the built-in Make Image with Shadertoy.