This very short tutorial briefly covers how to recreate the locations and rotations of cameras from Metashape in Grasshopper.
N.B. An earlier version of the Grasshopper definition included in this tutorial did not account for gimbal lock, but as of 12th of September 2020 the issue has been corrected and the linked file updated.
The purpose of this is to accurately place and orient duplicates of any given brep or mesh in the same way as the cameras in Metashape are placed.
In Metashape, maneuver to
Export the cameras with the
Omega Phi Kappa option (.txt).
In Grasshopper, replicate the above definition (
Open image in new tab to see full resolution, or download the GH 1.0 file here) and load the exported file to the File Path node (
RMB\Select one existing file). The placeholder geometry has the purpose of being replaced with whatever is appropriate to your vision (a camera mesh, an arrow brep, etc.).
Please note that for your brep/mesh replacing the placeholder geometry to be accurately oriented, it must have its origin at XYZ 0,0,0 and have its intended forward vector pointing downwards, towards Z- (this reflects the default camera forward vector in Metashape presumably being Z-, reflecting its practical use for aerial photogrammetry). While you could have your brep/mesh oriented towards any direction, as long as you compensate for it in Grasshopper (by rotating it towards Z- before the
Move To Point node), the definition above adheres to the implicit forward vector of Z-, requiring (without altering of the definition) that the referenced brep/mesh is oriented downwards in Rhino (or Grasshopper, depending on whether it is referenced or constructed in Grasshopper). Additionally, with its forward vector being Z-, its upwards vector should be Y+, so that an asymmetrical brep/mesh not only points in the correct direction, but also is correctly oriented in itself.
Here we see the baked placeholder geometry. Since Metashape and Rhino share the same coordinate space (right-handed Z-up), everything is oriented in Rhino according to the same axes as in Metashape (which makes it straightforward to glance back in Metashape and verify that the results are correct).
If you encounter any issues, please write a comment below, and we will do our best to solve the problem.