Changeset 3100
- Timestamp:
- 11/05/08 14:25:24 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3099 r3100 42 42 #define MAX_LOD_LEVEL 10 43 43 44 #define MIN_DEPTH_DIFF 1e- 3f44 #define MIN_DEPTH_DIFF 1e-2f 45 45 //#define MIN_DEPTH_DIFF 5e-1f 46 46 #define PRECISION_SCALE 1e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3099 r3100 79 79 uniform float3 oldtl, 80 80 uniform float3 oldtr, 81 float 3 worldPos81 float eyeSpaceDepth 82 82 ) 83 83 { … … 87 87 float2 texCoord = texcoord0 + offsetTransformed * scaleFactor; 88 88 89 const float3 samplePos = ReconstructSamplePos(colors, texCoord, bl, br, tl, tr); 90 89 const float sampleEyeSpaceDepth = tex2Dlod(colors, float4(texCoord, 0, 0)).w; 90 //float3 viewVec = normalize(Interpol(texcoord, bl, br, tl, tr)); 91 const float3 viewVec = Interpol(texCoord, bl, br, tl, tr); 92 const float3 samplePos = -viewVec * sampleEyeSpaceDepth; 93 94 const float3 translatedPos = samplePos - oldEyePos; 91 95 // reproject into old frame and calculate projected depth 92 float4 projPos = mul(oldModelViewProj, float4( samplePos, 1.0f));96 float4 projPos = mul(oldModelViewProj, float4(translatedPos, 1.0f)); 93 97 projPos /= projPos.w; 94 98 … … 99 103 100 104 const float oldEyeSpaceDepth = oldPixel.w; 101 const float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 102 103 const float3 oldSamplePos = oldEyePos - viewVec * oldEyeSpaceDepth; 105 const float3 oldViewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 106 107 const float invlen = 1.0f / length(oldViewVec); 108 const float projectedEyeSpaceDepth = length(translatedPos) * invlen; 104 109 105 float dDiff = length(oldSamplePos - samplePos.xyz); 106 if (length(worldPos.xyz - samplePos.xyz) > 5.0f) dDiff = .0f; 107 108 return dDiff; 110 float depthDif = (abs(eyeSpaceDepth - sampleEyeSpaceDepth) > 5.0f) ? 0 : abs(oldEyeSpaceDepth - projectedEyeSpaceDepth); 111 112 return depthDif; 109 113 } 110 114 … … 180 184 float notValid = 0.5f; 181 185 182 /*for (int i = 0; i < NUM_SAMPLES; ++ i)186 for (int i = 0; i < NUM_SAMPLES; ++ i) 183 187 { 184 188 float sampleDif = ComputeDifference(samples[i], … … 192 196 oldEyePos, 193 197 oldbl, oldbr, oldtl, oldtr, 194 eye Pos.xyz);195 196 if (sampleDif >= 1e-1f) ++ notValid;197 } */198 eyeSpaceDepth); 199 200 if (sampleDif >= 5e-2f) ++ notValid; 201 } 198 202 199 203 // the number of valid samples in this frame … … 210 214 // if visibility changed in the surrounding area we have to recompute 211 215 //&& (oldNumSamples > 0.8f * newNumSamples) 212 //&& (notValid < 1.0f)216 && (notValid < 1.0f) 213 217 ) 214 218 { … … 393 397 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 394 398 395 //if (ao.y < 10.0f) ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights);399 if (ao.y < 10.0f) ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights); 396 400 397 401 OUT.illum_col = col * ao.x;
Note: See TracChangeset
for help on using the changeset viewer.