Using EXIFdata is optional when available, if not you need to do it manually
What if the information is unknown; for example a published photo?
Use the tool like any other photo, this is just an optional feature
Perspective Editor
Auto Match with ROI feature (Region of Interest).
What it does in Photo Match:
When you run Auto Match on a full photograph, the detector analyzes the entire image, including:
- Trees, bushes, and foliage
- Clouds and sky
- Cars, curved roads, and pedestrians
These objects contain ânoisyâ or non-architectural lines that can distract the vanishing point solver.
How ROI helps:
When you draw an ROI box (or multiple boxes) directly over the building facade:
- Focuses on Architecture: The line detector only searches inside the box (e.g. windows, facade columns, roof edges, floor slabs).
- Ignores Clutter: Everything outside the box (sky, cars, trees, background buildings) is ignored.
- Higher Accuracy: Gives a cleaner, more precise vanishing point calculation and camera solve.
Hi, thanks for making this, it looks really useful.
Iâve tried the current Food4Rhino download on Rhino 8 on macOS, and it fails to load at startup with âThe type initializer for âRhinoPerspectiveMatch.Core.PerspectiveControllerâ threw an exception.â
I asked Claude to help and apparently itâs trying to load kernel32.dll from the mouse-wheel hook:
System.DllNotFoundException: Unable to load shared library 'kernel32.dll' or one of its dependencies.
at RhinoPerspectiveMatch.Interaction.PerspectiveMouseWheelHook.GetCurrentThreadId()
at RhinoPerspectiveMatch.Interaction.PerspectiveMouseWheelHook.Install()
at RhinoPerspectiveMatch.Interaction.PerspectiveMouseWheelHook..ctor(PerspectiveController ctrl)
at RhinoPerspectiveMatch.Core.PerspectiveController..ctor()
at RhinoPerspectiveMatch.Core.PerspectiveController..cctor()
So the Win32 hook is taking the whole plugin down on Mac. Guarding the hook install with OperatingSystem.IsWindows() (or using Rhinoâs MouseCallback instead, which works cross-platform) should sort it, even if Mac just loses the wheel feature for now.
Apologies if Claude is talking rubbish but any idea how to fix otherwise?
Thanks!
Hi
Check the updated version 1.1.7, and let me know if you get any error.
You installed this one?
Thanks for the update. Working now.
Did you try the plugin with png and jpeg in macos?
When I said it was working, I only meant it loaded the plugin without error. Iâve actually tried loaded a couple of different images now but canât get them to appear in the viewport. It reads the image and sets up axes. If I click âshow all detected edgesâ I can see 200+ lines but still no loaded image. I should probably read the manual at this point.
Try the new update 1.1.8
Run this script in the Script Editor
_ScriptEditor or _EditPythonScript
# ==============================================================================
# Rhino 8 (macOS & Windows) Viewport Image Diagnostics Script
# ==============================================================================
# How to run:
# 1. In Rhino 8 on Mac, open the Script Editor by typing '_ScriptEditor'
# 2. Paste this entire script into a new Python tab.
# 3. Click the Play (Run) button.
# 4. Pick a PNG or JPG image when prompted.
# 5. Use the command line menu to test each display technique (Mode 1 to Mode 6).
# ==============================================================================
import os
import sys
import Rhino
import Rhino.DocObjects
import Rhino.Display
import Rhino.Geometry
import Rhino.Input.Custom
import Rhino.UI
import System
from System.Drawing import Color, Rectangle, PointF
print("=" * 65)
print(" Rhino 8 Viewport Image Diagnostics (macOS / Windows)")
print("=" * 65)
print(f"Rhino Version : {Rhino.RhinoApp.Version}")
print(f"Platform : {System.Environment.OSVersion}")
print(f"Is macOS : {Rhino.Runtime.HostUtils.RunningOnOSX}")
print(f"Is Windows : {Rhino.Runtime.HostUtils.RunningOnWindows}")
print(f".NET Runtime : {System.Environment.Version}")
print("=" * 65)
# 1. Ask user to pick an image file
fd = Rhino.UI.OpenFileDialog()
fd.Title = "Select Image to Test Viewport Rendering"
fd.Filter = "Image Files (*.png;*.jpg;*.jpeg;*.bmp)|*.png;*.jpg;*.jpeg;*.bmp|All Files (*.*)|*.*"
if not fd.ShowOpenDialog():
print("User cancelled file selection.")
sys.exit()
image_path = fd.FileName
if not os.path.isfile(image_path):
print(f"Error: File not found: '{image_path}'")
sys.exit()
file_size = os.path.getsize(image_path)
print(f"\n[1] Selected Image: '{image_path}' ({file_size:,} bytes)")
# 2. Test Rhino.Display.DisplayBitmap.Load
disp_bmp = None
try:
disp_bmp = Rhino.Display.DisplayBitmap.Load(image_path)
if disp_bmp is None:
print("[-] DisplayBitmap.Load(path) returned: None")
else:
print(f"[+] DisplayBitmap.Load(path) SUCCEEDED! Size: {disp_bmp.Size.Width} x {disp_bmp.Size.Height}")
except Exception as ex:
print(f"[-] DisplayBitmap.Load exception: {ex}")
# 3. Create a textured DisplayMaterial for Mesh testing
disp_mat = None
try:
disp_mat = Rhino.Display.DisplayMaterial()
disp_mat.SetBitmapTexture(image_path, True)
disp_mat.Diffuse = Color.White
disp_mat.Emission = Color.White
print("[+] Created DisplayMaterial with diffuse texture.")
except Exception as ex:
print(f"[-] DisplayMaterial creation note: {ex}")
class ImageTestConduit(Rhino.Display.DisplayConduit):
def __init__(self, bmp, mat, img_path):
super(ImageTestConduit, self).__init__()
self.bmp = bmp
self.mat = mat
self.img_path = img_path
self.mode = 1
self.log_once = True
def PreDrawObjects(self, e):
super(ImageTestConduit, self).PreDrawObjects(e)
vp = e.Viewport
if not (vp.IsPerspectiveProjection or vp.IsTwoPointPerspectiveProjection):
return
vp_w = vp.Size.Width
vp_h = vp.Size.Height
# Mode 1: PreDrawObjects + DrawSprite (Plugin default method)
if self.mode == 1:
if self.bmp is not None:
e.Display.EnableDepthWriting(False)
e.Display.EnableDepthTesting(False)
cx = vp_w * 0.5
cy = vp_h * 0.5
w = vp_w * 0.6
h = vp_h * 0.6
center = Rhino.Geometry.Point2d(cx, cy)
e.Display.DrawSprite(self.bmp, center, float(w), float(h))
e.Display.EnableDepthTesting(True)
e.Display.EnableDepthWriting(True)
if self.log_once:
print(f" [Conduit Mode 1] PreDrawObjects DrawSprite called at center=({cx},{cy}), size=({w}x{h})")
# Mode 3: PreDrawObjects + DrawBitmap
elif self.mode == 3:
if self.bmp is not None:
e.Display.DrawBitmap(self.bmp, 50, 50)
if self.log_once:
print(" [Conduit Mode 3] PreDrawObjects DrawBitmap called at (50, 50)")
# Mode 6: PreDrawObjects + Camera-facing Textured Mesh
elif self.mode == 6:
if self.mat is not None:
cam_pos = vp.CameraLocation
cam_dir = vp.CameraDirection
cam_dir.Unitize()
cam_up = vp.CameraUp
cam_up.Unitize()
cam_right = Rhino.Geometry.Vector3d.CrossProduct(cam_dir, cam_up)
cam_right.Unitize()
center = cam_pos + cam_dir * 10.0
half_w = 4.0
half_h = 3.0
p0 = center - cam_right * half_w - cam_up * half_h
p1 = center + cam_right * half_w - cam_up * half_h
p2 = center + cam_right * half_w + cam_up * half_h
p3 = center - cam_right * half_w + cam_up * half_h
mesh = Rhino.Geometry.Mesh()
mesh.Vertices.Add(p0)
mesh.Vertices.Add(p1)
mesh.Vertices.Add(p2)
mesh.Vertices.Add(p3)
mesh.Faces.AddFace(0, 1, 2, 3)
mesh.TextureCoordinates.Add(0.0, 0.0)
mesh.TextureCoordinates.Add(1.0, 0.0)
mesh.TextureCoordinates.Add(1.0, 1.0)
mesh.TextureCoordinates.Add(0.0, 1.0)
mesh.Normals.ComputeNormals()
e.Display.DrawMeshShaded(mesh, self.mat)
if self.log_once:
print(" [Conduit Mode 6] PreDrawObjects DrawMeshShaded called with camera quad")
def DrawForeground(self, e):
super(ImageTestConduit, self).DrawForeground(e)
vp = e.Viewport
if not (vp.IsPerspectiveProjection or vp.IsTwoPointPerspectiveProjection):
return
vp_w = vp.Size.Width
vp_h = vp.Size.Height
# Mode 2: DrawForeground + DrawSprite
if self.mode == 2:
if self.bmp is not None:
cx = vp_w * 0.5
cy = vp_h * 0.5
w = vp_w * 0.6
h = vp_h * 0.6
center = Rhino.Geometry.Point2d(cx, cy)
e.Display.DrawSprite(self.bmp, center, float(w), float(h))
if self.log_once:
print(f" [Conduit Mode 2] DrawForeground DrawSprite called at center=({cx},{cy}), size=({w}x{h})")
# Mode 4: DrawForeground + DrawBitmap
elif self.mode == 4:
if self.bmp is not None:
e.Display.DrawBitmap(self.bmp, 50, 50)
if self.log_once:
print(" [Conduit Mode 4] DrawForeground DrawBitmap called at (50, 50)")
# Always draw a cyan 2D boundary box to confirm DrawForeground works
box_w = int(vp_w * 0.6)
box_h = int(vp_h * 0.6)
box_l = int((vp_w - box_w) * 0.5)
box_t = int((vp_h - box_h) * 0.5)
e.Display.Draw2dRectangle(Rectangle(box_l, box_t, box_w, box_h), Color.FromArgb(255, 0, 255, 255), 2, Color.Empty)
e.Display.Draw2dText(
f"Test Mode {self.mode}: Check if photo appears inside cyan box",
Color.FromArgb(255, 0, 255, 255),
Rhino.Geometry.Point2d(box_l + 10, box_t + 10),
False,
18
)
self.log_once = False
conduit = ImageTestConduit(disp_bmp, disp_mat, image_path)
conduit.Enabled = True
Rhino.RhinoDoc.ActiveDoc.Views.Redraw()
mode_descriptions = {
1: "Mode 1: PreDrawObjects + DrawSprite (Plugin default method)",
2: "Mode 2: DrawForeground + DrawSprite (2D screen overlay channel)",
3: "Mode 3: PreDrawObjects + DrawBitmap (Unscaled 2D bitmap at 50,50)",
4: "Mode 4: DrawForeground + DrawBitmap (Unscaled 2D bitmap at 50,50)",
5: "Mode 5: Native Viewport Wallpaper (SetWallpaper)",
6: "Mode 6: Camera-facing 3D Mesh with DisplayMaterial (DrawMeshShaded)",
}
print("\n" + "=" * 65)
print(" Interactive Viewport Test Menu")
print("=" * 65)
for k, v in mode_descriptions.items():
print(f" {k} = {v}")
print(" 0 = Exit and Clean Up")
print("=" * 65)
active_doc = Rhino.RhinoDoc.ActiveDoc
active_vp = active_doc.Views.ActiveView.ActiveViewport if active_doc and active_doc.Views.ActiveView else None
try:
while True:
go = Rhino.Input.Custom.GetOption()
go.SetCommandPrompt("Select Image Display Mode to test (0 to Exit)")
for k in range(1, 7):
go.AddOption(f"Mode{k}")
go.AddOption("Exit")
res = go.Get()
if res == Rhino.Input.GetResult.Option:
opt_index = go.Option().Index
if opt_index == 7: # Exit
break
conduit.mode = opt_index
conduit.log_once = True
if opt_index == 5:
if active_vp:
active_vp.SetWallpaper(image_path, False)
print(f"\n[+] Set wallpaper to '{image_path}' on viewport '{active_vp.Name}'")
else:
if active_vp:
active_vp.SetWallpaper("", False)
print(f"\n>>> Switched to {mode_descriptions.get(opt_index, 'Unknown')}")
active_doc.Views.Redraw()
else:
break
finally:
conduit.Enabled = False
if active_vp:
active_vp.SetWallpaper("", False)
if disp_bmp:
disp_bmp.Dispose()
if active_doc:
active_doc.Views.Redraw()
print("\n[+] Cleaned up test conduit and wallpaper. Diagnostics complete.")
Please also test with the attached updated plugin, which now prints debug information to help identify the issue on macOS.
New Rhino Command: AutoPerspectiveMatchDiag: type AutoPerspectiveMatchDiag to:
- Print the entire plugin state (Paths,
DisplayPhotostatus, active viewport, conduit status). - Click
ToggleForegroundto switch photo drawing betweenPreDrawObjects(3D background) andDrawForeground(2D overlay). - Click
SetWallpaperto force the image as native wallpaper. - Click
Redrawto force a viewport refresh.
AutoPerspectiveMatch.rhp (276 KB)
Thanks. I used the version above. Test mode 3 - image loads but bigger than viewport. 4 - same. 5 - looks correct.
HTH. Let me know if you want me to test more.
edit - 6 had a white rectangle. 1 and 2 - nothing.
I need the full debug that printed in rhino command
This is a random image (cropped and straightened) that I had to hand but shows itâs now working on my Mac (tested in Rhino v9). It was shot with a 16mm lens so after the crop figuring 17.6 is probably right.
Fair that it was confused by the pointy roof on auto but moving the two pairs of axes manually got the error to zero.






