Looking Through: part 1 — Looking For.

For those unaware, the small yellow box in the upper right of the viewport can be used to set a camera or light as an object to “look through.” Many are familiar with this behavior from other 3D packages. To give it a try, pull down the menu and select a camera from the list of use the submenu to select a light. Or alternatively, drag a light or camera node from the network graph and onto the viewport.

h12 upper right viewport

h12 upper right viewport

Determining the camera/light object already being looked through in the viewport has come up on forums as well as the sidefx listserve several times. I had myself sent out a message about it some time ago as I was sure there “had to be” a built in HOM function to pull this information, without delving into C++, after all, the little yellow box displays the name of what being looked through so theres some awareness, but it turns out there is no built in HOM method to do so. There needs to be a custom one.

In previous posts, moving up a level and matching locations was used as a way to determine if a node overlapped with a netbox. Similarly, the 3D transform matrix of the viewport can be matched to that of a light or a camera to determine if we are viewing through it. Of course, there is a risk of multiple objects with the same transform, but in practicality it is unlikey other than cases of unrotated objects at the world origin. The final scripts will do its best to minimize this scenario. There are also special case scenarios when dealing with stereo cameras and three point light which will be looked at.

First, lets look at the base function and how it will work.


Leave a Reply

Your email address will not be published. Required fields are marked *