本文介绍了渲染毛刺与GL_DEPTH_TEST和透明的质感的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从一个角度我的灌木是这样的:

From one angle my shrubs look like this:

在另一方面,他们是这样的:

From the other, they look like this:

我的理论是,当看从第一个角度的灌木,所有的灌木背后的块已经被绘制,因此当它涉及到绘制灌木,它只是吸引他们上层建筑。

My theory is that when looking at the shrubs from the first angle, all the blocks behind the shrub have already been drawn, so when it comes to draw the shrub, it just draws them overtop.

从另一个角度,但是,它基本上是试图先画灌木,然后当​​它来绘制灌木后面的块,它会检查深度缓存,看到有什么东西已经堵块的看法,所以也没有渲染,会引起深蓝色的方块(我清楚的颜色)。

From the other angle, however, it's basically trying to draw the shrub first, and then when it goes to draw the block behind the shrub, it checks the depth buffer and sees that there's something already blocking the view of the block, so it doesn't render it, causing the navy blue squares (my clear color).

我真的不知道怎么虽然解决这个问题。禁用深度测试导致其他各种错误。是否有某种方式来标记的顶点或多边形具有透明度,以便它知道它仍然需要呈现背后有什么?

I really have no idea how to fix this issue though. Disabling the depth test causes all kinds of other errors. Is there some way to flag the vertex or polygon as having transparency so that it knows it still needs to render what's behind?

发现这个。这是唯一的解决办法?要手动分开我的透明和不透明的块,然后多的每一个帧排序它们的CPU pretty的,因为玩家可以四处走动?必须有一种方法来委派这给GPU ...

Found this. Is this the only solution? To separate my transparent and opaque blocks, and then manually sort them on the CPU pretty much every single frame because the player can move around? There has to be a way to delegate this to the GPU...

推荐答案

该链接(和CPU排序)是alpha混合。如果你只需要alpha测试(不混合),那么你并不需要排序任何东西。只启用alpha测试,保持开启深度测试,一切都将变得很好。

That link (and sorting on CPU) is for alpha blending. If you need only Alpha Testing (not Blending), then you don't need to sort anything. Just enable alpha test, keeping depth test enabled, and everything will be rendered fine.

下面参见:http://www.opengl.org/wiki/Transparency_Sorting你需要alpha测试,需要alpha测试,而不是标准半透明,需要整理。

See here: http://www.opengl.org/wiki/Transparency_SortingYou need "Alpha test" that requires alpha testing, not "Standard translucent" that requires sorting.

这篇关于渲染毛刺与GL_DEPTH_TEST和透明的质感的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 06:32