Virtual Reality (VR) applications often involve a post-processing step
to apply a “barrel” distortion to the rendered image to correct the
“pincushion” distortion introduced by the optics in a VR device. The
barrel distorted image has lower resolution along the edges compared to
the center. Since the original image is rendered at high resolution,
which is uniform across the complete image, a lot of pixels towards the
edges do not make it to the final post-processed image.
This extension provides a mechanism to render VR scenes at a non-uniform
resolution, in particular a resolution that falls linearly from the
center towards the edges. This is achieved by scaling the w coordinate
of the vertices in the clip space before perspective divide. The clip
space w coordinate of the vertices can be offset as of a function of x
and y coordinates as follows:
w' = w + Ax + By
In the intended use case for viewport position scaling, an application
should use a set of four viewports, one for each of the four quadrants
of a Cartesian coordinate system. Each viewport is set to the dimension
of the image, but is scissored to the quadrant it represents. The
application should specify A and B coefficients of the w-scaling
equation above, that have the same value, but different signs, for each
of the viewports. The signs of A and B should match the signs of x and y
for the quadrant that they represent such that the value of w' will
always be greater than or equal to the original w value for the entire
image. Since the offset to w, (Ax + By), is always positive, and
increases with the absolute values of x and y, the effective resolution
will fall off linearly from the center of the image to its edges.
vkCmdSetViewportWScalingNV - Set the viewport W scaling dynamically for
a command buffer
Description
The viewport parameters taken from element i of pViewportWScalings
replace the current state for the viewport index firstViewport + i,
for i in [0, viewportCount).
pViewportWScalings is a pointer to an array of ViewportWScalingNV
structures defining the W scaling parameters for the corresponding
viewports. If the viewport W scaling state is dynamic, this member
is ignored.