Changeset 2337 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic
- Timestamp:
- 04/24/07 14:10:34 (18 years ago)
- 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 193 193 source GTPShadowMap_PS.hlsl 194 194 entry_point shadowMapDist_Variance 195 target ps_2_0 196 } 197 198 fragment_program GTP/Basic/SM/Dist_POINT_VSM_PS hlsl 199 { 200 source GTPShadowMap_PS.hlsl 201 entry_point shadowMapDist_POINT_Variance 195 202 target ps_2_0 196 203 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl
r2311 r2337 106 106 float4 pos = (IN.LightVPos / IN.LightVPos.w); 107 107 float d = length(pos.xy); 108 light = saturate((1.0 - d)/0.05);109 108 if(d <= 1.0) 110 109 { … … 126 125 } 127 126 } 128 else129 light = 0;130 127 131 128 return shadowColor + (1 - shadowColor) * light; 132 129 } 130 131 132 float4 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.