English 中文(简体)
开放式GL - gluPerspective / glFrustum - zNear & zFar problems
原标题:OpenGL - gluPerspective / glFrustum - zNear & zFar problems

I m 撰写空间探索申请。 我先决定轻年是这些单位,并准确模拟星之间的距离。 tin缩和大量艰苦的工作(主要是学习pes) 我从穿过宇宙的饥饿探测器的角度来看,穿过照相机。

起初,在我从事行星目标工作之前,我没有注意红树脂(zNear)参数。 由于我的规模是轻年,我很快认识到,由于zNear是1.0f 我无法看到这些物体。 经过试验,我得出了这些数字:

#define POV 45
#define zNear 0.0000001f
#define zFar 100000000.0f
gluPerspective (POV, WinWidth/WinHeight, zNear ,zFar);

这样做非常好,因为我能够巡航我的太阳系统(0,0层),并靠近位于高纬度和图形的地球。 然而,其他系统(不是0,0级)更难通过巡航,因为物体以不同寻常的方式从照相移。

然而,我注意到,在穿透宇宙时,开始出现奇怪的视像。 如果我把180度的Y方向推到他们原来的位置,那么我后面的物体就将总结并展示出来。 因此,在通过空间进行饱和时,大多数星体都是正确松散的,但有些星上和行走方向相反(令人不安的是最少)。

通过将zNear改变为0.1f,立即纠正所有这些冰川(但同时也赢得了太阳系目标)。 因此,我 m。 我也尝试与冰川合作,结果完全相同。

我以以下方式看待世界:

glTranslatef(pos_x, pos_y, pos_z);

有了相关的照相机码,可以按要求进行定位。 甚至破碎的照相机功能也没有任何变化。 我甚至尝试了格卢克(LookAt)并再次得出同样的结果。

使用极端的zNear /zFar 值时,是否会有限制? 我试图缩小范围,但徒劳无益。 我甚至把我们的世界单位从轻年改为千米,扩大一切,使用更大的zNear值——无。 HELP!

问题回答

问题是,你想要同时解决太多问题。 你希望了解太阳系的规模,同时具有半导体规模。 这根本是不可能的。 不是实时提供。

只有如此之多的浮动点精确。 和您的zNear为incredib。 最后,你基本上摧毁了你远离照相机约0.0001的深度缓冲。

你们需要做的是根据距离提取东西。 采用一个深度范围(即0至0.8)的近物体(太阳能系统尺度)。 然后用不同的视角矩阵和不同深度范围(0.8至1)。 这确实是你恢复这项工作的唯一途径。

另外,您或许需要用双重计算数计算CPU的物体的矩阵,然后将其转化为开放式计算器的单一精度。

开放式广播公司不得远比ZFar,或比zNear更靠近照相机。

但是,对于双方之间的事物,开放式自由工计算其深度缓冲储存的深度价值,用来说明一个物体是否阻挡另一个物体。 不幸的是,深度缓冲的精确度(一般为16或24比)有限,根据,这种精确度约为2zFar/zNear) 。 因此,ZFar/zNear比率为10^15(损失了约50比特),必然会造成问题。 一种选择是稍微增加zNear(如果你能够的话)。 否则,你需要看Split Depth Buffers或Logarithic Depth Buffers

Nicol Bolas already told you one piece of the story. The other is, that you should start thinking about a structured way to store the coordinates: Store the position of each object in relation to the object that dominates it gravitatively and use apropriate units for those.

因此,你有星号。 恒星之间的状况按光年测量。 星号按行星轨道运行。 饥饿系统内的情况是用灯光灯对照明时间进行测量的。 地球由月球轨道。 行星系统的情况是参照的。

为了显示这种比额表,你需要多张通行证。 标尺为树。 首先,你把分支机构划为遥远的分支,然后,你首先tra倒树木深度。 对于每个分支级,你都使用一个适当的预测参数,使近亲的脂肪计划与将要成为的物体相匹配。 每一层次都清楚明了深度缓冲。





相关问题
OpenGL 3D Selection

I am trying to create a 3D robot that should perform certain actions when certain body parts are clicked. I have successfully (sort of) implemented picking in that if you click on any x-plane part, it ...

CVDisplayLink instead of NSTimer

I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note https://developer.apple.com/library/archive/qa/qa1385/_index.html Is it ...

Can the iPhone simulator handle PVR textures?

I have a really weird problem with PVR textures on the iPhone simulator- the framerate falls through the floor on the iPhone simulator, but on the iPhone itself it works just fine. Has anyone had any ...

Calculate fps (frames per second) for iphone app

I am using an opengl es iphone application. What is the most accurate way to calculate the frames per second of my application for performance tuning?

Java - Zoom / 3D Data Visualization Libraries

What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java? I d like to be able to do some prototyping of creating new types of interfaces for navigating within data and ...

FLTK in Cygwin using Eclipse (Linking errors)

I have this assignment due that requires the usage of FLTK. The code is given to us and it should compile straight off of the bat, but I am having linking errors and do not know which other libraries ...

热门标签