Ignore:
Timestamp:
04/24/07 14:10:34 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program

    r2294 r2337  
    193193   source GTPShadowMap_PS.hlsl 
    194194   entry_point shadowMapDist_Variance 
     195   target ps_2_0 
     196} 
     197 
     198fragment_program GTP/Basic/SM/Dist_POINT_VSM_PS hlsl 
     199{ 
     200   source GTPShadowMap_PS.hlsl 
     201   entry_point shadowMapDist_POINT_Variance 
    195202   target ps_2_0 
    196203} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl

    r2311 r2337  
    106106    float4 pos = (IN.LightVPos / IN.LightVPos.w); 
    107107        float d = length(pos.xy); 
    108     light = saturate((1.0 - d)/0.05);            
    109108    if(d <= 1.0) 
    110109    { 
     
    126125    } 
    127126  } 
    128   else 
    129    light = 0;    
    130127         
    131128  return shadowColor + (1 - shadowColor) * light; 
    132129} 
     130 
     131 
     132float4 shadowMapDist_POINT_Variance(LightCPos_OUT IN, 
     133                              uniform float lightFarPlane, 
     134                              uniform samplerCUBE shadowMap) : COLOR 
     135{ 
     136  float4 light = float4(1,1,1,1); 
     137   
     138  float dist = length(IN.LightCPos.xyz) / lightFarPlane; 
     139  float4 storedDist = texCUBE(shadowMap, float3(IN.LightCPos.xy, -IN.LightCPos.z)); 
     140  dist -= DIST_BIAS_VSM; 
     141  float lit_factor = light * (dist <= storedDist.r);     
     142          
     143  float M1 = storedDist.r; 
     144  float M2 = storedDist.g; 
     145  float v2 = min(max(M2 - M1 * M1, 0.0) +  DIST_EPSILON, 1.0); 
     146  float m_d = M1 - dist; 
     147  float pmax = v2 / (v2 + m_d * m_d); 
     148                                                 
     149  // Adjust the light color based on the shadow attenuation 
     150  light = max(lit_factor, pmax);         
     151         
     152   
     153  return (shadowColor + (1 - shadowColor) * light); 
     154} 
Note: See TracChangeset for help on using the changeset viewer.