Deeper Understanding of “Make 2D Perspective View”

I’m trying to understand how the inputs of the “Make 2D Perspective View” and “Make 2D” components relate to the resulting 2D output. (in Rhino 8 Windows)

The inputs are:

  • Camera position

  • Projection framing

  • Geometry to include

The resulting 2D image is centered and oriented to the World XY plane, but what exactly determines the scale of that 2D projection?

In the attached definition, I’ve:

  1. Taken the 2D output and oriented it back to the projection framing plane.

  2. Moved it along the camera axis to see where it aligns with the sight lines from the camera position.

I would expect the “Make 2D” component to have a predictable geometric relationship between its 2D output and the camera position/frame inputs — but that doesn’t seem consistent. Am I misunderstanding how these components are meant to work?

Ultimately, I’d like to simulate camera behavior — where the 2D projection appears on a “film plane” behind the camera, inverted (upside down and backwards), but still maintaining a predictable geometric relationship between:

  • Camera position

  • Screen/film plane location

  • Target geometry

  • AND most critically scale of 2D image to said target geometry

In my current setup, I manually adjust the 2D image’s position to align with the expected sight lines, but moving the camera breaks that alignment, requiring manual re-calibration each time.

See the attached .gh definition and screenshots.
Any insights on how to better understand or control this behavior would be appreciated!

— WD

P.S. The component in the upper right using the Horster plugin just orients the Rhino view-port to the camera position — it’s not required for the definition.

reverse engineering make 2D.gh (39.4 KB)

Perhaps my question wasn’t stated clearly. In short I’m trying to understand the relationship of the scale of the 2D image output to the original target geometry and the camera position/frame.

There’s almost no information out there about the “Make 2D Perspective View” component in grasshopper…if anyone has any insights please let me know!

WD

Maybe it is to related to a projection matrix and most of the math is OpenGL stuff but its just a guess.

And the scale factor could be this one.

I have not tried it.

Hi @flokart

Thanks for taking the time to reply and for linking to the Scratchapixel article.

After digging into it a bit more, I think your suggestion about the projection matrix (with something like a 1/z scaling term) is on the right track.

A big limitation here is that the Make 2D Perspective View component only shows a “camera” as a preview geometry that’s not accessible in any useful way as data. The focal length and angel of view shown in a panel from its output appear to be rounded to whole numbers and not easily accessible (being in a text format). Would be great if there were a way to “deconstruct” that Make 2D Perspective View component output and get useful numbers (like exact focal length, angle, etc… even scaling factor!). Maybe python is needed?

I’m traveling for the next couple weeks but may take a crack at it on the plane :wink:

Anyone have any other ideas?

WD

I can write a python node in gh to extract data from the rhino view to get or set the camera properties.

There is also a WorldToScreenScale method in rhinocommon, maybe its the right factor.

https://developer.rhino3d.com/api/rhinocommon/rhino.display.rhinoviewport/getworldtoscreenscale#(point3d,out)

Maybe i can set up a rhino view where you can control the camera inputs and get the needed camera output.

Will play around in free time.