永远也不完美的程序

不断学习,不断实践,不断的重构……

常用链接

统计

积分与排名

好友链接

最新评论

D3D中clipplane使用的注意。

        最近使用clipplane的时候,当渲染物在固定管线的时候,一切正常,但当渲染物用了vertexshader的时候,完全看不到了,找了很久也不知道问题的所在。后来再看DX的SDK时才发现用错了。
        SDK里是这样描述的:

When the fixed function pipeline is used the plane equations are assumed to be in world space. When the programmable pipeline is used the plane equations are assumed to be in the clipping space (the same space as output vertices).
        假如用了可编程管线,那么必须把截面变换回clip space里,clip space即摄像机的frusturm的空间。下面是代码(OGRE的):
    D3DXMATRIX xform;
    D3DXMatrixMultiply(&xform, &mDxViewMat, &mDxProjMat);
    D3DXMatrixInverse(&xform, NULL, &xform);
    D3DXMatrixTranspose(&xform, &xform);
    D3DXPlaneTransform(&dx9ClipPlane, &dx9ClipPlane, &xform);


这样就没问题了!

posted on 2010-06-09 14:24 狂烂球 阅读(2184) 评论(4)  编辑 收藏 引用 所属分类: 图形编程

评论

# re: D3D中clipplane使用的注意。 2010-06-09 22:37 Bill Hsu

嗯,我也遇到過。
這是我當時寫的:http://www.cppblog.com/billhsu/archive/2010/01/20/106088.html  回复  更多评论   

# re: D3D中clipplane使用的注意。 2010-06-10 09:06 liangairan

@Bill Hsu
呵呵,居然在网上找资料时找不到你的文章  回复  更多评论   

# re: D3D中clipplane使用的注意。 2015-03-19 16:42 究竟如何祛痘

不错的文章,其实楼主我想问一个问题,如何在博客空间插入自己网站呢  回复  更多评论   

# re: D3D中clipplane使用的注意。 2015-03-20 16:39 怎么样去痘疤

不知道是不是我技术问题,我实验过,好像不可以啊  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理