Re: Using a different type of projection matrix in Direct3D?



On Oct 31, 12:39 am, legalize+jee...@xxxxxxxxxxxxxxxxx (Richard
[Microsoft Direct3D MVP]) wrote:
[Please do not mail me a copy of your followup]

"ola.thean...@xxxxxxxxxxxx" <ola.thean...@xxxxxxxxxxxx> spake the secret code
<1193762143.950247.6...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> thusly:

I have been thinking about if it's possible to use another type of
projection transform with Direct3D apart from the standard canonical
view transform that you get from the Matrix.PerspectiveFovLH() method
(Managed Direct3D).

You can use any matrix you want, but unfortunately some card/driver
combinations may become confused by non-standard matrices. If they
become confused, its a bug. You should be able to use any projection
you want as long as it can be specified in a 4x4 homogeneous
transformation matrix. If you need more exotic projection, then
you'll have to write a vertex shader (and possibly a pixel shader) to
perform the projection.

The canonical view transform transforms the

viewing cone to a cube where every viewing ray is parallel.

Its a frustum, not a cone, and the viewing rays are only parallel in
an orthographic projection, but yes.

Now assume that another type of projection matrix is used, e.g. the
classical (naive) projection where you do division by the z-coordinate
to project the vertex onto the image plane typically located at z=1.
Would this cause the rendering to flip out, i.e. I figure that maybe
the later steps in the rendering pipeline responsible for clipping etc
assumes that output from the vertex shader is a homogeneous [4 x 1]-
vector transformed into the canonical view volume, or is the rendering
actually so flexible that this kind of variations doesn't matter. I
know for instance that the canonical view volume used by OpenGL isn't
the same volume as used by Direct3D. OpenGL transforms the near- and
far-plane to the z-coordinate span [-1, 1] while Direct3D transforms
them to [0, 1].

The transformation is of the same type, just the extents are
different. It really isn't that much of a difference at all.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>

Hi Richard

Thank you for your answer. I mixed up some of the terminology like
viewing cone and frustum, which I shouldn't have. But anyway, I've got
the answer to my basic question.

If I understand you correctly, assuming I write a custom vertex- and
pixel-shader, there is nothing that's preventing me from using a
totally custom scheme for the projection & world representation. I
might event use a 3x3-projection matrix, i.e. non-homogenous
coordinates if I find that suitable without messing up the rendering
pipeline.

/Ola

.



Relevant Pages

  • Using a different type of projection matrix in Direct3D?
    ... projection transform with Direct3D apart from the standard canonical ... view transform that you get from the Matrix.PerspectiveFovLHmethod ... projected by a parallel projection to generate the final image viewed ... This represents my view of how the rendering pipeline ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Obtaining 2d shape from perspective image
    ... information from a 2D perspective projection image? ... "downcast" from homogeneous coordinates to normal coordinates. ... transform is the "divide by w": ... To invert this operation, that is, to get from screen coordinates to ...
    (comp.graphics.algorithms)
  • Re: correlation of rotated image with perspective
    ... transform, but it's the distortion from perspective thats really ... perspective projection, orientation and distance from the landing pad ... as a single mser. ... baseline stereo from maximally stable extremum regions". ...
    (sci.image.processing)
  • Re: Normalization XYZ -> xyz
    ... transform. ... My second "suggestion" would be a projection onto a sphere in R^3, again having the same property is mapped to a single point on the sphere), the same holds for the first suggestion. ... is the plane through parallel to X,Z (a plane normal is given ... Again, k*X, k*Y, k*Z delivers the same chromaticities x',y',z' for any ...
    (sci.engr.color)
  • Re: Using a different type of projection matrix in Direct3D?
    ... view transform that you get from the Matrix.PerspectiveFovLHmethod ... You should be able to use any projection ... Would this cause the rendering to flip out, ... the same volume as used by Direct3D. ...
    (microsoft.public.win32.programmer.directx.graphics)

Loading