PDA

View Full Version : Can OpenGL handle nonrectangular pixel distr?



Gurra
02-27-2012, 11:20 AM
I've been wondering something. Assume I have a screen which has a nonrectangular pixel distribution: for example a setup where each pixel is separated to the next by a constant angle rather than the standard constant distance on the screen.

http://www.imagetrendsinc.com/images/products/tech_hemi_09.jpg

Is it possible to create a projection matrix and or viewport transformation that can handle such a screen?
(Imagine a projector which produces a pincussion like image)

My conclusion is that it is not possible to do with R4 matrix multiplication - I cannot see any way of projecting a point r = Mv*r0, such that rp = P * r cancels out the pincussion effect of this specific pixel distribution.

The only way I see of doing this is to assume a rectangular screen and then as a last step squeeze the framebuffer information to cancel out the pixel distribution (thus losing some details in the edges)

mbentrup
02-28-2012, 01:47 AM
Is it possible to create a projection matrix and or viewport transformation that can handle such a screen?
(Imagine a projector which produces a pincussion like image)

The projection matrix can only describe so called projective transformations which are more general than linear or affince transformations, but they still map straight lines to straight lines.

However, you can use *any* transformation in vertex shaders, so transforming the vertices to this pincussion geometry would be possible. This would only transform the vertices, the rasterizer would still produce linear triangles, so you'll need a high tesselation factor to make this look smooth.

ZbuffeR
02-28-2012, 02:37 AM
It is better to keep projective transformation in the vertex shader, then once image is rendered, use as a texture and sample using whatever transformation in a new fragment shader.

squeeze the framebuffer information to cancel out the pixel distribution (thus losing some details in the edges)
If you carefully adjust the original projection to render a slightly larger image, you will not loose any detail.

Gurra
02-28-2012, 10:55 AM
Thank you both. Your answers were most helpful :).