Results 1 to 12 of 12

Thread: Depth Buffer woes

  1. #1

    Depth Buffer woes

    I'm trying to use the Compositing Buffer Export to export a depth buffer pass, and I'm having some problems. Not sure if it's an incorrect setting, a bug, or if I just don't know what I'm doing.

    I rendered a scene with a depth buffer pass saved as a PNG, with Depth Buffer normalized to 8-bit, and got the image I expected:

    Click image for larger version. 

Name:	bldg_depth_pass.png 
Views:	383 
Size:	164.8 KB 
ID:	128072

    But, when I animated the scene, I got minor depth buffer artifacts (some frames lighter/darker than previous and next frames, resulting in flicker). I thought this was due to the 8 bit normalization, so I unchecked that and saved the depth buffer as an EXR (LW_OpenEXR_RGBFP). The EXR files, however, came out completely white (sample attached as ZIP). bldg_clip_Depth0008.zip

    I've tried various combinations of options, file formats, I've even tried reading the manual. I don't know if it's something I've done wrong or what. Can anyone point me in the right direction?

  2. #2
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,884
    If you won't find solution, you can always try what I showed in this tutorial around 3 min:
    https://www.youtube.com/watch?v=i5Ti9kZRGI8

  3. #3
    Well, this is looking more and more like a bug - no matter what settings I choose, I can only get a Depth pass if I choose the "Normalize Depth To 8-bit" option.

    Has anybody ever gotten a Depth pass out of the Compositing Buffer Export without using the "Normalize Depth to 8-bit" option? Anyone? Just checking before I report this as a bug...

  4. #4
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,884
    What is size of your scene?

    If it's very big not normalized Z depth could be even in hundred or thousands+ values.
    And vice versa with very small/very close camera to object (small values of Z-depth).

  5. #5
    Quote Originally Posted by egearbox View Post
    ....I thought this was due to the 8 bit normalization, so I unchecked that and saved the depth buffer as an EXR (LW_OpenEXR_RGBFP). The EXR files, however, came out completely white (sample attached as ZIP). bldg_clip_Depth0008.zip

    I've tried various combinations of options, file formats, I've even tried reading the manual. I don't know if it's something I've done wrong or what. Can anyone point me in the right direction?
    Hi,
    your EXR file isnīt completely white!
    It seems to be ok, all your skyscraper are there. You just have to use it the right way in your compositing program.

    ciao
    Thomas
    Web: www.dieleinwandhelden.com

    I use two pieces of the three-piece application with mocap module.

  6. #6
    I've always been here Mr_Q's Avatar
    Join Date
    Mar 2003
    Location
    Burbank
    Posts
    340

    Understanding Depth Buffers in Lightwave

    There are common misunderstandings of how depth buffers work, real ones.

    This is how you use it. I use After Effects as an example as this is what I use. Other packages will have similar options.

    You save out a 32bit Float image (EXR). You do not use any of the 8bit or normalize options. Ideally you should use DB&Ws Exr Trader. It offers much more control over buffers and is cheap. You then load that in to your comp package. In After Effects you use "EXtractor" under EFFECTS-3D Channel to then adjust the depth buffer to your need. The image will look white, but once you start playing with the black and white points, you can begin to reveal what you expect. You can then tweak to taste. (animate, etc)

    You can also "lock down" the depth buffer out of LW if you want so that when you load the image in to your comp package it will look "done." However I advise against this as it then means you have a "baked" depth pass with out much tweaking room. The lock-down number you use in LW does correlate with the white and black point numbers in After Effects somewhat. So if you clamp you depth buffer at "15" for MAX, in AE, I believe it's a white point value of .15. I could be wrong, been a while, but that's the idea. You can always just slide the numbers around in AE until you see something.

    Things to be aware of.
    Depth Buffer does have an anti-aliasing option (AA), but it's not perfect. You will still find jaggie edges where objects have nothing behind them in Z-space. (you could add a giant sphere* to your scene to limit this side-effect) However the nature of the 32b buffer means the AA will never be able to "see" all the pixels correctly. Ultimately this means you will have jaggies. Which, when comped, will result in dirty looking edges for fog and depth. You can apply some blur filters and other tricks, but it's problematic. Also transparency and real motion blur will cause grief.

    In the end, the BEST solution is to render a separate scene using the old "fog" trick. While it is true that is also a baked depth-pass, it does allow you to render exactly what you want. With full support for AA, and even depth-of-field/motion blur if you chose to do those in camera. It will all work nicely with your other passes. Clean edges, clean output.

    *The sphere is effectively a Z-Depth clamp. It stops the rays. EXR Trader has a tool that also does this as a Pixel Filter. Thus eliminating the need for a sphere mesh. This will improve AA, but as I cautioned, does limit what you can do with the Z-Depth pass.
    Last edited by Mr_Q; 05-04-2015 at 11:23 AM.
    Kevin "Q" Quattro
    Inhance Digital
    3D Art Director



  7. #7
    Quote Originally Posted by Mr_Q View Post
    There are common misunderstandings of how depth buffers work, real ones.

    This is how you use it. I use After Effects as an example as this is what I use. Other packages will have similar options.

    You save out a 32bit Float image (EXR). You do not use any of the 8bit or normalize options. Ideally you should use DB&Ws Exr Trader. It offers much more control over buffers and is cheap. You then load that in to your comp package. In After Effects you use "EXtractor" under EFFECTS-3D Channel to then adjust the depth buffer to your need. The image will look white, but once you start playing with the black and white points, you can begin to reveal what you expect. You can then tweak to taste. (animate, etc)

    You can also "lock down" the depth buffer out of LW if you want so that when you load the image in to your comp package it will look "done." However I advise against this as it then means you have a "baked" depth pass with out much tweaking room. The lock-down number you use in LW does correlate with the white and black point numbers in After Effects somewhat. So if you clamp you depth buffer at "15" for MAX, in AE, I believe it's a white point value of .15. I could be wrong, been a while, but that's the idea. You can always just slide the numbers around in AE until you see something.

    Things to be aware of.
    Depth Buffer does have an anti-aliasing option (AA), but it's not perfect. You will still find jaggie edges where objects have nothing behind them in Z-space. (you could add a giant sphere* to your scene to limit this side-effect) However the nature of the 32b buffer means the AA will never be able to "see" all the pixels correctly. Ultimately this means you will have jaggies. Which, when comped, will result in dirty looking edges for fog and depth. You can apply some blur filters and other tricks, but it's problematic. Also transparency and real motion blur will cause grief.

    In the end, the BEST solution is to render a separate scene using the old "fog" trick. While it is true that is also a baked depth-pass, it does allow you to render exactly what you want. With full support for AA, and even depth-of-field/motion blur if you chose to do those in camera. It will all work nicely with your other passes. Clean edges, clean output.

    *The sphere is effectively a Z-Depth clamp. It stops the rays. EXR Trader has a tool that also does this as a Pixel Filter. Thus eliminating the need for a sphere mesh. This will improve AA, but as I cautioned, does limit what you can do with the Z-Depth pass.

    Thanks for all the awesome information! Do you recommend EXR over the TIFF 32 bpc format, and why? I'm not familiar at all with EXR and it seems pretty complicated, plus there are about six EXR options on the file format list. I tried a couple of them and wasn't sure if I was getting good results or not.

    Where did you come by all this information - this is new territory for me (32bpc, multipass rendering) so if you can point me to a good book or something that would be great. I'm really trying to cut down the amount of manual labor that's going into this (since I'm a one-man shop - hobbyist, really) so I'd like to stick with the CBE plugin rather than setting up separate scenes, but it's good to know about the limitations.

  8. #8
    I've always been here Mr_Q's Avatar
    Join Date
    Mar 2003
    Location
    Burbank
    Posts
    340
    Thank you, glad to help. All of this knowledge was acquired through years of doing this for a living.

    EXR is the way to go. Most broadly compatible and has the layering options. EXR Trader is a great way to understand all of this as his documentation clearly explains everything. So you can see why and how you would use it.

    At it's simplest, all you need bother with is RGBAHALF or RGBAFP from within LW for the savers. "Half" is 16bit essentially and suitable for most things. Rarely will you need the full 32 and those files can be quite large. The other two RGBHALF and RGBFP simply do not have an alpha channel. That's what the "A" is represents. The other EXR savers are simply...other EXR savers.

    As for CBE, it will allow you to do most of what you will need. There are some issues or bugs with it currently that might make certain things frustrating. Also, it's material and object ID buffers are not compatible with After Effects. Only EXR Trader can be setup to do those correctly. In general, EXR Trader offers a lot more flexibility too. It's rather ideal for a one-man shop or small group as it can greatly stream-line the breakout process. It's preset system is quite handy.
    Last edited by Mr_Q; 05-06-2015 at 02:14 PM.
    Kevin "Q" Quattro
    Inhance Digital
    3D Art Director



  9. #9
    Thanks! Sounds like EXR Trader's the way to go. I'll check it out!

  10. #10
    Registered User
    Join Date
    Nov 2005
    Location
    malaysia
    Posts
    281
    Just to chime in. Depth buffer has not been very predictable for me. I find it easier to use the old fog trick rather than wasting time trying to solve those problems ...

  11. #11
    Quote Originally Posted by sukardi View Post
    Just to chime in. Depth buffer has not been very predictable for me. I find it easier to use the old fog trick rather than wasting time trying to solve those problems ...
    Ugh, that's dispiriting.... here I thought CBE was going to be this magic bullet for me and it's been ... well, rather mixed. Although I'm definitely learning a lot as I work through these issues!

  12. #12
    I've always been here Mr_Q's Avatar
    Join Date
    Mar 2003
    Location
    Burbank
    Posts
    340
    Know that this is the same in any package. Depth Buffers, as with many buffers, are quite problematic. It's the cost of flexibility. Once you start breaking things out, getting back to beauty can be a chore. Especially when special FX buffers are needed. Like IDs, DEPTH, UVs, etc.

    This is why "Deep Compositing" was such a big deal. It gives you such a better set to work with.

    So to clarify, EXR Trader will not give a "better" depth buffer than CBE. It will give you more options, and flexibility, as well as a more robust break out system. Depth buffers very nature is why the old Fog Trick is such a wonderful hack. For nearly all old-school Lightwave guys, we were doing the FOG PASS depth long before we had ever heard of a Depth Buffer.
    Kevin "Q" Quattro
    Inhance Digital
    3D Art Director



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •