evanrudefx Posted September 7, 2017 Share Posted September 7, 2017 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 Quote Link to comment Share on other sites More sharing options...
Sepu Posted September 7, 2017 Share Posted September 7, 2017 Have a look at this, Adrian provided an example here. Also if you want take a look at the vtorigin function Quote Link to comment Share on other sites More sharing options...
MagicRej Posted September 7, 2017 Share Posted September 7, 2017 (edited) 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 September 7, 2017 by MagicRej Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted September 7, 2017 Share Posted September 7, 2017 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 Quote Link to comment Share on other sites More sharing options...
symek Posted September 7, 2017 Share Posted September 7, 2017 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. 1 2 Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted September 7, 2017 Share Posted September 7, 2017 Thanks symek - have to try that. I guess that will only work with Mantra, right? Cheers, Tom Quote Link to comment Share on other sites More sharing options...
malexander Posted September 7, 2017 Share Posted September 7, 2017 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. Quote Link to comment Share on other sites More sharing options...
symek Posted September 7, 2017 Share Posted September 7, 2017 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. 1 Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted September 7, 2017 Share Posted September 7, 2017 (edited) 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 September 7, 2017 by Thomas Helzle 2 Quote Link to comment Share on other sites More sharing options...
evanrudefx Posted September 7, 2017 Author Share Posted September 7, 2017 Thanks btw, I will see which solution works best for me!!! Quote Link to comment Share on other sites More sharing options...
trzanko Posted March 21, 2018 Share Posted March 21, 2018 On 9/7/2017 at 10:56 AM, Thomas Helzle said: 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 Is this supposed to work still? It errors out due to infinite recursion in 16.5.378 The chop expression way also does not evaluate. Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted March 22, 2018 Share Posted March 22, 2018 (edited) 19 hours ago, trzanko said: Is this supposed to work still? It errors out due to infinite recursion in 16.5.378 // Camera focus distance to a null called focus: vlength(vtorigin(".","../focus")) Works for me in the same version you use. Did you parent the null to something that it creates a loop? I just use a camera and a null on the obj top level. Edited March 22, 2018 by Thomas Helzle Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted March 22, 2018 Share Posted March 22, 2018 On 9/7/2017 at 4:46 PM, symek said: 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. I totally lost track of this but now finally tried it out - works great, but only for Mantra. With Redshift I get the Python error: So I guess Redshift (2.5.62) doesn't provide the needed handles (Houdini 16.5.378). I'll probably have to wait for their render viewer to provide this natively. Cheers, Tom Quote Link to comment Share on other sites More sharing options...
symek Posted March 22, 2018 Share Posted March 22, 2018 It's because adding Pz/Depth extra plane for Redshift works differently. Possibly camera parameter might have different name on RS rop. It's an easy fix if you have RS around (I don't till Monday, sorry). skk. damn you OSX with no X server anymore. 1 Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted March 22, 2018 Share Posted March 22, 2018 On 2017-09-07 at 11:21 AM, ejr32123 said: Thanks btw, I will see which solution works best for me!!! you can also have a look at Tims tutorial. 16 minutes in, he shows a simple setup for adjusting depth via the viewport Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted March 22, 2018 Share Posted March 22, 2018 (edited) 37 minutes ago, symek said: It's because adding Pz/Depth extra plane for Redshift works differently. Possibly camera parameter might have different name on RS rop. It's an easy fix if you have RS around (I don't till Monday, sorry). skk. damn you OSX with no X server anymore. Thank you symek and no hurry at all! Redshift can use the Mantra camera parameters (which is what I tried) so that shouldn't be the issue. I also tried to create a Z-Depth AOV in Redshift to no avail. I never used python scripting in Houdini so am a bit out of my depth... :-) Thanks and Cheers, Tom Edited March 22, 2018 by Thomas Helzle Quote Link to comment Share on other sites More sharing options...
trzanko Posted March 22, 2018 Share Posted March 22, 2018 3 hours ago, Thomas Helzle said: // Camera focus distance to a null called focus: vlength(vtorigin(".","../focus")) Works for me in the same version you use. Did you parent the null to something that it creates a loop? I just use a camera and a null on the obj top level. ye all good, thanks for responding! was testing the expression in the 'tz' channel lol Quote Link to comment Share on other sites More sharing options...
evanrudefx Posted September 7, 2018 Author Share Posted September 7, 2018 I found another way of doing it. I know its been a while : ) 1. Using add sop create a point 2. copy relative references of camera's transform to the point 3. create another point using the add node and merge the two points 4. create another add node after the merge and go to polygons, then by group. This will create a line between the first and second point. 5. create a measure sop and set type to perimeter 6. attribute promote and promote perimeter to detail 7. on cameras focus distance use the detail hscript expression, it should look like this: detail("/obj/geo1/attribpromote1/", "perimeter",0) 8.There ya go! You can move the second point around using a transform Quote Link to comment Share on other sites More sharing options...
K'n'K Posted May 9, 2019 Share Posted May 9, 2019 Have you guys manage to make this work with redshift eventually? On 3/22/2018 at 6:37 PM, Thomas Helzle said: Thank you symek and no hurry at all! Redshift can use the Mantra camera parameters (which is what I tried) so that shouldn't be the issue. I also tried to create a Z-Depth AOV in Redshift to no avail. I never used python scripting in Houdini so am a bit out of my depth... :-) Thanks and Cheers, Tom Quote Link to comment Share on other sites More sharing options...
Thomas Helzle Posted May 9, 2019 Share Posted May 9, 2019 I recently looked into it again and found a workaround that works for my uses: I render a Z-Depth AOV set to mimimal distance with my image. This allows to pick the Z-Depth in the Redshift viewers sidebar. I then enter the value by hand in the camera. Still hoping for a direct option at one point though. The other things I looked at either didn't update at all without a manual refresh or triggered a full scene reload. Maybe we should bug Juanjo once more... :-) Cheers, Tom Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.