步履蹒跚

知其然,知其所以然 - real-time rendering.
posts - 85, comments - 172, trackbacks - 0, articles - 0

simple shadow mapping

Posted on 2005-02-07 23:36 Pointer 阅读(503) 评论(0)  编辑 收藏 所属分类: 开发随笔

解决了project texture后,shadow mapping就比较容易了。

对于基于ogl的shadow mapping,基本上有如下几种做法:

1 采用GL_ARB_depth_texture, GL_ARB_shadow扩展。Pass1中以光源为视点渲染场景到帧缓存,然后将深度部分copy到depth texture;Pass2中以眼睛为视点,将depth texture投影到场景后使用GL_ARB_shadow扩展比较纹理值与纹理坐标的r值,判断该fragment是否处于阴影中。

2 采用GL_ARB_depth_texture, GL_ARB_shadow, WGL_ARB_pixel_format, WGL_ARB_pbuffer扩展。与做法1的区别仅在于Pass1的渲染目标由帧缓存改为了PBuffer。

3 采用GL_ARB_depth_texture, GL_ARB_shadow, WGL_ARB_pixel_format, WGL_ARB_pbuffer, WGL_ARB_render_texture, WGL_NV_render_depth_texture扩展。与做法2的不同之处在于不需要copy PBuffer到纹理,而是使用WGL_ARB_render_texture扩展直接渲染到纹理。

4 先得到depth texture,然后自己编写fragment shader来进行阴影测试。

目前1~3种做法都试过了,晚点用GLSL试试方法4。:)


 

Demo:
http://downloads.cnblogs.com/CGTeam/Member/Pointer/dlls.rar
http://files.cnblogs.com/Pointer/simple_shadow_mapping.rar

wasdqezx 控制视角
ijkluom, 控制光源
esc      退出



标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2005-03-08 09:07 编辑过


相关链接: