File size: 4,329 Bytes
d8ab1df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
CameraUtil module — pxr-usd-api 105.1 documentation
pxr-usd-api
»
Modules »
CameraUtil module
# CameraUtil module
Summary: Camera Utilities
Camera utilities.
Classes:
ConformWindowPolicy
Framing
Framing information.
ScreenWindowParameters
Given a camera object, compute parameters suitable for setting up RenderMan.
class pxr.CameraUtil.ConformWindowPolicy
Methods:
GetValueFromName
Attributes:
allValues
static GetValueFromName()
allValues = (CameraUtil.MatchVertically, CameraUtil.MatchHorizontally, CameraUtil.Fit, CameraUtil.Crop, CameraUtil.DontConform)
class pxr.CameraUtil.Framing
Framing information. That is information determining how the filmback
plane of a camera maps to the pixels of the rendered image
(displayWindow together with pixelAspectRatio and window policy) and
what pixels of the image will be filled by the renderer (dataWindow).
The concepts of displayWindow and dataWindow are similar to the ones
in OpenEXR, including that the x- and y-axis of the coordinate system
point left and down, respectively.
In fact, these windows mean the same here and in OpenEXR if the
displayWindow has the same aspect ratio (when accounting for the
pixelAspectRatio) as the filmback plane of the camera has (that is the
ratio of the horizontalAperture to verticalAperture of, e.g., Usd’s
Camera or GfCamera).
In particular, overscan can be achieved by making the dataWindow
larger than the displayWindow.
If the aspect ratios differ, a window policy is applied to the
displayWindow to determine how the pixels correspond to the filmback
plane. One such window policy is to take the largest rect that fits
(centered) into the displayWindow and has the camera’s aspect ratio.
For example, if the displayWindow and dataWindow are the same and both
have an aspect ratio smaller than the camera, the image is created by
enlarging the camera frustum slightly in the bottom and top direction.
When using the AOVs, the render buffer size is determined
independently from the framing info. However, the dataWindow is
supposed to be contained in the render buffer rect (in particular, the
dataWindow cannot contain pixels withs negative coordinates - this
restriction does not apply if, e.g., hdPrman circumvents AOVs and
writes directly to EXR). In other words, unlike in OpenEXR, the rect
of pixels for which we allocate storage can differ from the rect the
renderer fills with data (dataWindow).
For example, an application can set the render buffer size to match
the widget size but use a dataWindow and displayWindow that only fills
the render buffer horizontally to have slates at the top and bottom.
Methods:
ApplyToProjectionMatrix(projectionMatrix, ...)
Given the projectionMatrix computed from a camera, applies the framing.
IsValid()
Is display and data window non-empty.
Attributes:
dataWindow
displayWindow
pixelAspectRatio
ApplyToProjectionMatrix(projectionMatrix, windowPolicy) → Matrix4d
Given the projectionMatrix computed from a camera, applies the
framing.
To obtain a correct result, a rasterizer needs to use the resulting
projection matrix and set the viewport to the data window.
Parameters
projectionMatrix (Matrix4d) –
windowPolicy (ConformWindowPolicy) –
IsValid() → bool
Is display and data window non-empty.
property dataWindow
property displayWindow
property pixelAspectRatio
class pxr.CameraUtil.ScreenWindowParameters
Given a camera object, compute parameters suitable for setting up
RenderMan.
Attributes:
fieldOfView
float
screenWindow
Vec4d
zFacingViewMatrix
Matrix4d
property fieldOfView
float
The field of view.
More precisely, the full angle perspective field of view (in degrees)
between screen space coordinates (-1,0) and (1,0). Give these
parameters to RiProjection as parameter after”perspective”.
Type
type
property screenWindow
Vec4d
The vector (left, right, bottom, top) defining the rectangle in the
image plane.
Give these parameters to RiScreenWindow.
Type
type
property zFacingViewMatrix
Matrix4d
Returns the inverse of the transform for a camera that is y-Up and
z-facing (vs the OpenGL camera that is (-z)-facing).
Write this transform with RiConcatTransform before RiWorldBegin.
Type
type
© Copyright 2019-2023, NVIDIA.
Last updated on Nov 14, 2023.
|