Changeset 1638 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
- Timestamp:
- 10/18/06 15:21:29 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
r1629 r1638 55 55 ):COLOR 56 56 { 57 float bias = 0.00 01;57 float bias = 0.001; 58 58 float4 light = float4(1,1,1,1); 59 float4 shadow = float4(0.6,0.6,0.6,1); 59 float4 shadow = float4(0.85,0.85,0.85,1); 60 //float4 shadow = float4(0,0,0,1); 60 61 61 float4 pos = (IN.lPosition / IN.lPosition.w); 62 pos.xy = (pos.xy +1.0 ) / 2.0; 63 pos.y = 1.0 - pos.y; 64 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 62 if(IN.lPosition.z > 0.0) 63 { 64 float4 pos = (IN.lPosition / IN.lPosition.w); 65 66 if(length(pos.xy)>1) 67 light = shadow; 68 else 69 { 70 pos.xy = (pos.xy + 1.0) / 2.0; 71 pos.y = 1.0 - pos.y; 72 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 65 73 66 if(storedDepth.r + bias < pos.z) 67 { 68 float M1 = storedDepth.r; 69 float M2 = storedDepth.g; 70 float v2 = M2 - M1 * M1; 71 float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 72 light = shadow + (1 - shadow) * pmax; 74 if(storedDepth.r + bias < pos.z) 75 { 76 float M1 = storedDepth.r; 77 float M2 = storedDepth.g; 78 float v2 = M2 - M1 * M1; 79 float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 80 light = saturate(shadow + (1 - shadow) * pmax); 81 } 82 } 73 83 74 //light = shadow;75 84 } 76 //return abs( pos.z - storedDepth.z ); 85 else 86 light = shadow; 87 77 88 return light; 78 89 } … … 87 98 float bias = 0.0001; 88 99 float4 light = float4(1,1,1,1); 89 float4 shadow = float4(0. 65,0.65,0.65,1);100 float4 shadow = float4(0.95,0.95,0.95,1); 90 101 //float4 shadow = float4(0,0,0,1); 91 102 … … 93 104 { 94 105 float4 pos = (IN.lPosition / IN.lPosition.w); 95 pos.xy = (pos.xy + 1.0) / 2.0; 106 107 if(length(pos.xy)>1) 108 light = shadow; 109 else 110 { 111 pos.xy = (pos.xy + 1.0) / 2.0; 112 pos.y = 1.0 - pos.y; 113 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 96 114 97 98 pos.y = 1.0 - pos.y; 99 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 100 101 if(storedDepth.r + bias < pos.z) 102 { 103 light = shadow; 115 if(storedDepth.r + bias < pos.z) 116 { 117 light = shadow; 118 } 104 119 } 105 //if(length(pos.xy)>1) 106 // light = shadow; 120 107 121 } 122 else 123 light = shadow; 108 124 109 125 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl
r1590 r1638 111 111 float2 texCoord : TEXCOORD0, 112 112 uniform float4x4 worldViewProj, 113 uniform float4x4 worldI, 113 114 uniform float4x4 world) 114 115 { … … 116 117 OUT.hPos = mul(worldViewProj, position); 117 118 OUT.wPos = mul(world, position).xyz; 118 OUT.mNormal = mul( world, normal);119 OUT.mNormal = mul(normal, worldI); 119 120 //OUT.mNormal = normal; 120 121 OUT.texCoord = texCoord; … … 136 137 float3 pos = IN.wPos - lastCenter; 137 138 139 //return float4(N,1)+ lastCenter.x*0.000001; 138 140 // return float4(N,1)+ lastCenter.x*0.000001; 139 141 // return readCubeMap(SmallEnvMapSampler, pos) + lastCenter.x*0.000001; … … 146 148 float d; 147 149 148 for (float x = 0.5; x < M; x++)149 for (float y = 0.5; y < M; y++)150 for (float x = 1; x < M; x++) 151 for (float y = 1; y < M; y++) 150 152 { 151 153 float2 p, tpos; … … 167 169 } 168 170 169 for (float x = 0.5; x < M; x++)170 for (float y = 0.5; y < M; y++)171 for (float x = 1; x < M; x++) 172 for (float y = 1; y < M; y++) 171 173 { 172 174 float2 p, tpos; … … 187 189 } 188 190 189 for (float x = 0.5; x < M; x++)190 for (float y = 0.5; y < M; y++)191 for (float x = 1; x < M; x++) 192 for (float y = 1; y < M; y++) 191 193 { 192 194 float2 p, tpos; … … 207 209 } 208 210 209 for (float x = 0.5; x < M; x++)210 for (float y = 0.5; y < M; y++)211 for (float x = 1; x < M; x++) 212 for (float y = 1; y < M; y++) 211 213 { 212 214 float2 p, tpos; … … 227 229 } 228 230 229 for (float x = 0.5; x < M; x++)230 for (float y = 0.5; y < M; y++)231 for (float x = 1; x < M; x++) 232 for (float y = 1; y < M; y++) 231 233 { 232 234 float2 p, tpos; … … 247 249 } 248 250 249 for (float x = 0.5; x < M; x++)250 for (float y = 0.5; y < M; y++)251 for (float x = 1; x < M; x++) 252 for (float y = 1; y < M; y++) 251 253 { 252 254 float2 p, tpos; … … 266 268 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler); 267 269 } 268 float kd = 0. 3;270 float kd = 0.5; 269 271 return kd * I; 270 272 }
Note: See TracChangeset
for help on using the changeset viewer.