PDA

View Full Version : projecting from fixed size image on plane



mordrax
08-23-2005, 03:41 AM
I have a projection point(camera location), a fov, a focal length, a image plane and the objects in 3d space.

I have been given the image on the image plane and want to backproject it into 3d space. The texture will only cover a single 2d quad at a given distance away from the projection point.

Summary: Projection from a image plane onto another plane further away.

I'm trying to do this with projective texturing, does this make sense?
Does it make sense to project each vertex of the image using gluUnProject?

I have a feeling I cannot specify the image plane, because with opengl, i have the camera, project matrix, modelview matrix and quad that i'm projecting onto... but i don't have a physical image plane from whence my image comes from. This is the source of my confusion.

Joe.

Obli
08-23-2005, 09:37 AM
Well, I'm not sure I'm getting this right.


Originally posted by mordrax:
The texture will only cover a single 2d quad at a given distance away from the projection point.Err... so you're not meaning you want to 'project' it as a projector would?

Originally posted by mordrax:
Summary: Projection from a image plane onto another plane further away.I am (mis?)understanding this is "large enough" to cover the whole viewport.
It doesn't matter, projective texturing will cut it even with arbitrary geometry.

Originally posted by mordrax:
I'm trying to do this with projective texturing, does this make sense?Yes, altough it's probably overkill for the purpose.

Originally posted by mordrax:
Does it make sense to project each vertex of the image using gluUnProject?If you mean to project the vertex of the plane "being textured" to check where it falls of and then feedback the texcoords accordingly... well, maybe it works but I believe it would be sub-optimal.
You possibly won't see a performance difference for now, but I'll go straight for projective texturing, which is much more general.

Originally posted by mordrax:
I have a feeling I cannot specify the image plane, because with opengl, i have the camera, project matrix, modelview matrix and quad that i'm projecting onto... but i don't have a physical image plane from whence my image comes from. This is the source of my confusion.You are partially right, the trick is made using a texture matrix, loading up... (take this with some salt) a lookup.
So, for example, if projector is at P looking at L you put in the matrix this lookAt transformation and then use it as a TexGen.
Take my words with some salt, I'm not really sure how projective texturing works in the fixed function pipes and some years ago I made it work thuru a fragment program.
I'm quite sure you can easily do it from a vertex program as well, I don't remember why I didn't do it.

Hlz
08-23-2005, 10:32 AM
http://www.opengl.org/resources/tutorials/advanced/advanced97/notes/node33.html
http://www.opengl.org/resources/tutorials/advanced/advanced97/notes/node67.html
http://www.opengl.org/resources/tutorials/advanced/advanced96/blythe/projtex.c

Should be a demo or 2 here:
http://download.developer.nvidia.com/developer/SDK/Individual_Samples/samples.html