模拟球形广告牌的变形 [英] Simulate Distortion of Spherical Billboard

查看:167
本文介绍了模拟球形广告牌的变形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要制作球形广告牌(即设定深度),但要考虑透视投影 - 理想情况下包括偏离中心的截屏。

我没有能够找到任何成功的人参考 - 尽管有很多解释为什么标准广告牌没有视角扭曲。不幸的是,对于我的申请来说,缺乏并不是一个表面缺陷;这对算法来说非常重要。



我自己做了一些调查:


数学变得相当凌乱,相当迅速。显而易见的方法不起作用:例如,您不能将广告牌定向为垂直于观看光线,因为切向光线不会以直角与广告牌相交。

我发现的最有前途的方法可能是让广告牌平行于近剪裁平面,并用顶点着色器将其展开成一个椭圆。这只能处理沿一个轴的扰动(所以它不能处理渲染在视图角落的球体),但主要障碍是正确计算深度;你不能像计算未失真球体那样计算它,因为球体会遮住它本身。


事实上,I没有找到一个好的解决方案,我找不到任何人。任何人都有想法?

解决方案

在浏览这个问题时甚至没有进行远程处理,我偶然发现了 http://iquilezles.org/www/articles/sphereproj/sphereproj.htm ,这非常接近。链接教程展示了如何计算光栅化球体的边界椭圆;获得深度(最糟糕的是,使用raycast)应该很容易推导出来。


I need to make spherical billboards (i.e., setting depth), but taking into account perspective projection--ideally including off-center frusta.

I wasn't able to find any references to anyone succeeding at this--although there are plenty of explanations as to why standard billboards don't have perspective distortions. Unfortunately, for my application, the lack isn't a cosmetic defect; it's actually important to the algorithm.

I did a bit of investigation on my own:

The math gets pretty messy rather quickly. The obvious approaches don't work: for example, you can't orient the billboard perpendicular to a viewing ray because tangential rays wouldn't intersect the billboard at right angles.

Probably the most promising approach I found was to render the billboard parallel to the near clipping plane, stretching it with a vertex shader into an ellipse. This only handles perturbations along one axis (so e.g. it won't handle spheres rendered in a corner of the view), but the main obstacle is calculating depth correctly; you can't compute it as you would for an undistorted sphere because the "sphere" is occluding itself.

Point of fact, I didn't find a good solution, and I couldn't find anyone who has. Anyone have an idea?

解决方案

While browsing around not even remotely working on this problem, I stumbled on http://iquilezles.org/www/articles/sphereproj/sphereproj.htm, which is pretty close. The linked tutorial shows how to compute a bounding ellipse for a rasterized sphere; getting the depth (at worst, using a raycast) should be fairly easy to derive.

这篇关于模拟球形广告牌的变形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆