求教,关于Direct3D programming的一个问题。
登录 | 论坛导航 -> 华新鲜事 -> 技术の宅 | 本帖共有 2 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:zzjbug (等级:2 - 初出茅庐,发帖:364) 发表:2005-01-11 17:51:28  楼主  关注此帖
求教,关于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,或许可以?可是我现在对这两个东西一点儿都不了解。有人可以指点一二吗?
Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:zzjbug (等级:2 - 初出茅庐,发帖:364) 发表:2005-01-12 18:50:08  2楼
用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.
你说的是"Shadow Z-buffer" algorithm吗?
用Format.D24S8,已经可以做成影子效果了,我用的是Shadow Volume,觉得这个比较简单,而且比较适合我的情况。(并不是真的影子,而是类似于影子)。

问题是我想知道任何一个Pixel的三维坐标。
用HLSL,我觉得应该是Vertex Shader把depth value传给Pixel Shader(间接的,经过interpolation).可是Pixel Shader怎么告诉我的application呢?看了一些HLSL的资料,还是一头雾水。按照我的理解,Pixel Shader只能往Frame Buffer和Depth Buffer里写数据。那么难道我每次想要求点的坐标时,都要用HLSL重新Render一遍,把depth value写到Frame Buffer里吗?



或许我理解错你的意思了,可以详细解释一下吗?

很感谢帮我。
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 技术の宅 | 返回上一页 | 本主题共有 2 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码