Changeset 3203
- Timestamp:
- 12/01/08 18:38:36 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3202 r3203 548 548 else 549 549 { 550 BvhNodeContainer::const_iterator nit, nit_end = nodes.end();551 552 /*for (nit = nodes.begin(); nit != nit_end; ++ nit)553 {554 BvhNode *node = *nit;555 556 for (int i = 0; i < node->mNumTestNodes; ++ i)557 {558 RenderBoundingBoxImmediate(mTestNodes[node->mTestNodesIdx + i]->GetBox());559 }560 }*/561 562 550 renderedBoxes = PrepareBoundsWithDrawArrays(nodes); 563 551 RenderBoundsWithDrawArrays(renderedBoxes, state); … … 1315 1303 else 1316 1304 { 1317 glPolygonMode(GL_FRONT, GL_LINE); 1318 BvhNodeContainer nodes; 1319 nodes.push_back(node); 1320 int renderedBoxes = PrepareBoundsWithDrawArrays(nodes); 1321 RenderBoundsWithDrawArrays(renderedBoxes, state); 1322 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 1323 1324 /*for (int i = 0; i < node->mNumTestNodes; ++ i) 1305 for (int i = 0; i < node->mNumTestNodes; ++ i) 1325 1306 { 1326 1307 RenderBoxForViz(mTestNodes[node->mTestNodesIdx + i]->GetBox()); 1327 } */1308 } 1328 1309 } 1329 1310 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3197 r3203 479 479 //-- load some dynamic stuff 480 480 481 resourceManager->mUseNormalMapping = true;481 //resourceManager->mUseNormalMapping = true; 482 482 //resourceManager->mUseNormalMapping = false; 483 483 484 LoadModel("fisch.dem", dynamicObjects);485 //LoadModel("hbuddha.dem", dynamicObjects);484 //LoadModel("fisch.dem", dynamicObjects); 485 LoadModel("hbuddha.dem", dynamicObjects); 486 486 //LoadModel("venusm.dem", dynamicObjects); 487 487 //LoadModel("camel.dem", dynamicObjects); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3202 r3203 7 7 8 8 //#define NUM_SAMPLES 8 9 #define NUM_SAMPLES 1610 //#define NUM_SAMPLES 24 9 //#define NUM_SAMPLES 16 10 #define NUM_SAMPLES 96 11 11 12 //#define SAMPLE_INTENSITY 0.1f13 #define SAMPLE_INTENSITY 2.0f12 #define SAMPLE_INTENSITY 0.3f 13 //#define SAMPLE_INTENSITY 2.0f 14 14 15 15 #define SAMPLE_RADIUS 8e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3198 r3203 194 194 const float m2 = min(texelCenterConv.z, texelCenterConv.w); 195 195 196 const float convergence = min(m1, m2); 196 const float minConvergence = min(m1, m2); 197 198 const float convergence = step(200.0f, minConvergence) * minConvergence; 197 199 //const float convergence = ao.y; 198 200 … … 205 207 const float distanceScale = 1.0f; 206 208 209 // descend to zero filter size after reaching thres pixels 207 210 const float convergenceWeight = thres / (SSAO_FILTER_WIDTH - 1.0f); 208 211 const float convergenceScale = convergenceWeight / (convergence + convergenceWeight); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3199 r3203 174 174 float total_ao = .0f; 175 175 float numSamples = .0f; 176 float validSamples = .0f; 176 177 177 178 for (int i = 0; i < NUM_SAMPLES; ++ i) … … 233 234 #endif 234 235 // check if the samples have been valid in the last frame 235 //numSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 236 validSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 237 236 238 ++ numSamples; 237 239 } … … 239 241 total_ao /= numSamples; 240 242 241 return float3(max(0.0f, 1.0f - total_ao), .0f, numSamples);243 return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 242 244 } 243 245 … … 287 289 const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor; 288 290 289 const float4 sampleColor = tex2Dlod(colors, float4(texcoord, 0, 0));291 const float4 sampleColor = tex2Dlod(colors, float4(texcoord, .0f, .0f)); 290 292 const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr); 291 293 … … 303 305 // angle between current normal and direction to sample controls AO intensity. 304 306 const float cosAngle = max(dot(dirSample, normal), .0f); 305 306 // the distance_scale offset is used to avoid singularity that occurs at global illumination when307 // the distance to a sample approaches zero308 //const float aoContrib = SAMPLE_INTENSITY / (DISTANCE_SCALE + lengthToSample * lengthToSample);309 307 const float aoContrib = SAMPLE_INTENSITY / sqrLen; 310 308 //const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f; … … 321 319 322 320 // check if the samples have been valid in the last frame 323 validSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 321 // hack: the distance measure can fail in some cases => choose something different 322 const float tooFarAway = step(1.0f, lengthToSample); 323 validSamples += (1.0f - tooFarAway) * sampleColor.x; 324 324 //validSamples += sampleColor.x; 325 325 326 326 ++ numSamples; 327 //if ((validSamples < 1.0f) && (newWeight > 20) && (numSamples >= 8)) break; 327 328 //if ((validSamples < 1.0f) && (newWeight > 200) && (numSamples >= 8)) break; 329 if ((validSamples < 1.0f) && (numSamples >= 8)) break; 328 330 } 329 331 … … 401 403 if (eyeSpaceDepth < 1e10f) 402 404 { 403 //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight);404 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals);405 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 406 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 405 407 } 406 408 else -
GTP/trunk/App/Demos/Vis/FriendlyCulling/toto.txt
r3172 r3203 104 104 problem: 105 105 106 107 108 ========================= 109 110 1) ssao filter kernel: grows smaller too fast => flickering ... use 111 adaptive number of samples instead of size? 112 2) fix color bleeding 113 3) fix ssao2 so that ssao contribution stays constant 114 4) find physical expressions for constants in ssao 115 5) retry normal discontinuity for ssao filter 116 6) fix adaptive sampling for ssao and ssao2 117 a) sample adaptive if found invalid sample 118 b) sample adaptive if number of valid samples small? 119 120 q: is it good to choose new weight as we do? (approx 4 frames) 121 or shouldn't we just completely reset sample?
Note: See TracChangeset
for help on using the changeset viewer.