求教,关于Direct3D programming的一个问题。想要access zbuffer, 看MSDN, zbuffer format似乎只能用Format.D16Lockable(in C#), 可是我还想要用stencil buffer,于是只好把format设置成Format.D24S8.而且Format.D16Lockable并不为很多硬件支持。
要access zbuffer,是因为需要一个function,给定屏幕上任一点,要知道这个pixel在3D world里的坐标。
用stencil buffer,是为了产生一种类似于影子的效果。
vertex shader+pixel shader,或许可以?可是我现在对这两个东西一点儿都不了解。有人可以指点一二吗?
用Format.D24S8 不好吗?
if you want to dabble with HLSL, you can try the simplest case of using shadow mapping
1. write a vertex shader that computes the depth value of each pixel from the light's point of view and store the result in a shadow map
2. write a pixel shader that uses that shadow map
based on what you described, you should know in theory how it works. the HLSL implementation is merely implmentation and should be described from some online tutorials.
1. write a vertex shader that computes the depth value of each pixel from the light's point of view and store the result in a shadow map
2. write a pixel shader that uses that shadow map
based on what you described, you should know in theory how it works. the HLSL implementation is merely implmentation and should be described from some online tutorials.
Freedom is slavery.
Ignorance is strength.