{"id":7749,"date":"2015-05-26T23:35:46","date_gmt":"2015-05-26T14:35:46","guid":{"rendered":"http:\/\/leavebehind.iobb.net\/wordpress\/?p=7749"},"modified":"2015-05-26T23:35:46","modified_gmt":"2015-05-26T14:35:46","slug":"v-ray-physical-camera%e3%81%aefov","status":"publish","type":"post","link":"http:\/\/leavebehind.mydns.jp\/wordpress\/2015\/05\/26\/v-ray-physical-camera%e3%81%aefov\/","title":{"rendered":"V-Ray Physical Camera&#8217;s Fov"},"content":{"rendered":"<p>Focal length\u3067\u753b\u89d2\u3092\u6307\u5b9a\u3057\u305fV-Ray Physical Camera\u304b\u3089fov\u3092\u53d6\u5f97\u3059\u308b\u30c6\u30b9\u30c8\u30b9\u30af\u30ea\u30d7\u30c8\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/leavebehind.iobb.net\/wordpress\/wp-content\/uploads\/2015\/05\/VRayCameraFOV.jpg\" alt=\"VRayCameraFOV\" width=\"1656\" height=\"918\" class=\"aligncenter size-full wp-image-7763\"><\/p>\n<p>Maya\u306e\u30ab\u30e1\u30e9\u306a\u3089\u4ee5\u4e0b\u306e\u3088\u3046\u306bfilmWidth\u3068focalLength\u304b\u3089\u8a08\u7b97\u3067\u304d\u307e\u3059\u304c\u3001Max\u306eV-Ray Camera\u3067\u306f\u88ab\u5199\u4f53\u307e\u3067\u306e\u8ddd\u96e2\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true \">def angleOfView(filmWidth,focalLength):\n    angle = 2 * math.atan(float(filmWidth) \/ (2*float(focalLength)))\n    angle = math.degrees(angle)\n    return angle<\/pre>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/Angle_of_view\">Angle of view<\/a>\u306e\u300cDerivation of the angle-of-view formula\u300d\u304c\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true \" title=\"getVRayCamFov.py\">import MaxPlus\nimport math\n \ndef angleOfView(filmWidth,focalLength):\n    angle = 2 * math.atan(float(filmWidth) \/ (2*float(focalLength)))\n    angle = math.degrees(angle)\n    return angle\n \ndef angleOfViewVrayCamera(filmWidth,focalLength,distance):\n\tfocalLengthWithMagFactor = distance * focalLength \/ (distance - focalLength)\n\tangle = angleOfView(filmWidth,focalLengthWithMagFactor)\n\treturn angle\n \ndef getVRayCameraFocusDistance(node):\n\tobjPBlock = node.Object.ParameterBlock\n\tdistance = 0.0\n\tif objPBlock.targeted.Value and (not objPBlock.specify_focus.Value):\n\t\ttargetNode = node.GetTarget()\n\t\tvec = targetNode.GetWorldPosition() - node.GetWorldPosition()\n\t\tdistance = vec.GetLength()\n\telif (not objPBlock.targeted.Value) and (not objPBlock.specify_focus.Value):\n\t\tdistance = objPBlock.target_distance.Value\n\telif (not objPBlock.targeted.Value) and objPBlock.specify_focus.Value:\n\t\tdistance = objPBlock.focus_distance.Value\n\treturn distance\n \ndef getVRayCameraFOV(node):\n\tobjPBlock = node.Object.ParameterBlock\n\tfov = 0.0\n\tif objPBlock.specify_fov.Value == True:\n\t\tfov = objPBlock.fov.Value\n\telse:\n\t\tfov = angleOfViewVrayCamera(\n\t\t\tobjPBlock.film_width.Value,\n\t\t\tobjPBlock.focal_length.Value,\n\t\t\tgetVRayCameraFocusDistance(node))\n\treturn fov\n\t\nif __name__ == '__main__':\n\tif MaxPlus.SelectionManager.GetCount() != 0:\n\t\tselNode = MaxPlus.SelectionManager.GetNode(0)\n\t\tif selNode.Object.GetClassName() == 'VRayPhysicalCamera':\n\t\t\tprint getVRayCameraFOV(selNode)\n\t\telse:\n\t\t\tprint \"Selection is not V-Ray Camera.\"\n\telse:\n\t\tprint \"Select V-Ray Camera.\"\n<\/pre>\n<p>\u306f\u3058\u3081\u3066PythonAPI\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3001Max\u306e\u4e2d\u306bPython\u30a8\u30c7\u30a3\u30bf\u304c\u642d\u8f09\u3055\u308c\u3066\u308b\u308f\u3051\u3067\u306f\u7121\u3044\u3093\u3067\u3059\u306d\u3002API\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u60c5\u5831\u91cf\u3082\u5c11\u306a\u3044\u306a\u30fc\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Converting focal length of V-Ray Physical camera to FOV<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,18],"tags":[31,32,279],"class_list":["post-7749","post","type-post","status-publish","format-standard","hentry","category-cg","category-uncategorized","tag-3ds-max-python-api","tag-3dsmax","tag-v-ray"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p8YSE4-20Z","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts\/7749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=7749"}],"version-history":[{"count":0,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts\/7749\/revisions"}],"wp:attachment":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=7749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=7749"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=7749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}