0

我有一个问题...是否可以仅对一个对象禁用 GL10.GL_DEPTH_TEST?在我的示例中,有一个带有 Alphashadow 纹理的 Groundplane,我想为我的 Carmodel 禁用 DEPTH_TEST 以伪造阴影。其他对象不应该禁用 DEPTH_TEST,所以我不会通过它们看到阴影。

这是一个屏幕截图(阴影没有完美地转换为它们的对象,但我想你会得到我的问题) https://dl.dropbox.com/u/18265107/special/screenshot.png

4

1 回答 1

2

Anything you disable depth-test for will show on top of other stuff. You can choose to do, or not do, that for anything you like. However I don't think it will fix your shadows.

To achieve what you were wanting, disabling depth-test isn't enough, and you would need to render things in the right order:

  1. render the ground.
  2. render the car.
  3. render the shadows, with depth-test disabled.
  4. render the rest of the environment.

However this assumes the ground is flat, and that shadows don't cast onto other scene objects, which will probably look wrong.

于 2012-12-15T15:04:32.483 回答