- Timestamp:
- 02/13/09 11:49:44 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/sibenik.env
r3296 r3309 106 106 ssaoSampleIntensity=0.8f 107 107 # ssao temporal coherence factor 108 tempCohFactor= 2000.0f108 tempCohFactor=150.0f 109 109 # ssao filter radius 110 110 ssaoFilterRadius=12.0f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3308 r3309 73 73 74 74 75 76 static Sample2 samples2[NUM_PRECOMPUTED_SAMPLES]; 75 77 // ssao random spherical samples 76 78 //static Sample2 samples2[NUM_SAMPLES]; 77 #define NUM_PRECOMPUTED_SAMPLES 2001 78 79 static Sample2 samples2[NUM_PRECOMPUTED_SAMPLES]; 79 80 80 // pcf samples 81 81 static Sample2 pcfSamples[NUM_PCF_TABS]; … … 743 743 sCgSsaoProgram->SetValue1f(i ++, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 744 744 745 static int currentPos = 0;746 747 745 if (/*mUseTemporalCoherence || */mRegenerateSamples) 748 746 { … … 752 750 // in the first case, the sample patterns look nicer, but the kernel 753 751 // needs longer to converge 754 //if (currentPos + NUM_SAMPLES >= NUM_PRECOMPUTED_SAMPLES) { 755 currentPos = 0; 756 GenerateSamples(mSamplingMethod); 757 //} 752 GenerateSamples(mSamplingMethod); 758 753 759 754 //if (mSortSamples) { SortSamples(); } 760 //sCgSsaoProgram->SetArray2f(i, (float *)samples2 + currentPos, NUM_SAMPLES); 761 sCgSsaoProgram->SetArray2f(i, (float *)samples2 + currentPos, NUM_PRECOMPUTED_SAMPLES); 762 763 currentPos += NUM_SAMPLES; 764 } 765 755 //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES); 756 sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES); 757 } 758 759 766 760 ++ i; 767 761 768 762 for (int j = 0; j < 4; ++ j, ++ i) 763 { 769 764 sCgSsaoProgram->SetValue3f(i, mCornersView[j].x, mCornersView[j].y, mCornersView[j].z); 765 } 770 766 771 767 sCgSsaoProgram->SetMatrix(i ++, mProjViewMatrix); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3306 r3309 5 5 //////////// 6 6 //-- ssao + gi parameters 7 7 #define NUM_PRECOMPUTED_SAMPLES 200 8 8 //#define NUM_SAMPLES 8 9 9 //#define NUM_SAMPLES 16 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3306 r3309 269 269 const float pixelIsValid = 0.0f; 270 270 // means that we only use slight temporal coherence over some frames 271 // so that there sino noticeable drag271 // so that there is no noticeable drag 272 272 const float pixelCouldBeValid = 2.0f; 273 273 // this pixel information has to be discarded in order to not create artifacts 274 274 const float pixelIsNotValid = 100.0f; 275 275 276 const float xOffs = 0;// 0.5f / 1024.0f; 277 const float yOffs = 0;// 0.5f / 768.0f; 278 279 if ((oldTexCoords.x < xOffs) || (oldTexCoords.x > (1.0f - xOffs)) || 280 (oldTexCoords.y < yOffs) || (oldTexCoords.y > (1.0f - yOffs)) 276 // check if the pixel was outside of the frame buffer 277 if ((oldTexCoords.x <= 0) || (oldTexCoords.x >= 1.0f) || 278 (oldTexCoords.y <= 0) || (oldTexCoords.y >= 1.0f) 281 279 ) 282 280 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3307 r3309 142 142 float validSamples = .0f; 143 143 144 for (int i = 0; i < NUM_ SAMPLES; ++ i)144 for (int i = 0; i < NUM_PRECOMPUTED_SAMPLES; ++ i) 145 145 { 146 146 const float2 offset = samples[i]; … … 220 220 sampler2D colors, 221 221 sampler2D noiseTex, 222 float2 samples[NUM_ SAMPLES],222 float2 samples[NUM_PRECOMPUTED_SAMPLES], 223 223 float3 normal, 224 224 float3 centerPosition, … … 231 231 float convergence, 232 232 float sampleIntensity, 233 bool isMovingObject 233 bool isMovingObject, 234 int idx 234 235 ) 235 236 { … … 237 238 float validSamples = .0f; 238 239 float numSamples = .0f; 239 240 240 241 for (int i = 0; i < NUM_SAMPLES; ++ i) 241 242 { … … 250 251 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 251 252 //offset = myreflect(samples[i], mynoise); 252 offset = myrotate(samples[i + (int)convergence], mynoise.x);253 offset = myrotate(samples[i + idx], mynoise.x); 253 254 } 254 255 else 255 256 { 256 offset = samples[i ];257 offset = samples[i + idx]; 257 258 } 258 259 … … 334 335 uniform sampler2D normals, 335 336 uniform sampler2D noiseTex, 336 uniform float2 samples[NUM_ SAMPLES],337 uniform float2 samples[NUM_PRECOMPUTED_SAMPLES], 337 338 uniform sampler2D oldTex, 338 339 uniform float4x4 modelViewProj, … … 394 395 395 396 float usedWeight = min(temporalCoherence, abs(oldWeight)); 397 int idx = (int)oldWeight % (int)temporalCoherence; 396 398 397 399 float3 ao; … … 400 402 if (eyeSpaceDepth < DEPTH_THRESHOLD) 401 403 { 402 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), usedWeight, sampleIntensity, isMovingObject );404 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), usedWeight, sampleIntensity, isMovingObject, idx); 403 405 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals, sampleIntensity); 404 406 }
Note: See TracChangeset
for help on using the changeset viewer.