- Timestamp:
- 11/25/08 00:56:01 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3156 r3160 414 414 string combineSsaoParams[] = 415 415 {"colorsTex", "normalsTex", "ssaoTex", "filterOffs", 416 "filterWeights", " bl", "br", "tl", "tr"};417 sCgCombineSsaoProgram->AddParameters(combineSsaoParams, 0, 9);416 "filterWeights", "modelViewProj"}; 417 sCgCombineSsaoProgram->AddParameters(combineSsaoParams, 0, 6); 418 418 419 419 ////////////// … … 455 455 456 456 const float filterWidth = 100.0f; 457 //const float filterWidth = 200.0f; 457 458 458 459 PoissonDiscSampleGenerator2 poisson(NUM_SSAO_FILTERSAMPLES, 1.0f); … … 740 741 GLuint oldIllumTex = mIllumFbo->GetColorBuffer(2 - mIllumFboIndex + 1)->GetTexture(); 741 742 742 sCgGiProgram->SetTexture(0, colorsTex); 743 sCgGiProgram->SetTexture(1, normalsTex); 744 sCgGiProgram->SetTexture(2, noiseTex2D); 745 sCgGiProgram->SetTexture(3, oldSsaoTex); 746 sCgGiProgram->SetTexture(4, oldIllumTex); 747 748 sCgGiProgram->SetValue1f(5, 743 int i = 0; 744 745 sCgGiProgram->SetTexture(i ++, colorsTex); 746 sCgGiProgram->SetTexture(i ++, normalsTex); 747 sCgGiProgram->SetTexture(i ++, noiseTex2D); 748 sCgGiProgram->SetTexture(i ++, oldSsaoTex); 749 sCgGiProgram->SetTexture(i ++, oldIllumTex); 750 751 sCgGiProgram->SetValue1f(i ++, 749 752 (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 750 753 … … 758 761 GenerateSamples(mSamplingMethod); 759 762 760 sCgGiProgram->SetArray2f( 6, (float *)samples2, NUM_SAMPLES);763 sCgGiProgram->SetArray2f(i ++, (float *)samples2, NUM_SAMPLES); 761 764 } 762 765 … … 766 769 Vector3 tr = mCornersView[3]; 767 770 768 sCgGiProgram->SetValue3f( 7, bl.x, bl.y, bl.z);769 sCgGiProgram->SetValue3f( 8, br.x, br.y, br.z);770 sCgGiProgram->SetValue3f( 9, tl.x, tl.y, tl.z);771 sCgGiProgram->SetValue3f( 10, tr.x, tr.y, tr.z);772 773 sCgGiProgram->SetMatrix( 11, mOldProjViewMatrix);774 sCgGiProgram->SetMatrix( 12, mProjViewMatrix);771 sCgGiProgram->SetValue3f(i ++, bl.x, bl.y, bl.z); 772 sCgGiProgram->SetValue3f(i ++, br.x, br.y, br.z); 773 sCgGiProgram->SetValue3f(i ++, tl.x, tl.y, tl.z); 774 sCgGiProgram->SetValue3f(i ++, tr.x, tr.y, tr.z); 775 776 sCgGiProgram->SetMatrix(i ++, mOldProjViewMatrix); 777 sCgGiProgram->SetMatrix(i ++, mProjViewMatrix); 775 778 776 779 … … 819 822 sCgCombineSsaoProgram->SetArray1f(i ++, (float *)ssaoFilterWeights, NUM_SSAO_FILTERSAMPLES); 820 823 821 Vector3 bl = mCornersView[0]; 822 Vector3 br = mCornersView[1]; 823 Vector3 tl = mCornersView[2]; 824 Vector3 tr = mCornersView[3]; 824 sCgCombineSsaoProgram->SetMatrix(i++, mProjViewMatrix); 825 825 826 826 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3159 r3160 51 51 52 52 #define MAX_LOD_LEVEL 10 53 // burnout (really bright regions will be saturated to white)53 /// burnout (really bright regions will be saturated to white) 54 54 #define WHITE_LUMINANCE 3e4f 55 55 … … 64 64 65 65 66 #define DYNAMIC_OBJECTS_THRESHOLD 1e- 7f66 #define DYNAMIC_OBJECTS_THRESHOLD 1e-8f 67 67 68 68 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3159 r3160 89 89 uniform sampler2D ssaoTex, 90 90 uniform sampler2D normalsTex, 91 uniform sampler2D offsetTex,92 91 uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 93 uniform float filterWeights[NUM_SSAO_FILTERSAMPLES] 92 uniform float filterWeights[NUM_SSAO_FILTERSAMPLES], 93 uniform float4x4 modelViewProj 94 94 ) 95 95 { … … 99 99 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 100 100 101 if ((ao.y < 70.0f) && (col.w < 1e10f)) 101 // reconstruct position from the eye space depth 102 const float eyeSpaceDepth = col.w; 103 const float4 worldPos = float4(-IN.view * eyeSpaceDepth, 1.0f); 104 // compute w factor from projection in order to control filter size 105 const float4 projPos = mul(modelViewProj, worldPos); 106 const float distanceScale = 1.0f / projPos.w; 107 108 const float convergence = ao.y; 109 110 if ((ao.y < 100.0f) && (col.w < 1e10f)) 102 111 //if (col.w < 1e10f) 103 112 { 104 113 const float scaleFactor = 1.0f; 105 const float adaptFactor = 10.0f;106 const float scale = adaptFactor * scaleFactor * ao.z / (adaptFactor + ao.y);114 const float adaptFactor = 5.0f; 115 const float scale = adaptFactor * scaleFactor * distanceScale / (adaptFactor + convergence); 107 116 108 //ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale);117 ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale); 109 118 } 110 119 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3159 r3160 290 290 float validPixel; 291 291 292 if ((( squaredLen <= DYNAMIC_OBJECTS_THRESHOLD) && (oldPixel.z <= DYNAMIC_OBJECTS_THRESHOLD)) ||293 ( 1292 if ((((squaredLen <= DYNAMIC_OBJECTS_THRESHOLD) && (oldPixel.z <= DYNAMIC_OBJECTS_THRESHOLD)) || 293 (depthDif <= 1e-2)) 294 294 && (oldTexCoords.x >= 0.0f) && (oldTexCoords.x < 1.0f) 295 295 && (oldTexCoords.y >= 0.0f) && (oldTexCoords.y < 1.0f) 296 && (depthDif <= MIN_DEPTH_DIFF)297 )298 //&& (depthDif <= 9e-1f)299 296 ) 300 297 { 301 validPixel = 0.0f; //5f;298 validPixel = 0.0f; 302 299 } 303 300 else
Note: See TracChangeset
for help on using the changeset viewer.