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?
Saving/Rendering Pz (only)
2373 6 0- monomind
- Member
- 22 posts
- Joined: Nov. 2017
- Offline
- jsmack
- Member
- 7755 posts
- Joined: Sept. 2011
- Offline
- monomind
- Member
- 22 posts
- Joined: Nov. 2017
- Offline
- jsmack
- 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;
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;
- monomind
- Member
- 22 posts
- Joined: Nov. 2017
- Offline
- monomind
- 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!
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!
- jsmack
- 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.
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