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;	
    

     

    大概就这样子·

  • 相关阅读:
    127.0.0.1:8080 不在以下 request 合法域名列
    [SAP] 34. System Manager
    [SAP] 33. Deployment and instance management
    [Angular] State provider solutions
    [Cloud Architect] 9. Securing Access to Cloud Services
    [Git] Squash commits
    [Angular] Overlay CDK
    [Cloud Architect] 8. Infrastructure as Code
    [DevOps] Terraform Remote State Management
    [DevOps] Using Terraform to Create an EC2 Instance
  • 原文地址:https://www.cnblogs.com/macom/p/3398024.html
Copyright © 2011-2022 走看看