Take the 2-minute tour ×

This question may look pretty simple, but I cannot find how HLSL handles its own coordinates system.

I only wish to know where is (0,0) located (Upper left corner or lower left corner), and since I am a total beginner with these shaders concepts, I am unable to deduct it by myself

Thanks for your help!

share|improve this question
This has nothing to do with the language you use to access DirectX. –  DeadMG May 29 '12 at 18:58
add comment

2 Answers

up vote 4 down vote accepted

I believe you want to understand DirectX's coordinate system. HLSL is a shading language and doesn't define a co-ordinate space to work in.

Here are a couple of links to get you started.

  1. Coordinate system
  2. Pixel and Texture coordinate systems
share|improve this answer
Thanks for the info, much appreciated! –  zeroxgames May 30 '12 at 16:00
add comment

In the vertex shader you can work with several coordinate systems or spaces...

usually your vertex data arrive at world coordinates...

then vertex data is transformed by WordViewProjection matrix, that tranform from world coordinates to homogeneus projected coordinates, this is the value returned in the vertex shader...

If the vertex is inside the screen, if you divide the x and y coordinates by the w component, you will get a point in range(-1..1,-1..1) ... I'm not sure but I think (-1,-1) is upper left... you only have to test it

you can send to the graphics card two triangles representing a quad with the screen corners in this space (-1,-1,0), (1,-1,0), (1,1,0), (-1,1,0), this way you don't need to transform vertex data by any matrix.

You have not explained what you want to do.. but I suppose you want to do a post process...

If is the case... you can work in the pixel shader with texture coordinates... this way the upper left point will be (0,0) and the right bottom point will be (1,1)

Here you can find code and an extended explanation: http://ploobs.com.br/?p=1092

share|improve this answer
add comment

Your Answer


