Search the Community
Showing results for tags 'ndc'.
Found 2 results
Hey, I am currently building an HDA with python viewer states and I want to display an image/grid in the upper left corner of the viewport. This is what I currently use to move the grid to the current viewport postion. viewport = hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport() cam = viewport.viewTransform() hou.parmTuple('/obj/geo1/transform1/t').set(cam.extractTranslates()) hou.parmTuple('/obj/geo1/transform1/r').set(cam.extractRotates()) I also transform the grid in the negative z direction afterwards. This results in the image beeing in the center of the viewport. But I'm not sure how I can move the image to the corner of the viewport and keep it in the correct postion when the viewport is beeing resized. Maybe with the viewport.viewportToNDCTransform() or viewport.mapToWorld() methods. But I couldnt figure out how. I found a promising vex based result here:https://youtu.be/7UuVhbTRcew?t=1890 string cam = chs("camera"); vector bb = relbbox(0,@P); vector4 crop = chp("crop"); bb.x = fit(bb.x, 0, 1, crop.x, crop.y); bb.y = fit(bb.y, 0, 1, crop.z, crop.w); bb.z = chf("zoffset"); @P = fromNDC(cam,bb); But this one requires a camera node and I'd rather have this logic in the python states if possible. Thanks
How can I get the word position of a point I'm seeing through a camera and on the camera's screen plane. Let's say the camera resolution is 1280x720 pixels ( 0,0 at top left and 1280,720 at bottom right), I want to know the world position of a point which will be at the pixel position of 300,200 at render output. Will this differ if I have Orthographic or Perspective camera? I think fromNDC / ptransform functions are the saviors here but I can't quite figure out how exactly. In general I'd appreciate if anyone can explain the world space, object space and camera space in Houdini in comparison which conventions that OpenGL has for instance. I read here and there that in H world space is actually camera space (or is it only in Mantra and not SOPs?). Also in OpenGL NDC is [-1,1] in all three dimensions, how is this in H? Cheers