Jump to content
ejr32123

Controlling Focus Distance

Recommended Posts

ejr32123    4

Hey,

This is how I control the focus distance in Maya. I use a measure distance node, then use that distance to drive the focal distance so where ever I move the null, the scene is in focus. Can I do this in Houdini? Is there a measure distance node that can get the distance between two null objects? One null would be at camera's position and the other null where I want to focus.

Thanks

Share this post


Link to post
Share on other sites
Sepu    69

Have a look at this, Adrian provided an example here. Also if you want take a look at the vtorigin function

 

Share this post


Link to post
Share on other sites
MagicRej    1
9 hours ago, ejr32123 said:

Hey,

This is how I control the focus distance in Maya. I use a measure distance node, then use that distance to drive the focal distance so where ever I move the null, the scene is in focus. Can I do this in Houdini? Is there a measure distance node that can get the distance between two null objects? One null would be at camera's position and the other null where I want to focus.

Thanks

Hey,

Also , you can find the distance between camera and arbitrary point in SOP level and then fetch it as your Focus distance value.

See attached example.
Hope it help.

focus_distance1.hipnc

Edited by MagicRej

Share this post


Link to post
Share on other sites
Thomas Helzle    161

What I really miss is a way to click into the rendering to set the focus distance. This is very nice for quickly finding the sweet spot for stills. Love it in Thea Render etc.

Is there a way to do this as a viewport action in Houdini with some raytracing from the mouse?

Cheers,

Tom

Share this post


Link to post
Share on other sites
symek    266
2 hours ago, Thomas Helzle said:

What I really miss is a way to click into the rendering to set the focus distance. This is very nice for quickly finding the sweet spot for stills. Love it in Thea Render etc.

Is there a way to do this as a viewport action in Houdini with some raytracing from the mouse?

Cheers,

Tom

Indeed there is. Just to illustrate a concept:

- copy $HFS/scripts/ipr/pickpixel.py to ~/houdini16/scripts/ipr/

- comment out the very last line (hou.ui.displyMessage(...))

- append (in the same scope, just bellow): 

    if not "Pz" in viewer.planes():
        rop_node_name.parm("vm_quickplane_Pz").set(1)
        viewer.startRender()
    else:
        value  = viewer.pixel("Pz", px, py)
        camera = rop_node_name.parm("camera").eval()
        camera = hou.node(camera)
        camera.parm("focus").set(value[0])

For a first time you will have to Ctrl-Click twice if there is no "Pz" plane, otherwise Ctrl-click on IPR pane will set distance on rop's camera.

cheers,

skk.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
malexander    295

You can also use an Object CHOP to get the distance between two objects, then put a chop() expression in the focus parameter to fetch the result.

Share this post


Link to post
Share on other sites
symek    266
14 minutes ago, Thomas Helzle said:

Thanks symek - have to try that.

I guess that will only work with Mantra, right?

You're welcome :). I think the only Mantra dependency is adding Pz to planes' set. Otherwise it relies only on pixel value from a viewer, so if only your renderer puts some pixels there it's should work for it too.

  • Thanks 1

Share this post


Link to post
Share on other sites
Thomas Helzle    161

Cool - have to try it with Redshift as soon as the current job is done! :-)

So far I always used this in the focus distance field:

// Camera focus distance to a null called focus:
vlength(vtorigin(".","../focus"))

But it's a bit clumsy to navigate the null.

Tom

Edited by Thomas Helzle

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×