How accurate are gluProject and gluUnproject?

Im working on an image-based-rendering project.

Im projecting the current screen image using gluUnproject to get the 3D coordinates. Im then changing viewpoint and using gluProject to project the points back onto screen pixels. A lot of points are being mapped to the same pixel.

To test it I didn’t change the viewpoint at all. The resulting image contained a lot of black pixels (background colour) so it does appear that in many cases several 3D points are being mapped to only a single pixel. This is without changing the viewpoint. I would have expected an identical image to be produced (projecting points, then doing the opposite should give the initial image). Anyone experienced similar or have any suggestions.

thanks.

One of the exaplantions could be that gluProject returns window X,Y co-ords. But these values are floats. Im rounding up/down to nearest integer to get screen pixel (also of course changing the Y co-ordinate to OPenGL Y co-ordinate). Is there any solution?

[This message has been edited by rangers99 (edited 03-05-2002).]

I don’t understand why you need more accuracy than a pixel.

However, something similiar happened to me. I do not need such accuracy but sometimes when points are very close to eachohter, I might capture only one point at each pixel. I think the best way is to test z coordinate and choose the one closest to the front. Another possibility is to ask the user.

Billy

gluProject returns floats for the winx,winz coordinates. So something like (86.7, 59.4). I dont know if this is where the “error” is coming from.

I would have expected to re-create an image perfectly using gluUnproject, then doing the reverse operation with gluProject. Not the case, Im getting quite a few many points-to-one pixel mappings.