zoukankan      html  css  js  c++  java
  • Shadow Mapping With PCF

    其实就基本SM加上一个靠近百分比过滤·

    下面这里是使用对周边取样的片段·

         float t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy ).r;
    	float4 t_OutColor = t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2(-viewport_inv_width, 0) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2( viewport_inv_width , 0) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2( 0,-viewport_inv_height) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2( 0, viewport_inv_height) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2(-viewport_inv_width, -viewport_inv_height) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2( viewport_inv_width, -viewport_inv_height) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2(-viewport_inv_width,  viewport_inv_height) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;
    
    	t_DepthMap = DepthMap.Sample( DepthMapSampler, t_ProjPos.xy + float2( viewport_inv_width,  viewport_inv_height) ).r;
    	t_OutColor += t_DepthMap >= t_DepthScene ? s_OutColor : s_ShadowColor;	
    

     

    大概就这样子·

  • 相关阅读:
    ASIHTTPRequest详解
    UIViewController之间的相互跳转
    IOS延时加载网络图片
    ASI 实现注册方法的小例子(get和post方式)
    NSRange
    NSScanner
    序列化 NSKeyedArchiver,NSPropertyListSerialization
    自定义UITableViewCell
    UITableView去掉分隔符
    ASIHTTPRequest类库简介和使用说明(转)
  • 原文地址:https://www.cnblogs.com/macom/p/3398024.html
Copyright © 2011-2022 走看看