## Recent topics-
*25 weeks 6 days*ago -
*45 weeks 1 day*ago -
*1 year 17 weeks*ago -
*1 year 26 weeks*ago -
*1 year 36 weeks*ago
## Recent Comments |
## shifting the projection planehi, does anyone know if its possible to 'shift' the projection plane (or however its called) so that its not centered but rather, above or below the camera (like illustrated in the attachment). i guess if its possible its possible with the matrix stuff from GLtools or in a glsl shader, but im a bit clueless about which matrix to change. i want to use this to try some mapping with a projector but unlike a camera the the projectors eye position is not aligned with the center of the image. also, anyone know what the eye coordinate is with the default camera in QC? ## More like this |

This is called an "asymmetric frustum". It's possible with the Matrix patches.

You'll have to dig into some math -- there's not really any other way, unfortunately.

If you're comfortable reading mathematical documentation, the formulas are described here: http://www.cs.kuleuven.ac.be/cwis/research/graphics/INFOTEC/viewing-in-3... (search for "The complete asymmetrical perspective projection matrix is").

default eye coord is 0 on x and y, and +1 on z (looking at 0,0,0), with Up being the positive Y axis and Right being the positive X axis.

Ah... does that mean that, if I'm working on a GLSL shader that requires an eye-position, that I should assume that to be at vec3(0.0) or vec3(0.0,0.0,1.0), if the vertices have been transformed by the ModelViewProjectionMatrix?

a|x

you should assume that it's at vec3(0,0,1)

I had always assumed that the eye was at vec3(0.0) in the past. That explains why the velvet shader, and a few others that need an eye position, always looked a bit strange...

Cheers,

a|x

thanx a lot. a really useful page:). made a lot of things much clearer.

i have read the thing back and forth and so far i understand it like this: i have to use the load matrix patch, enter the correct parameters and load it as a projection matrix. the only thing im not sure about is, are the xright,xleft,ytop and ybottom params for the matrix at zfront? i think they are but im not really a math person so...:).

You're right, in that you need to use the load matrix patch.

The matrix function itself is just using the numbers as ratios for the most part, so their position doesn't matter so much. There are a couple that use zfront though, so I'd imagine using proper top/right values at zfront would yield proper results.