Saving/Rendering Pz (only)

   2373   6   0
User Avatar
Member
22 posts
Joined: Nov. 2017
Offline
I've been experimenting with opengl renderer and I find it good for some cases.

I woudl like to render out the depth pass using opengl renderer for a scene of mine - it's very fast compared to other renderers. However, the rendered Pz channel is only pure white when saved as a png.

When I mouse over the values, the values are huge, not between 01 and 1 therefore not a grayscale float range. I understand what a Pz is – but I'm not sure how I can remap those values to be black and white for a png file.

What's the correct way of doing this?
User Avatar
Member
7755 posts
Joined: Sept. 2011
Offline
Save as exr
User Avatar
Member
22 posts
Joined: Nov. 2017
Offline
EXR is meant to be used witth multi channel render, right?
How can I render using the opengl node with depth map enabled? (not only color, or depth, but both)
Edited by monomind - Jan. 29, 2018 19:48:07
User Avatar
Member
7755 posts
Joined: Sept. 2011
Offline
OpenGL rop can't output both at the same time, but that is a limitation of the node's implementation. The rop is perfectly capable of writing data to exr format, allowing you to work with the depth information as you please. If you need to map the depth to 0-1 range, you will need to write it out in exr or pic format first, and then remap the range in compositing software or with houdini's compositing nodes.

You can use the projective transformation to remap z from linear to 0-1:

float near = 0.01;
float far = 1000.0;
float A,B,f_n;
float depth;
f_n = far-near;
A = -(far+near)/f_n;
B = -far*near/f_n;
depth = (-A*depth + B) / depth - 1;
User Avatar
Member
22 posts
Joined: Nov. 2017
Offline
Thanks!
User Avatar
Member
22 posts
Joined: Nov. 2017
Offline
@jsmack would it be possible for you to give me more information on how I can do this transformation? Would this unit conversion be done before creating the output file?

I want to render tens of thousands of frames, and I need a depth map for them, and I need a very specific configuration for the detph map, do not need the EXR format (8 bit is more than enough for this case)

I can't render the pz to png, any way, I couldn't find the proper setting to make the zdepth visible in png. Saving exr's is ideal, I know, but for this specific case I don't need it as it creates HUGE files compared to png (or any compressed format) and I need a very clamped/specific image for zdepth for my scenerio.

Any ideas are appreciated!
User Avatar
Member
7755 posts
Joined: Sept. 2011
Offline
There's no way to touch framebuffer values before writing to disk when using the opengl rop. By that time the values outside the 0-1 range have already been lost. Saving as exr is the only way to retain the full range of values, allowing manipulation in a post process.

You might want to look into using mantra instead of opengl as that would allow you to modify values before they are written to disk.

You could also look into writing your own glsl shader that does what you need.
  • Quick Links