|
|
我将我的程序升级到DX9以后,硬件阴影贴图不能用了,为什么?
DX8和DX9的硬件阴影贴图的接口发生了一些变化。在DX8中,我们需要根据位深对z分量进行缩放。从DX9开始,我们改变了接口的行为,从而不再需要手工变换深度值值,所以不管位深是多少,z值始终在0-1之间。基本上,我们想实现这个简单的接口,而不愿意影响旧的程序,所以只在DX9中实现了这个接口。
/*******************************************/
I upgraded my application to DirectX9 and my hardware shadow maps no longer work! What's up?
We've changed the behavior of hardware shadow maps between the DirectX8 and DirectX9 interfaces. In DirectX8, you're required to scale the interpolated z component (that will be compared with the value in the shadow map) by the bit depth of the shadow map itself. Starting with the DirectX9 interfaces, we've changed this behavior to no longer require this scale, so the z value should be in the range [0..1], regardless of bit depth. Basically, we wanted to implement this new cleaner behavior, but didn't want to break shipping apps that rely on the old behavior, so we changed it only for the new DX9 interfaces.
|
|