Page 1 of 2

Lightwave Camera & ThinLens DOF Matching for Masks & Passes

PostPosted: Tue Nov 19, 2013 5:21 pm
by MrFurious
Hi all, I've been tinkering with the nodes in Octane Editor in an attempt to match the DOF settings of Octane ThinLens, with those of the Lightwave perspective camera and I think I have something which works quite well. I often need object and surface isolation masks and before I bought Octane I'd render these out using ShaderMeister. Along comes the fabulous Octane render, but how to generate isolation masks? I noticed the default diffuse material has a 'matte' button but only the diffuse materal, not glossy or specular. Even if all Octane materials had the matte option it would still be a daunting task to activate/deactivate these individually as required especially in a scene with many objects and materials. The 'material override' feature would be helpfull but only on a per-object basis (good for object masks but not surface masks)

So.. back to shadermeister for my masks & passes but here's the problem: ThinLens DOF needs to match Lightwaves own DOF or the masks won't match the beauty render. This is what I've come up with and so far I've found it to work, but I haven't fully tested it in a variety of different scenes/camera focal lengths etc.

First thing to note is the Focal Depth is controlled in the usual Lightwave way ie: targeted to a null via proximity modifier in the LW Camera DOF panel. Add a null for the DOF Target, parent to camera and disable the null's rotation HPB, scale XYZ and Position XY.. you only want to move this along the Z axis towards and away from the camera. I added a 'shape' custom object to the null so it's easier to see in your scene. Open up the octane editor and drop in the 'Camera' node (Item info-->Camera) double click and select 'Render Camera' Connect the focal distance node output to the focal depth input of thinlens camera. Boom- focal distance now mathches.

FD.jpg
The yellow diamond is the DOF target null


The Lens F-Stop (amount of defocus) is also controlled via the LW camera DOF panel. No modifier here though, just enter a number and it ties into Octane later in the Editor. This next step was a bit tricky (for me anyway I'm very much mathematically challenged) Octane's aperture setting works inversely to Lightwave. If both LW F-stop and Octane's aperture settings are set to 1 the defocus matches. A LW F-stop value of 0.5 = Octane Aperture setting of 2. A LW F-stop value of 0.25 = Octane Aperture setting of 4, and so on. Halve the LW F-stop and double the Octane setting to get the same defocus effect. Back to the octane editor drop in a divide node. In the LW camera node added earlier, connect the 'Lens F-stop' output node to both the A & B inputs of the divide node. This divides the LW fstop number by itself, but you need to do this twice. Copy and paste the divide node, connect the 'result' from the first divide node into A of the second divide node, and in the B input, connect the Lens Fstop node from the LW camera. ie: LW fstop number of 0.5 divided by 0.5 = 1 divided by 0.5 = 2.

fstop1.jpg


This seemed to do the trick until I realised the Lens Focal Length (or zoom factor) of the LW camera effected the defocus amount. The next part was trial and error.. connect the LW camera 'zoom factor' output node to the input A of a divide node and in input B put 2.7, run the result into a multiply node and connect the result into the octane aperture node input.

fstop2.jpg


I tested this at focal lengths of 12mm, 18mm, 35mm, 50mm and both the Octane and LW DOF match perfectly. (Best way to check this is rendering out alpha's)

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Thu Nov 21, 2013 2:23 am
by UnCommonGrafx
Well,
That's quite helpful!
Thank you.

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Thu Nov 21, 2013 9:31 am
by marchermitte
Yeap, congrats, that was one of my issues as well. I'm going to test out.
Thank you!

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Thu Nov 21, 2013 12:17 pm
by MrFurious
I've yet to test this myself on an actual job and a more complex scene, hopefully this will hold up and wasn't just a per-scene solution- may need some tweaking

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Sun Nov 24, 2013 9:57 pm
by alexos
Very interesting and informative, thank you. Er, however, I might have missed something here, but when you speak of "surface isolation", I mean... Couldn't you just use the "surfaceID" pass in the info kernel?

ADP.

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Mon Nov 25, 2013 6:46 am
by MrFurious
Hey I'd totally missed the passes option in the Info Kernel.. Unfortunately this is the result I get from a Material ID pass, less than desireable :(

render.jpg
render

materialID.jpg
note: no DOF where objects are in front of the background. Also colours all smooshed toghether where objects intersect


This is what I'm trying to achieve:

starthing mask.jpg
item/material 1 mask

blob mask.jpg
item/material 2 mask

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Mon Nov 25, 2013 10:48 am
by alexos
Oops, you're quite right - no mask DOF if there's no geometry in the background. Bug report/feature request on this one, I would say, even though I seem to remember reading they're going to add all sorts of passes in v1.5... Juanjo? :)

ADP.

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Mon Nov 25, 2013 1:43 pm
by MrFurious
Simple workaround could add a background plane for the sake of passes then deactivate when not needed. Still.. I'm not a fan of the the smooshy colour bleeding. wonder if there's some way to use the alpha input of the Info Kernel to isolate an object or material?

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Mon Nov 25, 2013 3:21 pm
by FrankPooleFloating
I do not have time to read entire thread today, but I have made more than a couple separation masks using Override w/ Override Exclusion in object properties... and for separating a certain material, I make two new copies of this object - one with polys of the material I want, and the other without... Do Override as Matte and turn off Override for that material object I wanted...

Re: Lightwave Camera & ThinLens DOF Matching for Masks & Pas

PostPosted: Sat Dec 14, 2013 2:03 pm
by happymilk
i use a different solution for determine the DOF distance.
Only 2 ItemInfo node (one for camera and one for the NullObject that i use for focus) and a Distance Node.
It's work well for me :)