# DX11 Why is this 1?

This topic is 1233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Image Source: Frank D. Luna's DX11 book.

BTW, can anyone please explain me directx projection matrix and how it's derived.

Edited by newtechnology

##### Share on other sites

I'm horrible at math so we can hope that someone that knows more soon answers . I think that the 1 i related to that the DirectX clipping volume ranges from -1.0 to 1.0. So whatever you set the other values to it needs to work with the 1 there.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb206341%28v=vs.85%29.aspx . Search for clipping volume.

Ohh that was DX9 i see know. Might be changed with 11.

Edited by Spinningcubes

##### Share on other sites

That means this whole thing is 2?

Edited by newtechnology

##### Share on other sites

Like Olaf says, its convention and has nice properties WRT how floating point works (namely, there is as much precision betwen 0 and 1 as there is between 1 and the largest number the floating point format can represent).

Those are the normalized device coordinates (NDC).

##### Share on other sites

Yes, 2 units from top to bottom and from left to right, by convention ranging from -1 to +1 in both axis (again, what I said about precision between 0 and 1 above is also true for 0 to -1. In floating point, the numbers between -1 and +1 encompass exactly half of all the values the format can represent.)

##### Share on other sites

by convention ranging from -1 to +1 in both axis

That's correct with regard to range.

Just to be clear, the ( x, y ) screen coordinates that result are ( -1, +1 ) at the upper-left to ( +1, -1 ) at the lower-right. That represents a Cartesian system with the origin at center-screen, with -X to the left, +Y up, +X to the right, and -Y down.

##### Share on other sites

It's called screen space and is the final result of your transformations.

The vertices of your objects are transformed from object-local space to world space through the world matrix, so the model is correctly positioned and rotated in the game world.

Then they are transformed again by the View Matrix into view space which means they are now correctly position relative to the camera.

All these spaces so far are in standard 3d cartesian coordinates ranging from 0 to INF on all 3 axis.

Now as final step through the Projection Matrix the object is transformed into projection space which is a normalized cube with coordinates from -1 to 1 on all sides.

If you flatten this cube to a square you get the Screen Space which is in normalized device coordinates and therefore by definition ranging from -1 to 1 on both X and Y axis.

You can for example draw an image to full screen by sending it to the GPU as a quad with XY coordinates 1/1, 1/-1, -1/-1 and -1/1 and applying no transformation.

This is called screen space rendering

##### Share on other sites

DirectX uses a coordinate system like this, ultimately:

The projection matrix flattens your 3D view-space coordinates into Normalized Device Coordinates.

##### Share on other sites

I think it's kind of confusing showing the normalised device coordinates on the same diagram as the view frustum.

It seems like a somewhat separate concept to me, and there's no reason that projection window line couldn't sit to the right of the near plane, or even to the right of the far plane!

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633695
• Total Posts
3013376
×