Changeset 3142 for GTP/trunk/App/Demos
- Timestamp:
- 11/18/08 23:35:16 (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
r3140 r3142 292 292 //-- the flip-flop fbos 293 293 294 //const int dsw = w / 2; const int dsh = h / 2;295 const int dsw = w; const int dsh = h;294 const int dsw = w / 2; const int dsh = h / 2; 295 //const int dsw = w; const int dsh = h; 296 296 297 297 mIllumFbo = new FrameBufferObject(dsw, dsh, FrameBufferObject::DEPTH_NONE); … … 545 545 } 546 546 547 // as multisampling is difficult / costly with deferred shading, 548 // at least do some antialiasing 547 549 AntiAliasing(fbo, light); 548 550 549 Output(fbo); 551 // just output the latest buffer 552 //Output(fbo); 550 553 551 554 glEnable(GL_LIGHTING); … … 668 671 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 669 672 670 //FrameBufferObject::Release(); 671 673 FrameBufferObject::Release(); 672 674 // read the second buffer, write to the first buffer 673 FlipFbos(fbo);675 //FlipFbos(fbo); 674 676 675 677 // the neighbouring texels -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3139 r3142 7 7 8 8 #define NUM_SAMPLES 8 9 //#define NUM_SAMPLES 169 //#define NUM_SAMPLES 8 10 10 11 11 // for quadratic falloff … … 29 29 //-- reprojection 30 30 31 //#define MIN_DEPTH_DIFF 2e-2f32 31 #define MIN_DEPTH_DIFF 5e-3f 33 32 #define PRECISION_SCALE 1e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3141 r3142 84 84 const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr); 85 85 #else 86 //const float eyeSpaceDepth = color.w;87 const float eyeSpaceDepth = ao.w;86 const float eyeSpaceDepth = color.w; 87 //const float eyeSpaceDepth = ao.w; 88 88 #endif 89 89 … … 114 114 depthFactor = max(step(1.0f - 5e-1f, 1.0f - length(samplePos - centerPos)), 1e-3f); 115 115 #else // use depth 116 //sampleDepth = tex2Dlod(colorsTex, sampleTexCoord).w; 117 sampleDepth = aoSample.w; 118 depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth)), 1e-3f); 116 sampleDepth = tex2Dlod(colorsTex, sampleTexCoord).w; 117 //sampleDepth = aoSample.w; 118 //depthFactor = max(step(1e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth)), 1e-3f); 119 depthFactor = max(1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth), 1e-3f); 119 120 #endif 120 normalFactor = max(step(0.6f, dot(sampleNorm, centerNormal)), 1e-3f); 121 convergenceFactor = min(100.0f, aoSample.y) * 0.01f;//max(step(18.5f, aoSample.y), 1e-3f); 122 123 w = filterWeights[i] * normalFactor * depthFactor * convergenceFactor; 121 //normalFactor = max(step(0.9f, dot(sampleNorm, centerNormal)), 1e-3f); 122 normalFactor = max(dot(sampleNorm, centerNormal), 1e-3f); 123 convergenceFactor = min(1000.0f, aoSample.y) * 0.01f;//max(step(18.5f, aoSample.y), 1e-3f); 124 125 //w = filterWeights[i] * normalFactor * depthFactor * convergenceFactor; 126 w = normalFactor * depthFactor * convergenceFactor; 124 127 //w = filterWeights[i] * normalFactor * converganceFactor; 125 128 //w = filterWeights[i] * normalFactor * depthFactor; 129 //w = convergenceFactor; 126 130 127 131 average += aoSample.x * w; … … 129 133 } 130 134 131 average *= 1.0f / max(total_w, 1e- 6f);132 133 return average;135 average *= 1.0f / max(total_w, 1e-1f); 136 137 return saturate(average); 134 138 } 135 139 … … 195 199 uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 196 200 uniform float filterWeights[NUM_SSAO_FILTERSAMPLES], 197 float scale ,198 int index)201 float scale 202 ) 199 203 { 200 204 float average = .0f; … … 219 223 220 224 //depthFactor = clamp(1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w), 1e-3f, 1.0f); 221 depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f);225 //depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f); 222 226 //normalFactor = max(step(0.6f, dot(sampleNorm, norm)), 1e-3f); 223 227 w = filterWeights[i]; 224 228 //w = filterWeights[i] * normalFactor * depthFactor; 225 229 //w = normalFactor * depthFactor; 226 w = depthFactor;230 //w = depthFactor; 227 231 228 232 average += aoSample.y * w; … … 245 249 246 250 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 247 248 //const static float scaleFactor = 20.0f; 249 const static float scaleFactor = 10.0f; 250 //ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, 0.5f, 1); 251 //ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, scaleFactor, 1); 251 //ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, 0.1f); 252 252 253 253 OUT.illum_col = ao; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3138 r3142 185 185 float overallDepth = 0; 186 186 187 #if 1 187 188 const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 188 189 189 #if 1190 190 if (squaredLen < 1e-8f) // object not dynamic 191 191 { … … 226 226 // increase the weight for convergence 227 227 newWeight = oldWeight + 1.0f; 228 if (notValid > 1.0f) newWeight = 10.0f;228 if (notValid > 1.0f) newWeight = 4.0f; 229 229 //if (notValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f); 230 230 }
Note: See TracChangeset
for help on using the changeset viewer.