Metashape

Agisoft Metashape Software#

Agisoft Metashape is a stand-alone software product that performs photogrammetric processing of digital images and generates 3D spatial data to be used in GIS applications, cultural heritage documentation, and visual effects production as well as for indirect measurements of objects of various scales. More detailed information can be found on their official site

One copy is installed on sgees018 (SGEES) and another on kahutea (ARC).

Connection Configuration#

Set up VPN client#

If you’re out of campus, download, install and run VPN client

With x2Go#

  • Start x2Go session to sgees018.geo.vuw.ac.nz or kahutea.geo.vuw.ac.nz (for ARC users)
  • Open terminal and run metashape

With VNC#

Running GUI software remotely on HPC might be sub-optimal due to missed hardware graphics acceleration.

VirtualGL is not supported by x2Go yet. Thought, VNC works fine (TigerVNC, in particular). VNC protocol, however, is unsecure and ports are blocked by university firewall. So you you need to pass it through SSH tunnel.

Set up VNC Server#

  1. Connect to server via SSH

ssh snowjo@sgees018.geo.vuw.ac.nz

  1. Set up VNC server on sgees018:
  • run vncserver and set up password. Then it will crash due to conflict with XFCE desktop environment. We’ll fix it on the next step.
snowjo@sgees018:~$ vncserver 

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n

New 'sgees018.geo.vuw.ac.nz:1 (snowjo)' desktop at :1 on machine sgees018.geo.vuw.ac.nz

Starting applications specified in /etc/X11/Xvnc-session
Log file is /Users/home/snowjo/.vnc/sgees018.geo.vuw.ac.nz:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /Users/home/snowjo/.vnc/passwd :1 to connect to the VNC server.


tigervncserver: Failed command '/etc/X11/Xvnc-session': 256!

=================== tail -15 /Users/home/snowjo/.vnc/sgees018.geo.vuw.ac.nz:1.log ===================
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12008000, The X.Org Foundation


Wed Nov 13 15:06:51 2024
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on local interface(s), port 5901
 vncext:      created VNC server for screen 0
You are using 21 GB (172788 files) of 150 GB.
X connection to :1 broken (explicit kill or server shutdown).

Wed Nov 13 15:06:52 2024
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)
Killing Xtigervnc process ID 4049134... which seems to be deadlocked. Using SIGKILL!

=======================================================================================================

Starting applications specified in /etc/X11/Xvnc-session has failed.
Maybe try something simple first, e.g.,
        tigervncserver -xstartup /usr/bin/xterm
  • Now create a new custom startup file as ~/.vnc/xstartup, make it executable
touch ~/.vnc/xstartup
chmod +x ~/.vnc/xstartup

and paste the following lines there:

#!/bin/sh

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager

Note: modern version of TigerVNC server expects your session will start in foreground so the last command should not contain any trailing ampersand.

  • Then start server again:
snowjo@sgees018:~$ vncserver

New 'sgees018.geo.vuw.ac.nz:1 (snowjo)' desktop at :1 on machine sgees018.geo.vuw.ac.nz

Starting applications specified in /Users/home/snowjo/.vnc/xstartup
Log file is /Users/home/snowjo/.vnc/sgees018.geo.vuw.ac.nz:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /Users/home/snowjo/.vnc/passwd :1 to connect to the VNC server.

Set up SSH Tunnel#

Note the port VNC server is running on

snowjo@sgees018:~$ vncserver -list

TigerVNC server sessions:

X DISPLAY #     RFB PORT #      PROCESS ID
:1              5901            138974

In our case it’s 5901, so we forward it via another SSH session. Start from your home computer:

ssh -L 5901:localhost:5901 snowjo@sgees018.geo.vuw.ac.nz

If in Windows, follow the https://linuxize.com/post/how-to-setup-ssh-tunneling/#set-up-ssh-tunneling-in-windows

To protect your tunnel from disconnect after idle timeout, add the following lines to the top of your local ~/.ssh/config (Linux or MacOS)

Host *
  ServerAliveInterval 100

In Windows find the relevant settings in PuTTY configuration.

Start VNC Client#

You need a TigerVNC client installed on your local computer Start it and connect to localhost:port, where port is the port number from above, e.g. localhost:5901. Type your VNC password when prompted. You should see a grey window with a single terminal application.

Start Metashape#

Run vglrun metashape in terminal. That’s all.

Exit Metashape#

Close Metashape window, then close VNC client on your local computer.

Stop VNC server#

Check if any VNC sessions are still running:

snowjo@sgees018:~$ vncserver -list

TigerVNC server sessions:

X DISPLAY #     RFB PORT #      PROCESS ID
:1              5901            138974

And kill them all:

snowjo@sgees018:~$ vncserver -kill
Killing Xtigervnc process ID 138974... success!

Stop SSH tunnel#

Exit from second SSH session (where you started ssh -L)

Stop VPN#

It’s better to keep it off (unless you need to connect to campus network) for avoiding of various connectivity issues.

Troubleshooting#

There are several known issues with Metashape. The most common one is lost license. If you see a message of missing license, don’t activate trial version, close program and report to SGEES System Administrator.