Re: Using a different type of projection matrix in Direct3D?
- From: "ola.theander@xxxxxxxxxxxx" <ola.theander@xxxxxxxxxxxx>
- Date: Tue, 30 Oct 2007 16:58:10 -0700
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
.
- Follow-Ups:
- Re: Using a different type of projection matrix in Direct3D?
- From: Richard [Microsoft Direct3D MVP]
- Re: Using a different type of projection matrix in Direct3D?
- References:
- Using a different type of projection matrix in Direct3D?
- From: ola.theander@xxxxxxxxxxxx
- Re: Using a different type of projection matrix in Direct3D?
- From: Richard [Microsoft Direct3D MVP]
- Using a different type of projection matrix in Direct3D?
- Prev by Date: Re: Using a different type of projection matrix in Direct3D?
- Next by Date: Re: Simple rendering/transformation problem
- Previous by thread: Re: Using a different type of projection matrix in Direct3D?
- Next by thread: Re: Using a different type of projection matrix in Direct3D?
- Index(es):
Relevant Pages
|
Loading