zoukankan      html  css  js  c++  java
  • simple shadow mapping

    解决了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
    https://files.cnblogs.com/Pointer/simple_shadow_mapping.rar

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


  • 相关阅读:
    [Zjoi2006]GameZ游戏排名系统
    二逼平衡树
    郁闷的小J
    Dynamic Rankings
    数列[专杀Splay版]
    星际争霸
    半平面交
    自适应辛普森
    7月31日
    规约先行-(三)代码格式
  • 原文地址:https://www.cnblogs.com/Pointer/p/103251.html
Copyright © 2011-2022 走看看