Changeset 3226
- Timestamp:
- 12/20/08 09:00:10 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3225 r3226 41 41 #camDirection=1 0 0 42 42 43 camPosition=468.025 267.591 182.478 44 camDirection=0.937282 0.348573 -0 43 #camPosition=468.025 267.591 182.478 44 #camDirection=0.937282 0.348573 -0 45 46 #camPosition=470.548 265.479 181.578 47 #camDirection=-0.0383892 0.999263 -0 48 49 camPosition=470.541 267.286 181.978 50 camDirection=-0.100954 0.993856 -0.045363 45 51 46 52 #lightDirection=-0.8f 1.0f -0.7f … … 51 57 ## window options 52 58 53 #winWidth=80054 #winHeight=60059 winWidth=800 60 winHeight=600 55 61 56 winWidth=1024 57 winHeight=768 62 #winWidth=1024 63 #winHeight=768 64 #winWidth=512 65 #winHeight=384 58 66 59 67 useFullScreen=0 … … 92 100 ssaoKernelRadius=8e-1f 93 101 # ssao sample intensity 94 ssaoSampleIntensity=0. 2f102 ssaoSampleIntensity=0.1f 95 103 # ssao temporal coherence factor 96 104 tempCohFactor=1000.0f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3215 r3226 40 40 { 41 41 mUseNormalMapping = false; 42 mUseSpecialColors = false; 42 43 } 43 44 … … 278 279 } 279 280 281 if (mUseSpecialColors) 282 { 283 tech->mAmbientColor.r = tech->mAmbientColor.g = tech->mAmbientColor.b = 0.2f; 284 tech->mDiffuseColor.r = 0.7f; tech->mDiffuseColor.g = 0.5f; tech->mDiffuseColor.b = 0.2f; 285 } 286 280 287 281 288 /////////////// -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
r3216 r3226 62 62 /// giant hack: set this to true if the geometry to load has tangent data for normal mapping 63 63 bool mUseNormalMapping; 64 bool mUseSpecialColors; 64 65 65 66 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3225 r3226 536 536 //resourceManager->mUseNormalMapping = false; 537 537 538 resourceManager->mUseSpecialColors = true; 539 538 540 //LoadModel("fisch.dem", dynamicObjects); 539 541 LoadModel("hbuddha.dem", dynamicObjects); … … 544 546 545 547 resourceManager->mUseNormalMapping = false; 548 resourceManager->mUseSpecialColors = false; 546 549 547 550 buddha = dynamicObjects.back(); … … 1285 1288 deferredShader->SetSaveFrame("", -1); 1286 1289 1287 if (makeSnapShot) makeSnapShot = false;1290 //if (makeSnapShot) makeSnapShot = false; 1288 1291 1289 1292 ShadowMap *sm = showShadowMap ? shadowMap : NULL; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3225 r3226 7 7 8 8 //#define NUM_SAMPLES 8 9 //#define NUM_SAMPLES 1610 #define NUM_SAMPLES 249 #define NUM_SAMPLES 16 10 //#define NUM_SAMPLES 24 11 11 //#define NUM_SAMPLES 48 12 12 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3225 r3226 124 124 125 125 // get position exactly between old texel centers 126 float2 center;126 /*float2 center; 127 127 center.x = (floor(IN.texCoord.x * w - .5f) + 1.0f) / w; 128 128 center.y = (floor(IN.texCoord.y * h - .5f) + 1.0f) / h; … … 137 137 138 138 const float minConvergence = min(m1, m2); 139 140 //const float convergence = minConvergence; 139 const float convergence = minConvergence;*/ 141 140 //const float convergence = 0; 142 141 const float convergence = ao.y; … … 161 160 // just apply ssao if we are not in the sky 162 161 if (col.w < 1e10f) 163 OUT.illum_col.xyz = col.xyz * max(1e-1f, 1.0f - ao.x); 162 OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 163 //OUT.illum_col.xyz = col.xyz * ao.x; 164 164 else 165 165 OUT.illum_col.xyz = col.xyz; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3212 r3226 315 315 316 316 const float4 difVec = tex2Dlod(diffVals, float4(IN.texCoord, 0, 0)); 317 // normalize normal once more because of bilinear interpolation 317 318 const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0, 0)).xyz); 318 319 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3225 r3226 225 225 total_ao /= numSamples; 226 226 227 #if 1227 #if 0 228 228 // if surface normal perpenticular to view dir, approx. half of the samples will not count 229 229 // => compensate for this (on the other hand, projected sampling area could be larger!) 230 230 const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * max(dot(viewDir, normal), 0.0f); 231 total_ao += cosAngle * aoContrib *viewCorrection;231 total_ao *= viewCorrection; 232 232 233 233 #endif 234 234 235 return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 235 //return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 236 return float3(total_ao, validSamples, numSamples); 236 237 } 237 238 … … 260 261 float newWeight, 261 262 float sampleIntensity, 262 bool isMovingObject 263 bool isMovingObject, 264 sampler2D normalTex 263 265 ) 264 266 { … … 288 290 289 291 292 // the normal of the current sample 293 //const float3 sampleNormal = tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz; 294 // angle between current normal and direction to sample controls AO intensity. 295 //float cosAngle2 = .5f + dot(sampleNormal, -normal) * 0.5f; 296 290 297 //////////////// 291 298 //-- compute contribution of sample using the direction and angle … … 303 310 //const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f; 304 311 312 //total_ao += cosAngle2 * cosAngle * aoContrib; 305 313 total_ao += cosAngle * aoContrib; 306 314 … … 318 326 validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid); 319 327 320 #if defUSE_GTX328 #if 1//#ifdef U//USE_GTX 321 329 // we can bail out early and use a minimal #samples) 322 330 // if some conditions are met as long as the hardware supports it … … 343 351 344 352 return float3(total_ao, validSamples, numSamples); 353 //return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 345 354 } 346 355 … … 417 426 if (eyeSpaceDepth < 1e10f) 418 427 { 419 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject );428 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject, normals); 420 429 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals, sampleIntensity); 421 430 } … … 446 455 else if (ao.y > partlyResetThres) 447 456 { 448 //oldWeight = min(oldWeight, 4.0f * newWeight);449 oldWeight = .0f;457 oldWeight = min(oldWeight, 4.0f * newWeight); 458 //oldWeight = .0f; 450 459 } 451 460 } … … 458 467 //-- blend ao between old and new samples (and avoid division by zero) 459 468 460 OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / max(1e-6f, newWeight + oldWeight); 469 //OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / max(1e-6f, newWeight + oldWeight); 470 OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / (newWeight + oldWeight); 461 471 462 472 OUT.illum_col.y = combinedWeight;
Note: See TracChangeset
for help on using the changeset viewer.