Help - Search - Members - Calendar
Full Version: Extracting 8-bit DepthMaps from EXR renders
Hash, Inc. Forums > Technical Direction and Development (Learning Animation:Master) > A:M Rendering, Compositing and Special Effects > Texturing, Lighting and Effects
robcat2075
This is one of those things that if you don't know what it is, you probably dont' need it.

But for those who have wanted to use EXR renders' ability to create depth maps without you needing to set the scene up with Fog or some other extra step AND who want to be able to get a depth map that that isn't in that EXR floating point format, perhaps to use in an app that isn't EXR aware... here's a way:


First, EXR depthmaps tend to look all-white blank because they record a distance from the camera to the object in each pixel rather than the visual appearance of "fog" or a gradient shader you've put on a scene. That distance is almost always greater than 1.0 (cm I presume) which ceilings out at white when displayed. If your display could do greater than 1.0 you'd be looking at something like the brightness of the sun.

In this PRJ I've imported an EXR render I made previously with Depthmap buffer ON. The ground and character appear all white in the Depth channel. I also imported an EXR render of a flat very dark Gray rotoscope.

RMB>New Composite on the Images folder. Double click on the Composite to display it

Drag the depth channel of the character render into the new composite. The depth channel will appear under the "Post Effects" folder of the composite.

RMB on that channel>Insert Post Effect>Hash Inc>Multiply

Under Multiply there will appear the Depth channel and a "Place Holder" (Multiiply needs two images. It multiplies the RGB values in one image with the RGB values in the second. Internally A:M regards white as 1.0 rather than 256. Dark gray would be a value like 0.1)

Drag the "Color Alpha" channel of the dark gray EXR onto that place holder. Set Multiply's percentage to a low value such as 1 so that some detail is visible in the render. This has scaled most of the image down so that it is no longer brighter than white.

RMB on Multiply>Insert Post Effect>Hash Inc>Exposure

Click and drag on the "Contrast" value to expand/narrow the gray zone between pure white and pure black.

Click and drag on "Brightness" to move the zone forward/back.

Click to view attachment

You can convert your result to a targa or other format by doing an RMB>Save as Animation on the Composite.




When you load this PRJ, all the values will be set to their defaults. There is currently a bug in A:M Composite that prevents set values from being saved. Write 'em down or screen capture them for later reference!

Click to view attachment

Depth maps have uses in compositing. Suppose you had bluescreen footage of a live bird you wanted to insert in a cage you made in A:M. You could composite that bird onto a render of the cage, then on top of that composite another render of the cage that used a depth map as an alpha channel to hide the back half of the cage. This would save you from having to model and render the cage as front and back halves.

Depth maps are also used in in fake DepthOfField Effects (app with DOF blur filter needed). A "rack focus" is created by animating the size and distance of the gray zone.


You perhaps could create simple "middle in focus" effects in A:M by compositing three layers of your scene. One using the Depthmap to hide all but the near ground objects and with blur applied. Behind that you'd put a version that uses depth ot hide all but the middle ground with no blur and behind that a version that uses depth to hide all but the background with blur applied.

Doing DOF in post like that gives you flexibility and dramatically shorter render times.
dblhelix
thank you!
robcat2075
QUOTE
When you load this PRJ, all the values will be set to their defaults. There is currently a bug in A:M Composite that prevents set values from being saved. Write 'em down or screen capture them for later reference!


I just tried re-opening that PRJ I posted... and the correct values were there! So sometimes it works.

Moving right along...

Another use of these depth maps is for creating stereoscopic 3D effects in post. A paint app like Photoshop or Gimp has a filter called "Displacement" which will shift the pixels of one image based on the brightness of the pixels in another image.

So I can take a flat image like this...

Click to view attachment


...and use the depth map that OpenEXR rendered with it....

Click to view attachment

... to displace one copy of the image to the left and displace another copy of the image to the right.

Then I combine them in anaglyph form to get this...

Click to view attachment

It's not perfect 3D, but it's a similar process to how Hollywood converts movies to 3D in post. I suspect they have displacement filter that more intelligently deals with object edges and is better at faking the material behind an o0bject that one eye sees but wasn't in the original image.



robcat2075
In the PRJ I posted above I used multiplying to darken the image because "Exposure" was limited to -8 and couldn't darken the image enough on it's own.

However, I've found you can put one Exposure on top of another with no ill effect. Stacking negative Exposures should be enough for any purpose and eliminates the need for that gray image and the Multiply operation.

Click to view attachment



ernesttx
Robcat, have you tried OpenEXR rendering in v16. I don't seem to have anything in them. I've tried viewing in A:M composite, photoshop and Fusion.

I haven't done it in awhile, so I'm probably missing something if it's working.

Render settings:
OpenEXR format
I turned on Alpha, Depth, Shadow, Surface Normal
I have Multi-pass set at 4

but nothing is coming out.

Any help would be appreciated. Thanks.
robcat2075
I believe you need to use multipass to get buffers. Try that?
ernesttx
I turned on light buffers, added another light and set to Each light on its own. All the channels import into Fusion ok. But, now I have to figure out how to use all the different channels. hehe
Thanks again.
jakerupert
Fantastic thread,

Thanks for the Info Robcat!
dblhelix
oh alright. in advanced stages of planning i'm now beginning to implement words to visuals.
fair warning: by the time i'm done with questions, you will wish you'd have made an a-b-c tutorial to begin with...

first, it's a landscape i'm doing, and it's snowing.
layer 1 is snow (snowing= snow in the air) and softly shaped white earth.
2nd layer is a 2D animation of a cape Eugene is wearing
3rd layer is Eugene climbing up a hill
4th layer is snow behind him (snowing, that is, snow in the air)
5th layer is landscape of massive forms but not far away (separate for perspective trickery, the whole scene is about cheating viewer about perspective then revealing the truth)

is the snow enough for 3D reference? do i need this depth map procedure?
what is the very dark grey layer for?
do i need to do a tutorial/s maybe, for basics?
robcat2075
QUOTE(dblhelix @ May 3 2011, 11:18 AM) *
is the snow enough for 3D reference? do i need this depth map procedure?
what is the very dark grey layer for?
do i need to do a tutorial/s maybe, for basics?


I'm not sure I understand the questions.
HomeSlice
dblhelix, depending on what you want to accomplish, you may not even need to worry about depth maps. What are you trying to do which needs a depth map?
dblhelix
QUOTE(HomeSlice @ May 3 2011, 09:45 AM) *
dblhelix, depending on what you want to accomplish, you may not even need to worry about depth maps. What are you trying to do which needs a depth map?

exactly my point! i'll definitely need it time and again with this project, just not sure if i need it yet.
(i've landscapes spanning a quarter of a planet; group scenes where i need to pull apart/ flatten/ blur out-of-focus - not familiar with 3D cameras either so that could be an answer there)
it's like i'm constantly coming from an alien world; not trying to master a techinque but trying to get a point across with an alien technique smile.gif offering 50 different ways but i've no time to learn everything.
to the point:
in this scene the opening shows ~20m of snow landscape and you're supposed to think it's miles and miles.
when camera moves you'll eventually be looking at a landscape of barely 100m.
the snowing helps a lot - i think? smaller flakes first then bigger.
when does depth become so deep it benefits from a depth map?
or, why isn't everyone using this method all the time?
dblhelix
cross-referencing again, here's more on the subject, on the grey slate as well:
http://www.hash.com/forums/index.php?showt...hl=closing+tube
(looking for solution to something else, so just pasting that)
robcat2075
Are wanting a distant fog effect and/or depth-of-field effect?
dblhelix
funny day, i'm looking to close a tube (i think) and all i get are compositing threads smile.gif
http://www.hash.com/forums/index.php?showtopic=31562
i'm not trolling, trying to collect materials in one place. interaction.
robcat2075
I'm still foggy, but keep us posted.
dblhelix
QUOTE(robcat2075 @ May 3 2011, 04:44 PM) *
I'm still foggy, but keep us posted.

lol, and i'm DOFfy.
with the quickest glance there were answers to my questions in the links,
the second had a tutorial. i should dig in there, then come back.
it's depth of field, vastness i'll be going for a lot this year.
AO world with no sunlight, preferably no fog.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.