- Timestamp:
- 04/24/09 18:00:06 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter.vcproj
r3359 r3362 156 156 AdditionalLibraryDirectories="libs\Zlib\lib" 157 157 IgnoreDefaultLibraryNames="libCMT" 158 GenerateDebugInformation=" false"158 GenerateDebugInformation="true" 159 159 SubSystem="1" 160 160 LargeAddressAware="2" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/PlyConverter.cpp
r3361 r3362 41 41 Face face = faces[i]; 42 42 43 if (faces[i].indices.empty()) cout << "error!!" << endl; 44 43 45 //cout << "size: " << face.indices.size() << endl; 44 for ( size_t j = 0; j < face.indices.size(); ++j)46 for (int j = (int)face.indices.size() - 1; j >= 0; -- j) 45 47 { 46 SimpleVec h = vertices[faces[i].indices[j]]; 48 //cout << "h " << j << " " << face.indices.size() << endl; 49 50 SimpleVec h = vertices[face.indices[j]]; 47 51 SimpleVec v; 48 52 49 v.x = h.x * 14;53 v.x = -h.x * 14; 50 54 v.y = h.z * 14; 51 55 v.z = h.y * 14; … … 76 80 77 81 // no face normals? => create normals 78 const SimpleTri tri(geom->mVertices[idx + 2],82 const SimpleTri tri(geom->mVertices[idx + 0], 79 83 geom->mVertices[idx + 1], 80 geom->mVertices[idx + 0]);84 geom->mVertices[idx + 2]); 81 85 82 86 const SimpleVec n = tri.GetNormal(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly
r3294 r3362 10 10 PREFIX=myvienna 11 11 PREFIX=vienna 12 PREFIX=pp12 #PREFIX=pp 13 13 14 14 #FILES="$PREFIX-vfc.log $PREFIX_chc.log $PREFIX-vfc_pvs.log $PREFIX-chc++_b20.log $PREFIX-chc++_pvs_b20.log" … … 20 20 FILES="$PREFIX-notindexed.log $PREFIX-indexed.log" 21 21 #FILES="$PREFIX-vfc.log $PREFIX-chc++.log $PREFIX-vfc_pvs.log" 22 #FILES="$PREFIX-ssao.log $PREFIX-ssao_tmp.log $PREFIX-deferred.log" 23 FILES="$PREFIX-ssao_1024.log $PREFIX-ssao_tmp.log" 24 #FILES="$PREFIX-ssao.log" 22 25 23 26 echo $FILES -
GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2
r3294 r3362 23 23 #echo set xrange \[100:20000\] >> $FILE 24 24 #echo set xrange \[4200:4600\] >> $FILE 25 echo set xrange \[100:400\] >> $FILE26 echo set xrange \[1000:1600\] >> $FILE25 #echo set xrange \[100:400\] >> $FILE 26 #echo set xrange \[1000:1600\] >> $FILE 27 27 #echo set xrange \[1600:2100\] >> $FILE 28 28 #echo set xrange \[3000:3500\] >> $FILE -
GTP/trunk/App/Demos/Vis/FriendlyCulling/sibenik.env
r3360 r3362 120 120 camDirection=-0.0136068 0.974275 -0.224952 121 121 lightDirection=0.556361 0.559966 -0.613923 122 123 124 camPosition=-13.4875 10.9779 10.0881 125 camDirection=-0.97437 -3.55818e-006 -0.224952 126 lightDirection=0.556361 0.559966 -0.613 923 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3361 r3362 1505 1505 sprintf(imageName, "%s_%05d.tga", mSavedFrameSuffix.c_str(), mSavedFrameNumber); 1506 1506 1507 //cout << "writing " << imageName << endl; 1508 1507 1509 ILstring fileName = ILstring(imageName); 1508 1510 ilRegisterType(IL_FLOAT); … … 1525 1527 } 1526 1528 1529 //cout << "wrote " << fileName << endl; 1530 1527 1531 delete [] data; 1528 1532 stopil(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3361 r3362 628 628 629 629 if (0) LoadPompeiiFloor(); 630 630 631 #if 1 631 632 … … 642 643 // sibenik positions 643 644 VertexArray positions; 644 645 const float factor2 = 1.6f; 645 646 // for buddha (lowres) 646 positions.push_back(Vector3(6.07307, 8.20723, 6.62 ));647 positions.push_back(Vector3(-17.1935, 11.1687, 8.8781 ));648 positions.push_back(Vector3(1.50032, 31.1943, 19.1f));647 positions.push_back(Vector3(6.07307, 8.20723, 6.62 - factor2)); 648 positions.push_back(Vector3(-17.1935, 11.1687, 8.8781 - factor2)); 649 //positions.push_back(Vector3(1.50032, 31.1943, 19.1f)); 649 650 650 651 // for happy buddha … … 655 656 // for dragon 656 657 //positions.push_back(Vector3(6.07307, 8.20723, 5.0f)); 657 //positions.push_back(Vector3(0, 0, -0.8 ));658 //positions.push_back(Vector3(0, 0, -0.8f)); 658 659 659 660 #endif … … 661 662 //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 662 663 Matrix4x4 transl = TranslationMatrix(positions[0]); 663 664 //LoadModel("dragon.dem", dynamicObjects); 665 666 #if 1 667 664 668 //LoadModel("hbuddha.dem", dynamicObjects); 665 669 //LoadModel("horse.dem", dynamicObjects); 666 LoadModel("happy.dem", dynamicObjects); 667 //LoadModel("dragon.dem", dynamicObjects); 670 LoadModel("happy2.dem", dynamicObjects); 668 671 //LoadModel("torus.dem", dynamicObjects); 669 672 //LoadModel("venusm.dem", dynamicObjects); … … 678 681 } 679 682 680 /* 683 681 684 const float rotAngle = M_PI / 2.0f; 682 685 const Matrix4x4 rotMatrix = RotationXMatrix(rotAngle); … … 685 688 // hack: second buddha 686 689 dynamicObjects[0]->GetTransform()->MultMatrix(rotMatrix); 687 dynamicObjects[0]->GetTransform()->MultMatrix(scaleMatrix);688 689 dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix);690 //dynamicObjects[0]->GetTransform()->MultMatrix(scaleMatrix); 691 692 /*dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 690 693 dynamicObjects[1]->GetTransform()->MultMatrix(scaleMatrix); 691 694 … … 698 701 699 702 #endif 700 703 #endif 701 704 // hack 702 705 resourceManager->mUseNormalMapping = false; … … 732 735 733 736 // set far plane based on scene extent 734 //farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal());735 farDist = 1000.0f;737 farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal()); 738 //farDist = 1000.0f; 736 739 camera->SetFar(farDist); 737 740 … … 1180 1183 buddha->GetTransform()->SetMatrix(trafo); 1181 1184 1185 const float rotAngle3 = M_PI / 2.0f; 1186 const Matrix4x4 rotMatrix3 = RotationZMatrix(rotAngle3); 1187 1188 // hack: second buddha 1189 buddha->GetTransform()->MultMatrix(rotMatrix3); 1190 1182 1191 #if TODO // drop objects on ground floor 1183 1192 for (int i = 0; i < 10; ++ i) … … 1194 1203 #endif 1195 1204 1196 #if 11197 1205 ///////////////////////// 1198 1206 //-- update animations 1199 1207 1208 1200 1209 //const float rotAngle = M_PI * 1e-3f; 1201 const float rotAngle = 0.3f * M_PI / 180.0f;1202 //const float rotAngle = 0.6f * M_PI / 180.0f;1210 //const float rotAngle = 0.3f * M_PI / 180.0f; 1211 const float rotAngle = 0.6f * M_PI / 180.0f; 1203 1212 1204 1213 Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); … … 1214 1223 const float moveSpeed = 1e-1f; 1215 1224 motionPath->Move(moveSpeed); 1216 #endif1217 1225 } 1218 1226 … … 1488 1496 } 1489 1497 1490 if (makeSnapShot) makeSnapShot = false; 1498 static int dummy = 0; 1499 if (makeSnapShot && (dummy ++ == 650)) makeSnapShot = false; 1491 1500 1492 1501 ShadowMap *sm = showShadowMap ? shadowMap : NULL; … … 2017 2026 void RightMotionLight(int x, int y) 2018 2027 { 2019 float theta = 0.2f * M_PI * (xEyeBegin - x) / 180.0f;2020 float phi = 0.2f * M_PI * (yMotionBegin - y) / 180.0f;2028 const float theta = .2f * M_PI * (xEyeBegin - x) / 180.0f; 2029 const float phi = .2f * M_PI * (yMotionBegin - y) / 180.0f; 2021 2030 2022 2031 Vector3 lightDir = light->GetDirection(); … … 2069 2078 Vector3 rVec(viewDir[0], viewDir[1], 0); 2070 2079 2071 Matrix4x4 rot = RotationZMatrix(M_PI * 0.5f);2080 Matrix4x4 rot = RotationZMatrix(M_PI * .5f); 2072 2081 rVec = rot * rVec; 2073 2082 2074 pos -= rVec * (x - horizontalMotionBegin) * mouseMotion;2083 pos -= rVec * (x - horizontalMotionBegin) * mouseMotion; 2075 2084 pos[2] += (verticalMotionBegin - y) * mouseMotion; 2076 2085 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3361 r3362 26 26 #define VIEW_CORRECTION_SCALE 1.0f 27 27 28 //#define SSAO_CONVERGENCE_THRESHOLD 300.0f 28 29 #define SSAO_CONVERGENCE_THRESHOLD 700.0f 29 30 //#define SSAO_CONVERGENCE_THRESHOLD 1500.0f … … 73 74 #define PERFORMANCE_TEST 1 74 75 76 #define USE_OPTIMIZATION 0 77 78 75 79 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3361 r3362 105 105 ) 106 106 { 107 float2 result = float2(0.0f, 0.0f); 107 //return tex2Dlod(ssaoTex, float4(texCoord, .0f, .0f)).x; 108 float2 result = float2(.0f); 108 109 109 110 const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 110 111 112 #if 0 113 //const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence + 100) / SSAO_CONVERGENCE_THRESHOLD); 111 114 const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 112 //const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD);113 115 114 //for (int i = -radius; i <= radius; ++ i) 115 for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i) 116 //for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i) 116 117 { 117 118 const float4 sampleTexCoord = float4(texCoord + i * xyStep * scale, .0f, .0f); 118 119 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr, maxConvergence, spatialWeight); 119 120 } 120 121 #else 122 123 const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence + 100) / SSAO_CONVERGENCE_THRESHOLD); 124 125 for (int i = -radius; i <= radius; ++ i) 126 { 127 const float4 sampleTexCoord = float4(texCoord + i * xyStep, .0f, .0f); 128 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr, maxConvergence, spatialWeight); 129 } 130 131 #endif 121 132 result.x /= max(result.y, 1e-6f); 122 133 return saturate(result.x); … … 133 144 uniform float3 tl, 134 145 uniform float3 tr, 135 uniform float2 res 146 uniform float2 res, 147 uniform float maxConvergence, 148 uniform float spatialWeight 149 136 150 ) 137 151 { … … 151 165 152 166 // filter up to a certain convergance value and leave out background (sky) by checking depth 153 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 167 if ((!USE_OPTIMIZATION || (convergence < SSAO_CONVERGENCE_THRESHOLD)) && 168 (depth < DEPTH_THRESHOLD)) 154 169 { 155 170 // the filtered ssao value 156 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 171 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, 172 bl, br, tl, tr, xyStep, 173 convergence, maxConvergence, spatialWeight); 157 174 } 158 175 … … 185 202 // afterwards we do not use the filter anymore 186 203 187 float2 xyStep = float2(1.0f / res.x, 0);204 float2 xyStep = float2(1.0f / res.x, .0f); 188 205 189 206 // filter up to a certain convergance value and leave out background (sky) by checking depth 190 if (( convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD))207 if ((!USE_OPTIMIZATION || convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 191 208 { 192 209 // the filtered ssao value 193 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 210 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, 211 bl, br, tl, tr, xyStep, 212 convergence, maxConvergence, spatialWeight); 194 213 } 195 214 … … 228 247 229 248 // filter up to a certain convergance value and leave out background (sky) by checking depth 230 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 249 if ((!USE_OPTIMIZATION || (convergence < SSAO_CONVERGENCE_THRESHOLD)) 250 && (depth < DEPTH_THRESHOLD)) 231 251 { 232 252 // the filtered ssao value -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3361 r3362 307 307 else if ( // check if changed from dynamic to not dynamic object 308 308 ( 309 (oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) ||309 // (oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || 310 310 ( 311 311 (oldEyeSpaceDepth < DEPTH_THRESHOLD) && (projectedEyeSpaceDepth < DEPTH_THRESHOLD) && 312 (oldDynamic || newDynamic) && // check if we have a dynamic object313 (depthDif > MIN_DEPTH_DIFF)))312 //(oldDynamic || newDynamic) && // check if we have a dynamic object 313 (depthDif > 5e-3f)))//MIN_DEPTH_DIFF))) 314 314 ) // and there is a depth discontinuity 315 315 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r3360 r3362 83 83 84 84 // account for alpha blending 85 if (texColor.w < 0.5f) discard;85 if (texColor.w < .5f) discard; 86 86 87 87 pixel pix; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3361 r3362 205 205 //-- (affects performance for some reason!) 206 206 207 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 207 if (!USE_OPTIMIZATION || 208 (convergence < SSAO_CONVERGENCE_THRESHOLD)) 208 209 { 209 210 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; … … 355 356 //-- (affects performance for some reason!) 356 357 357 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 358 if (!USE_OPTIMIZATION || 359 (convergence < SSAO_CONVERGENCE_THRESHOLD)) 358 360 { 359 361 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; … … 493 495 //-- (affects performance for some reason!) 494 496 495 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 497 if (!USE_OPTIMIZATION || 498 (convergence < SSAO_CONVERGENCE_THRESHOLD)) 496 499 { 497 500 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; … … 539 542 540 543 541 #ifdef PERFORMANCE_TEST 544 //#ifdef PERFORMANCE_TEST 545 #if 1 542 546 // check if the samples have been valid in the last frame 543 547 // only mark sample as invalid if in the last / current frame 544 548 // they possibly have any influence on the ao 545 549 546 //const float pixelValid = sampleColor.x; 547 //const float pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f; 548 //float pixelValid = max(sampleColor.x, length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f); 549 float pixelValid = sampleColor.x; 550 551 if (pixelValid < 1) 552 { 553 const float3 sampleDiffVec = tex2Dlod(attribsTex, float4(texcoord, .0f, .0f)).xyz; 554 pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f; 555 } 556 557 // hack: 558 // we check if the sample could have been near enough to the current pixel 559 // or if the angle is small enough 560 // to have any influence in the current or last frame 561 562 #if 1 563 const float changeFactor = sampleColor.y; 564 const float partlyResetThres = 1.0f; 565 566 if (0)//pixelValid <= partlyResetThres) 567 { 568 const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 569 validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle)); 570 } 571 else 572 { 573 validSamples = max(validSamples, pixelValid); 574 } 575 #endif 576 550 if (cosAngle > 0) 551 { 552 float pixelValid = sampleColor.x; 553 554 if (1)//pixelValid < 0.5f) 555 { 556 const float3 sampleDiffVec = tex2Dlod(attribsTex, float4(texcoord, .0f, .0f)).xyz; 557 pixelValid = max(pixelValid, length(sampleDiffVec - diffVec) < 5e-3f ? .0f : 10.0f); 558 //pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f; 559 } 560 561 // hack: 562 // we check if the sample could have been near enough to the current pixel 563 // or if the angle is small enough 564 // to have any influence in the current or last frame 565 566 const float changeFactor = sampleColor.y; 567 const float partlyResetThres = 1.0f; 568 569 if (0)//pixelValid <= partlyResetThres) 570 { 571 const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 572 validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle)); 573 } 574 else 575 { 576 validSamples = max(validSamples, pixelValid); 577 } 578 } 577 579 #ifdef USE_GTX 578 580 // we can bail out early and use a minimal #samples) … … 657 659 658 660 #ifdef PERFORMANCE_TEST 661 659 662 float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, 0, 0)).xyz; 660 663 … … 750 753 { 751 754 const float factor = 4.0f; 755 //if (oldIdx >= factor * newWeight) oldIdx = 0; 752 756 oldWeight = min(oldWeight, factor * newWeight); 753 //oldWeight = .0f; 754 //oldIdx = .0f; 757 oldWeight = oldIdx = .0f; 755 758 } 756 759 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/vienna.env
r3353 r3362 20 20 # the filename for the statistics 21 21 statsFilename=mystats 22 walkThroughSuffix=walkthrough_vienna 22 walkThroughSuffix=walkthrough_vienna2 23 23 24 24 # use potentially visible sets?
Note: See TracChangeset
for help on using the changeset viewer.