简体   繁体   English

Xna / OpenGL中的鱼眼投影矩阵 - 3D

[英]Fisheye projection matrix in Xna/OpenGL - 3D

I'm looking for a projection matrix I can use in 3D that will give me the effect of a fisheye. 我正在寻找一个可以在3D中使用的投影矩阵,这将给我一个鱼眼的效果。 I'm not looking for a pixelshader or anything like that, that will manipulate pixels - but the actual projection matrix used in projecting from 3D space onto 2D. 我不是在寻找像素笔或类似的东西,它会操纵像素 - 而是用于从3D空间投影到2D上的实际投影矩阵。

Thanks. 谢谢。

That's not really possible. 那不太可能。 In homogeneous coordinates, matrices transform lines to lines. 在齐次坐标系中,矩阵将线条转换为线条。 So any solution based solely on matrices will necessarily fail to bend lines like you want to. 因此,任何仅基于矩阵的解决方案都必然无法像您希望的那样弯曲线条。

Carlos没错,但您可能想尝试使用投影矩阵构建器中的“视野(FOV)”参数。

Carlos is right. 卡洛斯是对的。 There is a way your could fake it, but you will have to re-render your scene multiple times. 有一种方法可以伪造它,但你必须多次重新渲染你的场景。

Basically, you start by figuring out how to do two point perspective. 基本上,你首先要弄清楚如何做两点观点。 Which I would do by rendering the scene twice with a projection matrix that has a vanishing point on alternating sides. 我将通过在交替的边上具有消失点的投影矩阵渲染场景两次来做。 Then you combine the two parts, I guess using a stencil map. 然后你将两个部分结合起来,我想使用模板图。

You could do something like four point perspective combining images with four vanishing points. 你可以做一些像四点透视,将图像与四个消失点相结合。 You repeat that process as many times. 你多次重复这个过程。

What your doing then is projecting onto a polygon that approximates a sphere. 然后你做的是投射到近似球体的多边形上。

I could explain more, but my guess is it sounds too complicated. 我可以解释得更多,但我的猜测听起来太复杂了。

The simplest way to fake it is to render to a texture and distort the image, and render it as a fullscreen quad. 伪造它的最简单方法是渲染纹理并扭曲图像,并将其渲染为全屏四边形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM