07-16-2003, 07:47 PM

I'm attempting to implement an effect that will be like forcing all rendering to be projected onto a specified plane and clipped to a specified reason probably using the stencil test. This effect would be used for simulating video screens or something of that nature.

My theory is:

The vertex starts in objectspace.

Multiplied by the modelview matrix, it is now in worldspace.

(marker here)

Multiplied by the projection matrix, it is now in viewspace.

...

At the marker, I need to transform the point given in worldspace into a point on the plane that is also in worldspace. Since it occurs directly between the modelview and projection transformation, it occured to me I could either multiply the projection matrix (freshly loaded with an identity matrix at the beginning of the frame) by the matrix that would project points to the plane, or I could do it after all modelview transformations by multiplying that matrix by the new one.

I'm sure both ways have their merits, and even the red book suggests using the projection matrix to force rendering to flatten to a plane.

I am aware of depth test issues with this, but I'll work with that later. I have a matrix that almost seems to work given some parameters; I'm working some errors out of that.

My question is, am I on a good track for this idea?

My theory is:

The vertex starts in objectspace.

Multiplied by the modelview matrix, it is now in worldspace.

(marker here)

Multiplied by the projection matrix, it is now in viewspace.

...

At the marker, I need to transform the point given in worldspace into a point on the plane that is also in worldspace. Since it occurs directly between the modelview and projection transformation, it occured to me I could either multiply the projection matrix (freshly loaded with an identity matrix at the beginning of the frame) by the matrix that would project points to the plane, or I could do it after all modelview transformations by multiplying that matrix by the new one.

I'm sure both ways have their merits, and even the red book suggests using the projection matrix to force rendering to flatten to a plane.

I am aware of depth test issues with this, but I'll work with that later. I have a matrix that almost seems to work given some parameters; I'm working some errors out of that.

My question is, am I on a good track for this idea?