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      退出


  • 相关阅读:
    卸载软件
    SourceTree安装
    lombok安装及使用
    Element学习使用
    Vue基础学习
    SpringBoot与Swagger整合
    @Valid 数据校验 + 自定义全局异常信息
    Spring Boot 运行原理
    JNDI学习总结(一):JNDI到底是什么?
    Spring Boot AOP之对请求的参数入参与返回结果进行拦截处理
  • 原文地址:https://www.cnblogs.com/Pointer/p/103251.html
Copyright © 2011-2022 走看看