ViewMatrix

ViewMatrix

is an option for Graphics3D and related functions that can be used to specify a pair of explicit homogeneous transformation and projection matrices for 3D coordinates.

Details

  • ViewMatrix can be set to a pair of 4×4 matrices {t,p}, where t is a homogeneous transformation matrix and p is a projection matrix in 3D.
  • The transformation matrix t is applied to the list {x,y,z,1} for each point. The projection matrix p is applied to the resulting vectors from the transformation.
  • If the result is {tx,ty,tz,tw}, then the screen coordinates for each point are taken to be given by {tx,ty}/tw.
  • With the default setting ViewMatrix->Automatic, the matrices {t,p} are found automatically from the settings for options such as ViewPoint, ViewVertical, and ViewAngle.
  • AbsoluteOptions gives the explicit matrices used by ViewMatrix->Automatic.
  • An explicit setting ViewMatrix->{t,p} overrides settings for ViewVector, ViewPoint, and other view options.

Examples

open allclose all

Basic Examples  (2)

Define a rescaling transform t:

Define an orthographic projection p from the front:

Display a 3D object using the orthographic view:

Define a transform t that rotates an object 45° around and axes, then rescales it:

Define an orthographic projection p from the negative direction:

Display a 3D object using the orthographic view:

Scope  (2)

Transformation matrices with different rotation angles around the axis:

Orthographic projections from different sides:

Applications  (1)

Oblique Projection  (1)

Draw a simple 3D bar chart:

Define a rescaling transform matrix that rescales the bar charts into a unit cube:

Define an orthographic view matrix from the front:

Define an oblique projection matrix with an angle t and a scaling factor s:

Display the projected bar chart:

Properties & Relations  (1)

Define a transformation function with rotations and rescaling:

Define an orthographic projection matrix from the front:

Show the orthographic view with lighting from the front to the center, using ViewMatrix:

The same result can be achieved by using an explicit ViewPoint and transforming 3D objects and lighting:

Wolfram Research (2007), ViewMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/ViewMatrix.html (updated 2010).

Text

Wolfram Research (2007), ViewMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/ViewMatrix.html (updated 2010).

CMS

Wolfram Language. 2007. "ViewMatrix." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/ViewMatrix.html.

APA

Wolfram Language. (2007). ViewMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ViewMatrix.html

BibTeX

@misc{reference.wolfram_2024_viewmatrix, author="Wolfram Research", title="{ViewMatrix}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ViewMatrix.html}", note=[Accessed: 14-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_viewmatrix, organization={Wolfram Research}, title={ViewMatrix}, year={2010}, url={https://reference.wolfram.com/language/ref/ViewMatrix.html}, note=[Accessed: 14-November-2024 ]}