Creating a Z-depth pass unrelated to the camera settings?
Posted: 25 March 2013 01:44 PM   [ Ignore ]  
Total Posts:  119
Joined  2012-04-04

Is there any way to generate a greyscale z-depth pass that’s not tied to the DOF settings of the scene camera?  This would be a pass that’s tied to fixed distances in the scene, unrelated to where the camera is.

In my specific example I’m working on an outdoor scene of a desert.  There’s a structure in the foreground with hills and plants stretching into the distance with mountains and sky in the far distance.  I want to add aerial perspective, and the fog effect just isn’t doing it for me.  I can use various compositing tools in After Effects to create the effect I want, but I need a z-depth pass that stretches from the camera out to 5 miles or so.  I could probably set up the camera’s Rear DOF Blur to create a Depth pass, but what if I wanted to have shallow focus on a foreground object AND generate depth for the entire scene to add my atmospheric effect?

Such separate z-depth info must be stored in the scene somewhere because if I render an RPF with z-depth enabled the resulting RPF file contains the data.  I can bring the frame into After Effects and extract that depth channel for post effects.  I can also render a separate multi pass for the camera DOF if I want to isolate a foreground object for faking DOF in AE.

So the RPF works, but at a price.  At 960x540 the 16-bit RPF file is 21 MB, whereas the identical PNG version is only 2.6MB (with the DOF pass being 189KB).

I also notice that when I bring the RPF into AE I’m getting a lot more buffer information than I specified in the Options setting in C4D.  In C4D I only have Z-depth checked for export.  But in the project window in After Effects AE says the file contains data for Z-depth, Object ID, UV-coordinates, Normal Vector, Non Clamped RGB, Z coverage. 

As a test I tried checking every option in the RPF export, and the file is the same size, and shows the same attributes in AE, as the one where I just had Z-depth selected.

RLA files do the same thing and are also big, around 16MB.

This tutorial features another instance where a fixed-depth z-buffer is required.

http://vimeo.com/42859813

The tutorial shows how to add dust hits to a 3D render using Trapcode Particular in After Effects.  At about one minute in the author shows how to set up a z-depth pass in Lightwave (with minimum and maximum distances) which can be used in the Z Buffer field in Particular to matte the visibility of the dust particle effects.  I see no way in Cinema 4D to generate a comparable pass.

Is there a way to do this?  Would this be a feature request?

Thank you.

Shawn Marshall
Marshall Arts Motion Graphics

Profile
 
 
Posted: 25 March 2013 04:43 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
Total Posts:  7312
Joined  2011-03-03

Hi Shawn,

I will try to not repeat   http://www.cineversity.com/forums/viewthread/913/  the discussion here, but perhaps someone who joins this discussion newly might like to.

As your target file sizes are targeting a specific limit, I have no idea, other than to hope for the suggestion to take place. With the last news about ADOBE and MAXON, it might be possible to create something new for those ideas. From an VFX point of view, I think anything OpenEXR is the focus now, especially since ACES comes closer to be a standard.

If I can ignore your file sizes for a moment, Use the Position Pass (You find this in Render Settings>Effects>Position Pass. In order to make that work, Multi-Pass must be enabled and Post-Effects needs to be part of the Multi-pass. To get at all something useful out of this pass, you need to have 32bit/c float enabled, preferable Open EXR. The Position-Pass need to be set to Camera, and set the scale to a very tiny amount. This helps later on in Ae.
If the numbers of the blue channel are much to high, place in Ae a Solid with a near black color (e.g., 0.1 down to 0.01) on top of it and set the blend mode to “Multiply”. This brings the values down. A curve works mostly well of course. Use only the blue channel.  Make this two layer a pre-comp. If needed use a curve to adjust the values. You get an enormous precision now. You might need some trial and error in C4D to get the most fitting values.
All of this, should work and I have tested it, just keep in mind to oversample (double size or even more), if the “Haze” effect is subtle—perhaps blurring the Depth-pass instead works, without oversampling. After all haze or “Sfumato” works inside of moistures air, and that means a lot of light is bounced inside.

This is a value pass, so no AA applied to it and in Ae set this position pass to “Preserve RGB” To get not a gamma “curve” in your landscape ;o)

I would not suggest for RPF nor RLA as I haven’t seen lately any developments with it. Open EXR is certainly the future.

Good Luck

Sassi

P.S. (A black solid with a value of 0.01 is like scaling the size to 100:1 while multiplying the black texture. 32bit)

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004

Photography For C4D Artists: 200 Free Tutorials. Texture, Panorama, HDRI, Camera Projection, etc.
https://www.youtube.com/user/DrSassiLA/playlists

Profile
 
 
Posted: 26 March 2013 06:24 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
Total Posts:  7312
Joined  2011-03-03

P.S. I will discuss this in a NUKE course (With some files I had shown already at Siggraph last year, but perhaps I should think about an Ae course as well. I like Ae since I got r3.1 in 1996. Most of my productions are done with it. It is a great application and especially combined with C4D.

I have attached two OpenEXR files. have a look. As you prefer to work in PNG, think of the Open EXR as step between. Adjust the Depth pass for your needs, and then render it out (Ae) as PNG. As you need it for the background, you might get good compression results after the adjustment.

https://www.amazon.com/clouddrive/share?s=cROWda9YSBEq_xyvnEIAN0

This is the pass after applying a curve to it, by just pulling down the left upper point.

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004

Photography For C4D Artists: 200 Free Tutorials. Texture, Panorama, HDRI, Camera Projection, etc.
https://www.youtube.com/user/DrSassiLA/playlists

Profile