PDA

View Full Version : Depth matte



Andy Webb
03-15-2010, 03:57 AM
Can anyone tell me how to set up a render for a depth matte?

The manual is not very clear on this.

I was trying to do this yesterday and all I got was a solid black shape on a white ground.

Does it even work or is it broken in LW?

Cheers

Lightwolf
03-15-2010, 05:43 AM
Does it even work or is it broken in LW?
What are you compositing in? And Which version of LW are you using?

By default LW renders the depth as floating point, the value per pixel is the distance to the camera in metres. Which also implies that:
You need to save in a HDR format and use a 32-bit float savvy compositor Anything further away than 1m will show up as white in a normal image


Cheers,
Mike

Andy Webb
03-15-2010, 05:59 AM
Well I'm not using it to composite, I'm trying to use it as a displacement matte.

I was trying to use the PSD Export plugin, the numbers just didn't make sense and it wasn't clear as to whether I should be setting something else?

I managed to achieve something that sort of worked using lighting and photoshop.

I was rather up against it yesterday so I just didn't have the time to ask the question then.

Cheers

Lightwolf
03-15-2010, 06:06 AM
I was trying to use the PSD Export plugin, the numbers just didn't make sense and it wasn't clear as to whether I should be setting something else?
Yeah, use an image file format that preserves HDR pixels, i.e. flx, exr, hdr, float tiff...

Cheers,
Mike

Rasscal
03-16-2010, 09:13 AM
You can use render buffer export or view to get out a just a depth map. You can get all the various channels one can use as well. Diffuse, Spec, Reflection. Shadow...

Hope thats what your looking for.

Andy Webb
03-16-2010, 09:28 AM
Thanks for your help, managed it saving as an HDR file.

I wanted to use it for displacement of a mesh, which worked quite well.

Cheers

biliousfrog
03-16-2010, 10:48 AM
You can also set up a scene with white objects and black fog which is often more controllable (anti-aliased too).

Hieron
03-16-2010, 01:35 PM
Depth channel is antialiased (when turned on) right?

I use the exrTrader plugin ( :) ), to scale the depth channel and keep it in normal 8 bit for whatever distance I need.

Coming to think of it, Mike, if I save it out as tga... is that channel kept linear? Or does it have gamma applied.. so is then still a linear connection between meters and intensity?

A simple testscene can be made, but a quick yes or no would save some time.. :)

Andyjaggy
03-16-2010, 02:03 PM
No the depth channel isn't antialiased. This would cause problems as the edges of objects would get grayscale values that didn't correspond to their actual depth.

RebelHill
03-16-2010, 02:16 PM
No the depth channel isn't antialiased. This would cause problems as the edges of objects would get grayscale values that didn't correspond to their actual depth.

No it is... or rather as pointed out theres a depth buffer AA on/off toggle available.

But also as said, i too always do it with fog... more controlable, and renders stupid fast so its not really any kind of time overhead to do the extra pass.

Lightwolf
03-16-2010, 02:16 PM
Coming to think of it, Mike, if I save it out as tga... is that channel kept linear? Or does it have gamma applied.. so is then still a linear connection between meters and intensity?
It's linear, unless you manually apply a gamma in the processing tab.

Cheers,
Mike

Andyjaggy
03-16-2010, 02:31 PM
No it is... or rather as pointed out theres a depth buffer AA on/off toggle available.

But also as said, i too always do it with fog... more controlable, and renders stupid fast so its not really any kind of time overhead to do the extra pass.

I have tried the AA toggle and never been able to get it to apply AA to it. I'm not sure what I've been doing wrong.

Hieron
03-16-2010, 06:54 PM
No the depth channel isn't antialiased. This would cause problems as the edges of objects would get grayscale values that didn't correspond to their actual depth.


I had problems when I did not have AA on... (Frischluft lenscare).. because then you may end up having a pixel being a full depth color, while the actual color render is a blend. It made my edges look wack..

Afaik it should be on, at least for me....

Lightwolf
03-17-2010, 03:26 AM
I have tried the AA toggle and never been able to get it to apply AA to it. I'm not sure what I've been doing wrong.
The problem is usually the AA in pixels where a part of the background is visible. You do have AA there, but the problem is essentially the same as you have when filtering/AAing HDRs with a massively high contrast: If one value is small (distance to your item) and another is huge ("distance" of the empty backdrop, which is basically the largest number representable as a 32-bit float) then you can AA as much as you want to, the average of samples on that pixel will always be extremely high due to the background.

I.e. you have an AA of 4 samples.
3 hit an item that is 1m away, one of those samples hits the backdrop (which is, say, 1000km away for arguments sake).
Once those are added up and filtered (due to the AA) it's basically like finding the average value: (1000km + 1m + 1m + 1m) / 4 , which is 250km.
Mathematically correct, visually wrong - and it also shows why AA is only of limited help with depth buffers.


Cheers,
Mike

Red_Oddity
03-17-2010, 03:57 AM
I have tried the AA toggle and never been able to get it to apply AA to it. I'm not sure what I've been doing wrong.

As far as i know that doesn't Anti Alias the Depth buffer, but it makes sure the Depth buffer keeps Anti Aliased pixels of the color buffer in account, this way it will 'extend' the Depth buffer pixels to overlap Anti Aliased pixels.

You can test this with a very low res render, one with AA toggle on and one with AA off.

Hieron
03-17-2010, 04:09 AM
I suppose 255 levels of depth are enough for alot of purposes and then the AA is usually fine and keeps filesizes smaller and easier to work with. It's a bit of a problem when you need to alter it in post though, then the lack of levels can show up real quickly.

Not sure about the AA, I always thought it truly AA'ed depth, I have no idea why it wouldn't.

gerardstrada
03-17-2010, 09:48 PM
Even when Depth Buffer AA is enabled, borders over empty background won't get AA. The fog trick indeed works, but we'll need to set up a separate pass for it. If you need everything in a single render, you might want to try any of these 3 options with Depth Buffer AA enabled:

1. Place a background card (100% transparent) in your scene in such a way it covers all your frame. This card should be behind your farther object - it could be a big flipped sphere containing all objects in your scene as well. It will provide AA in borders even when it's not seen by the camera, just be sure its alpha is constant black if you are not using surface settings for alpha channel.

2. Or you may forget the BG card and use this node setup in DP_IFNE for Normal Depth:

http://imagic.ddgenvivo.tv/forums/FNE/NIF/depthAA1.png

3. Additionally, you might want to try this node setup for depth output in DP_IFNE or DP_PFNE:

http://imagic.ddgenvivo.tv/forums/FNE/NIF/depthAA2.png

Difference in DP_PFNE is that you can overwrite LW Depth buffer and save it later with exrTrader or your favorite buffer saver. You could use Pom's Group node to recycle these node setups.



Gerardo

Andy Webb
03-24-2010, 04:36 AM
Thanks for all your advise.

While I am messing around with depth mattes I thought I would try it out in AE.

Needless to say I've run into a problem, can I use a 32 bit depth matte in say HDR format as a depth matte in AE or does it have to be in either rpf or rla format.

And can I use a stand alone depth matte ie., just a grey scale 32 bit image rendered out of LW as a depth matte?

Cheers

Andyjaggy
03-24-2010, 09:19 AM
Thanks for all your advise.

While I am messing around with depth mattes I thought I would try it out in AE.

Needless to say I've run into a problem, can I use a 32 bit depth matte in say HDR format as a depth matte in AE or does it have to be in either rpf or rla format.

And can I use a stand alone depth matte ie., just a grey scale 32 bit image rendered out of LW as a depth matte?

Cheers

Yes you can use a stand alone depth matte. Use the lens blur filter and select your depth layer as the mask.

I use the Frischluft plugin as it provides much better results then the built in lens blur filter however.

djlithium
03-24-2010, 12:01 PM
The problem is usually the AA in pixels where a part of the background is visible. You do have AA there, but the problem is essentially the same as you have when filtering/AAing HDRs with a massively high contrast: If one value is small (distance to your item) and another is huge ("distance" of the empty backdrop, which is basically the largest number representable as a 32-bit float) then you can AA as much as you want to, the average of samples on that pixel will always be extremely high due to the background.

I.e. you have an AA of 4 samples.
3 hit an item that is 1m away, one of those samples hits the backdrop (which is, say, 1000km away for arguments sake).
Once those are added up and filtered (due to the AA) it's basically like finding the average value: (1000km + 1m + 1m + 1m) / 4 , which is 250km.
Mathematically correct, visually wrong - and it also shows why AA is only of limited help with depth buffers.


Cheers,
Mike

Which is why we need a proper coverage buffer in LW and have been asking for it for years.

Lightwolf
03-24-2010, 12:04 PM
Which is why we need a proper coverage buffer in LW and have been asking for it for years.
But even that breaks in a lot of cases.

Cheers,
Mike

evolross
05-12-2010, 09:52 PM
So what's the current, proper way to render a depth pass in Lightwave 9.6? Render it with AA and use a post plugin that "handles" the AA in the depth pass? Or render it without AA and then... :stumped:

Mr Rid
05-13-2010, 02:07 AM
So what's the current, proper way to render a depth pass in Lightwave 9.6?

I have yet to see any depth pass thing work right with moblur and edge AA, so I always wind up rendering a separate fog scene. Works for most situations.

gerardstrada
05-13-2010, 06:40 PM
The previous DP_FNE node setups are able to provide a depth pass (or focus pass) with AA and Mblur at pixel or image level in a single render, so no need an independent render pass. However a better setup is render at 4x without AA or Mblur, later the DOF pass is scaled in post and used in the DOF tool. This solves AA problems and wrong calculations for depth data at subpixel level (but mBlur should be added in post as well).



Gerardo

m0184you
05-14-2010, 07:36 AM
+1: I'm using fog method. Render B&W picture with AA or AS on. If I need correction of depth map/ B&W image I put little box blur in post to correct jagged edges.

evolross
05-17-2010, 10:50 PM
However a better setup is render at 4x without AA or Mblur..., later the DOF pass is scaled in post and used in the DOF tool. This solves AA problems and wrong calculations for depth data at subpixel level (but mBlur should be added in post as well).
If you're doing DOF and motion blur in post, this requires using the X and Y vector passes, right? I've never used these. Will these, when properly applied, cover motion blur? Is there any "3D motion blur" that you can lose by doing motion blur in post only with vectors for X and Y?

geo_n
05-18-2010, 12:05 AM
Yeah, use an image file format that preserves HDR pixels, i.e. flx, exr, hdr, float tiff...

Cheers,
Mike

The depth pass in exrtrader has to be 32bit float? I just tried it saving tga only and Im getting jagged lines.

Lightwolf
05-18-2010, 02:08 AM
The depth pass in exrtrader has to be 32bit float? I just tried it saving tga only and Im getting jagged lines.
That should actually be explained in the manual (why that buffer should be saved as 32-bit that is).

Cheers,
Mike

mav3rick
05-18-2010, 03:16 AM
Which is why we need a proper coverage buffer in LW and have been asking for it for years.

you should make thread on FEATURE request with explanation so that it can make newtek pay attention to it. it is impossible for them to track down your quotes so my advise is take some time open thread in feat req .


to others, well as some explained here i am also using fog method, lot easier to control and work in compositing after

Mr Rid
05-18-2010, 03:56 AM
If you're doing DOF and motion blur in post, this requires using the X and Y vector passes, right? I've never used these. Will these, when properly applied, cover motion blur? Is there any "3D motion blur" that you can lose by doing motion blur in post only with vectors for X and Y?

Right, any vector blur tools Ive seen can only deal in straight lines, so you dont get blur arcs from anything moving in a curve. Seems like someone should be able to come up with a way to interpolate a curved vector blur (like how splines calc). I find that post DOF blur has limitations as well. In extreme DOF, it just doesnt work the same as when rendered in camera, as I discovered in a shot where I had to fill in someone vomiting at the camera lens.

geo_n
05-18-2010, 06:45 AM
That should actually be explained in the manual (why that buffer should be saved as 32-bit that is).

Cheers,
Mike

I haven't read the manual :) The plugin is so easy to use I never had to read it. But I also haven't used the depth option in exrtrader since I do the fog trick ever since.

Lightwolf
05-18-2010, 06:50 AM
I haven't read the manual :)
Do you have any idea of how much time I spent writing it... and you just ignore it? Sheesh... :jester:

The plugin is so easy to use I never had to read it.
Thanks.

Hm, I see. Rest assure that I'll make sure that changes.. ;D

But I also haven't used the depth option in exrtrader since I do the fog trick ever since.
Well, there you go then :)

Cheers,
Mike :chicken:

Hieron
05-18-2010, 06:55 AM
There is a manual? And I need to save the depth at 32 bit? :)

*off to rtfm*

Lightwolf
05-18-2010, 06:59 AM
There is a manual? And I need to save the depth at 32 bit? :)
For exrTrader, yes. And since it covers buffers generally and is available for free to download on our home page it may be worthwhile to read even if you don't use exrTrader.

Cheers,
Mike - off to check if the links point to the current one.

Hieron
05-18-2010, 07:10 AM
I do use it, but usually give the range in meters manually. Seems to work fine.. I don't see a "normalize" button in the options for the depth though (in exrTrader that is)

Forgot why the fog trick would be better..

Lightwolf
05-18-2010, 07:23 AM
I do use it, but usually give the range in meters manually. Seems to work fine.. I don't see a "normalize" button in the options for the depth though (in exrTrader that is)
There isn't one for a good reason:
Normalization would need a maximum value. Now, exrTrader knows that value (since it uses it for the VIPER display), but in an animation that value would change all the time as soon as the camera moves, or the item that is furthest away from the camera (but still visible in the render).
So you'd end up with depth values where a certain shade of grey would correspond to a different distance from the camera from frame to frame.
Way to dangerous to just add to a GUI as a button in my opinion.

One solution is to basically add a maximum value to exrTrader, but then you could just use the Processing->Scale option ( 1 / max. distance).

Incidentally, an automatic normalize with a blank background would also give extremely bad LDR results, since that blank background is sooooo far away that any item would be (relatively) close to the camera once converted down to 8bits (or even 16bits) of colour resolution.

Forgot why the fog trick would be better..
So did I. I think it came about from the lack of proper float compositing tools - as well as some people that still haven't wrapped their head around float (no offense to anybody, but I've just seen it to many times).

It could be due to the issue with a blank background as mentioned above, but one can easily get around that by placing a flipped sphere around the scene (no shadows, matte item).

Cheers,
Mike

Hieron
05-18-2010, 07:34 AM
That GUI thing for the normalize makes sense btw.. way too easy to flip on regardless of what the scene/camera is doing and then compositing becomes hell..

Good, I can continue using the depth pass by exrTrader then without too much fear of doing it all wrong :)

ps: great explanation of the ROTLC plugin on your site :)

3dWannabe
05-18-2010, 12:03 PM
You can also set up a scene with white objects and black fog which is often more controllable (anti-aliased too).

Is this the 'fog trick' mentioned in this thread several times?

Lightwolf
05-18-2010, 12:11 PM
Is this the 'fog trick' mentioned in this thread several times?
Yup. Except that nowadays LW can be told to AA the depth buffer as well, which is technically incorrect but can be more pleasing when compositing (especially due to the lack of a coverage buffer... but that has its limitations as well).

Cheers,
Mike

3dWannabe
05-18-2010, 12:23 PM
Yup. Except that nowadays LW can be told to AA the depth buffer as well, which is technically incorrect but can be more pleasing when compositing (especially due to the lack of a coverage buffer... but that has its limitations as well).

Cheers,
Mike

Hopefully, everyone will post on the 'official' discussion thread with the "must have's" that are missing from LW?

http://www.newtek.com/forums/showthread.php?t=108984

After ?years? of users complaining about the lack of a coverage buffer, maybe Newtek is in the mode of listening to users now?

Lightwolf
05-18-2010, 12:25 PM
After ?years? of users complaining about the lack of a coverage buffer, maybe Newtek is in the mode of listening to users now?
Well, it's not that trivial to do properly... and only has a limited usefulness as well.
It is better than the current workarounds though. Then again, look at object ID buffers, which have their set of issues as well - and those are inherent to the concept, not because of their implementation.

Cheers,
Mike

3dWannabe
05-18-2010, 12:34 PM
Well, it's not that trivial to do properly... and only has a limited usefulness as well.
It is better than the current workarounds though. Then again, look at object ID buffers, which have their set of issues as well - and those are inherent to the concept, not because of their implementation.

Cheers,
Mike
Mike - for compositing, I bet you have a better handle on what's needed that just about anybody, as you deal with this day in and day out with exrTrader and are active on Fusion's Pigs Fly forum (and no doubt, many others).

Do you get the impression that NewTek will be listening a bit more now?

I'd certainly vote for anything on your 'must have' list.

Lightwolf
05-18-2010, 02:05 PM
Do you get the impression that NewTek will be listening a bit more now?

Hm, we're outside of HC. Let me put it this way, they are to an extent.

Cheers,
Mike

gerardstrada
05-18-2010, 09:04 PM
Originally Posted by evolross View Post
If you're doing DOF and motion blur in post, this requires using the X and Y vector passes, right? I've never used these. Will these, when properly applied, cover motion blur? Is there any "3D motion blur" that you can lose by doing motion blur in post only with vectors for X and Y?

Right, any vector blur tools Ive seen can only deal in straight lines, so you dont get blur arcs from anything moving in a curve. Seems like someone should be able to come up with a way to interpolate a curved vector blur (like how splines calc). I find that post DOF blur has limitations as well. In extreme DOF, it just doesnt work the same as when rendered in camera, as I discovered in a shot where I had to fill in someone vomiting at the camera lens.
Yep, these post-solutions can not be applied for all cases. Even RSMB advanced algorithms have problems in those cases. These post solutions need to be chosen according to shoot-by-shoot basis. For those extreme DOF cases, it would be good to be able to render hidden geometry in a single render. Maybe a refraction buffer transformed in DP_FNE could be used...



Gerardo