正交和透视相机问题 [英] Orthographic and Perspective Camera issue

查看:46
本文介绍了正交和透视相机问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此图像使用透视相机,但球体在远离中心时会变形.

This image is using perspective camera but sphere shape is distorted when it is moving away from the center.

此图像使用正交相机,但球体和长方体不是 3D...

this image is using Orthographic camera but spheres and cuboid are not in 3D...

任何人都可以为此提出可能的解决方案以获得 3D 效果而不会使球体扭曲其形状...

can any one suggest possible solution for this to get 3D effect without sphere distorting its shape...

推荐答案

这完全正确.球体畸变和长方体透视效果都是由相同的透视投影属性引起的.

This is exactly correct. Spheres distortion and cuboid perspective effect are both caused by the same perspective projection properties.

一种可能的解决方案是将场景分成两部分:

One possible solution would be to split your scene in two parts:

  • 使用透视投影渲染背景(长方体)
  • 使用正交投影渲染球体

另一种解决方案是用正字法绘制所有内容并将长方体修改为梯形,这样它只会看起来处于透视状态.

Another solution would be to draw everything with orthographic and modify your cuboid to be a trapezoid, so that it only looks like to be in perspective.

如果你仔细想想,拥有视角和没有扭曲听起来是相互排斥的.想象一个球体由两部分组成 - 前部和后部.现在你说你需要离相机更远的物体更小,但同时你说你希望球体的前后尺寸相同 - 不可能.如果您手动将球体尺寸指定为在距离较远时更小,则可以通过正交投影实现所需的效果.或者,您可以使用透视投影并按深度轴将球体缩放为平坦(但保持法线以保持适当的照明)

Having perspective and no distortions sounds mutually exclusive if you think about it. Imagine a sphere consists of 2 parts - front and rear. Now you say you need objects farther from camera to be smaller, but at the same time you say you want front and rear of sphere to be the same size - not possible. You can achieve desired effect with orthographic projection if you manually specify spheres size to be smaller when they are farther. Or alternatively you can use perspective projection and scale your spheres to be flat by depth axis (but keep the normals to preserve proper lighting)

这篇关于正交和透视相机问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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