Jambolo

02-26-2002, 07:08 PM

It is written in many places that the Z value of a point is transformed to the range 0 to 1 by the projection matrix. But when I do the math myself, I get -1 to 1. What's up?

Transform the point (0,0,-n ):

| 2n/(r-l) 0 (r+l)/(r-l) 0 | | 0 | | 0 |

| | | | | |

| 0 2n/(t-b) (t+b)/(t-b) 0 | | 0 | | 0 |

| | | | = | |

| 0 0 -(f+n)/(f-n) -2fn/(f-n) | |-n | |-n |

| | | | | |

| 0 0 -1 0 | | 1 | | n |

= (0,0,-1)

(assuming l = -r and t = -b)

Transforming ( 0,0,-f) gives (0,0,1)

Z goes from -1 to 1?!?!? What is the source of my confusion?

[This message has been edited by Jambolo (edited 02-26-2002).]

Transform the point (0,0,-n ):

| 2n/(r-l) 0 (r+l)/(r-l) 0 | | 0 | | 0 |

| | | | | |

| 0 2n/(t-b) (t+b)/(t-b) 0 | | 0 | | 0 |

| | | | = | |

| 0 0 -(f+n)/(f-n) -2fn/(f-n) | |-n | |-n |

| | | | | |

| 0 0 -1 0 | | 1 | | n |

= (0,0,-1)

(assuming l = -r and t = -b)

Transforming ( 0,0,-f) gives (0,0,1)

Z goes from -1 to 1?!?!? What is the source of my confusion?

[This message has been edited by Jambolo (edited 02-26-2002).]