Changeset 3155 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 11/24/08 17:17:26 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp
r3154 r3155 176 176 177 177 ambient.x = ambient.y = ambient.z = 0.2f; 178 //diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f;179 diffuse.x = diffuse.y = diffuse.z = 1.0f;178 diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 179 //diffuse.x = diffuse.y = diffuse.z = 1.0f; 180 180 spec.x = spec.y = spec.z = .0f; 181 181 emm = spec; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/main.cpp
r3153 r3155 23 23 } 24 24 25 std::cin.get();25 //std::cin.get(); 26 26 cout << "conversion successful" << endl; 27 27 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3151 r3155 58 58 static ShaderProgram *sCgDownSampleProgram = NULL; 59 59 static ShaderProgram *sCgScaleDepthProgram = NULL; 60 static ShaderProgram *sCgPrepareSsaoProgram = NULL; 60 61 61 62 … … 291 292 //-- the flip-flop fbos 292 293 293 //const int dsw = w / 2; const int dsh = h / 2;294 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; 295 296 296 297 mIllumFbo = new FrameBufferObject(dsw, dsh, FrameBufferObject::DEPTH_NONE); … … 373 374 sCgScaleDepthProgram = sm->CreateFragmentProgram("deferred", "ScaleDepth", "ScaleDepth"); 374 375 sCgLogLumProgram = sm->CreateFragmentProgram("tonemap", "CalcAvgLogLum", "avgLogLum"); 376 sCgPrepareSsaoProgram = sm->CreateFragmentProgram("deferred", "PrepareSsao", "PrepareSsao"); 375 377 376 378 … … 410 412 //////////////// 411 413 412 string combineSsaoParams[] = {"colorsTex", "normalsTex", "ssaoTex", "filterOffs", "filterWeights", "bl", "br", "tl", "tr"}; 414 string combineSsaoParams[] = 415 {"colorsTex", "normalsTex", "ssaoTex", "filterOffs", 416 "filterWeights", "bl", "br", "tl", "tr"}; 413 417 sCgCombineSsaoProgram->AddParameters(combineSsaoParams, 0, 9); 414 418 … … 439 443 //////////////// 440 444 445 446 string prepareSsaoParams[] = 447 {"colorsTex", "oldTex", "modelViewProj", "oldModelViewProj", "oldEyePos", 448 "oldbl", "oldbr", "oldtl", "oldtr", "diffVals"}; 449 450 sCgPrepareSsaoProgram->AddParameters(prepareSsaoParams, 0, 10); 451 452 453 //////////////// 454 441 455 442 456 const float filterWidth = 100.0f; 443 //const float filterWidth = 1000.0f; 444 445 #if 1 457 446 458 PoissonDiscSampleGenerator2 poisson(NUM_SSAO_FILTERSAMPLES, 1.0f); 447 459 poisson.Generate((float *)ssaoFilterOffsets); … … 461 473 ssaoFilterOffsets[2 * i + 1] *= yoffs; 462 474 } 463 #else 464 //ComputeSampleOffsets(ssaoFilterOffsets, mWidth, mHeight, sqrt(NUM_SSAO_FILTERSAMPLES), NUM_SSAO_FILTERSAMPLES); 465 ComputeSampleOffsets(ssaoFilterOffsets, mWidth, mHeight, filterWidth, NUM_SSAO_FILTERSAMPLES); 466 //cout<<"ssao filter size: " << NUM_SSAO_FILTERSAMPLES << endl; 467 for (int i = 0; i < NUM_SSAO_FILTERSAMPLES; ++ i) 468 ssaoFilterWeights[i] = 1.0f; 469 470 #endif 475 471 476 472 477 ///////// … … 507 512 // downsample fbo buffers 508 513 // colors 509 DownSample(fbo, colorBufferIdx, mDownSampleFbo, 0, sCgScaleDepthProgram); 514 //DownSample(fbo, colorBufferIdx, mDownSampleFbo, 0, sCgScaleDepthProgram); 515 PrepareSsao(fbo); 510 516 DownSample(fbo, 1, mDownSampleFbo, 1, sCgDownSampleProgram); // normals 511 517 DownSample(fbo, 2, mDownSampleFbo, 2, sCgDownSampleProgram); // offsets … … 601 607 602 608 if (mUseTemporalCoherence || mRegenerateSamples) 603 //if (mRegenerateSamples)604 609 { 605 610 mRegenerateSamples = false; … … 946 951 947 952 953 void DeferredRenderer::PrepareSsao(FrameBufferObject *fbo) 954 { 955 GLuint colorsTex, diffVals, oldTex; 956 957 colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 958 //normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 959 diffVals = fbo->GetColorBuffer(2)->GetTexture(); 960 //diffVals = mDownSampleFbo->GetColorBuffer(2)->GetTexture(); 961 962 // flip flop between illumination buffers 963 oldTex = mIllumFbo->GetColorBuffer(2 - mIllumFboIndex)->GetTexture(); 964 965 int i = 0; 966 967 sCgPrepareSsaoProgram->SetTexture(i ++, colorsTex); 968 //sCgSsaoProgram->SetTexture(i ++, normalsTex); 969 sCgPrepareSsaoProgram->SetTexture(i ++, oldTex); 970 971 sCgPrepareSsaoProgram->SetMatrix(i ++, mProjViewMatrix); 972 sCgPrepareSsaoProgram->SetMatrix(i ++, mOldProjViewMatrix); 973 974 for (int j = 0; j < 4; ++ j, ++ i) 975 sCgPrepareSsaoProgram->SetValue3f(i, mOldCornersView[j].x, mOldCornersView[j].y, mOldCornersView[j].z); 976 977 Vector3 de; 978 de.x = mOldEyePos.x - mEyePos.x; 979 de.y = mOldEyePos.y - mEyePos.y; 980 de.z = mOldEyePos.z - mEyePos.z; 981 982 sCgPrepareSsaoProgram->SetValue3f(i ++, de.x, de.y, de.z); 983 984 sCgPrepareSsaoProgram->SetTexture(i ++, diffVals); 985 986 987 glPushAttrib(GL_VIEWPORT_BIT); 988 glViewport(0, 0, mDownSampleFbo->GetWidth(), mDownSampleFbo->GetHeight()); 989 990 mDownSampleFbo->Bind(); 991 992 glDrawBuffers(1, mrt + 0); 993 994 DrawQuad(sCgPrepareSsaoProgram); 995 996 glPopAttrib(); 997 PrintGLerror("prepareSsao"); 998 } 999 1000 1001 948 1002 void DeferredRenderer::DownSample(FrameBufferObject *fbo, 949 1003 int bufferIdx, … … 1009 1063 1010 1064 1011 /*1012 void DeferredRenderer::BackProject(FrameBufferObject *fbo)1013 {1014 // back project new frame into old one and check1015 // if pixel still valid. store this property with ssao texture or even1016 // betteer with color / depth texture. This way1017 // we can sample this property together with the color / depth1018 // values and we do not require additional texture lookups1019 fbo->Bind();1020 1021 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture();1022 //GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture();1023 1024 // overwrite old color texture1025 //colorBufferIdx = 3 - colorBufferIdx;1026 //glDrawBuffers(1, mrt + colorBufferIdx);1027 //glDrawBuffers(1, mrt + colorBufferIdx);1028 1029 sCgCombineSsaoProgram->SetTexture(0, colorsTex);1030 //sCgCombineSsaoProgram->SetTexture(1, ssaoTex);1031 1032 DrawQuad(sCgBackProjectProgram);1033 1034 PrintGLerror("combine ssao");1035 }1036 */1037 1038 1039 1065 void DeferredRenderer::InitFrame() 1040 1066 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3148 r3155 107 107 void FlipFbos(FrameBufferObject *fbo); 108 108 109 void PrepareSsao(FrameBufferObject *fbo); 110 111 109 112 110 113 //////////// -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3153 r3155 471 471 //-- load some dynamic stuff 472 472 473 resourceManager->mUseNormalMapping = true;474 //resourceManager->mUseNormalMapping = false;475 476 LoadModel("fisch.dem", dynamicObjects);477 //LoadModel("hbuddha.dem", dynamicObjects);473 //resourceManager->mUseNormalMapping = true; 474 resourceManager->mUseNormalMapping = false; 475 476 //LoadModel("fisch.dem", dynamicObjects); 477 LoadModel("hbuddha.dem", dynamicObjects); 478 478 //LoadModel("venusm.dem", dynamicObjects); 479 479 //LoadModel("camel.dem", dynamicObjects); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3154 r3155 11 11 // for quadratic falloff 12 12 //#define SAMPLE_INTENSITY 0.2f 13 //#define SAMPLE_INTENSITY 0.07f13 #define SAMPLE_INTENSITY 0.07f 14 14 15 15 //#define SAMPLE_INTENSITY 0.075f 16 #define SAMPLE_INTENSITY 0.2f16 //#define SAMPLE_INTENSITY 0.2f 17 17 18 18 #define SAMPLE_RADIUS 8e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3149 r3155 78 78 average /= max(total_w, 1e-1f); 79 79 80 return saturate(average 80 return saturate(average); 81 81 } 82 82 83 83 84 /** Function combining image and indirect illumination buffer using a … … 103 104 const float scaleFactor = 1.0f; 104 105 const float adaptFactor = 10.0f; 105 106 106 const float scale = adaptFactor * scaleFactor * ao.z / (adaptFactor + ao.y); 107 108 ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale);107 108 //ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale); 109 109 } 110 110 111 111 OUT.illum_col.xyz = col.xyz * ao.x; 112 113 OUT.illum_col.xyz = float3(0, ao.x, 0); 112 114 113 115 //OUT.illum_col.xyz = float3(0, clamp(1.0f - ao.y * 1e-2f, 0, 1), 1); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3154 r3155 200 200 } 201 201 202 #if 0203 /** This shader computes the reprojection and stores reprojected color / depth values204 as well as a boolean that205 */206 pixel Reproject(fragment IN,207 uniform sampler2D colors,208 uniform sampler2D normals)209 {210 float4 norm = tex2Dlod(normals, float4(IN.texCoord, 0 ,0));211 const float3 normal = normalize(norm.xyz);212 213 /// reconstruct position from the eye space depth214 float3 viewDir = IN.view;215 const float eyeDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w;216 const float3 eyeSpacePos = -viewDir * eyeDepth;217 const float4 worldPos = float4(eyePos + eyeSpacePos, 1.0f);218 219 220 ////////////////221 //-- calculcate the current projected posiion (also used for next frame)222 223 float4 currentPos = mul(modelViewProj, worldPos);224 225 const float w = SAMPLE_RADIUS / currentPos.w;226 currentPos /= currentPos.w;227 228 const float precisionScale = 1e-3f;229 const float currentDepth = currentPos.z * precisionScale;230 231 const float2 ao = ssao(IN, colors, noiseTex, samples, normal,232 eyeSpacePos, w, bl, br, tl, tr, normalize(viewDir));233 234 235 /////////////////236 //-- compute temporally smoothing237 238 239 // reproject new frame into old one240 241 // calculate projected depth242 float4 projPos = mul(oldModelViewProj, worldPos);243 projPos /= projPos.w;244 245 // the current depth projected into the old frame246 const float projDepth = projPos.z * precisionScale;247 // fit from unit cube into 0 .. 1248 const float2 tex = projPos.xy * 0.5f + 0.5f;249 // retrieve the sample from the last frame250 float4 oldCol = tex2D(oldTex, tex);251 252 const float oldDepth = oldCol.z;253 //const float depthDif = 1.0f - projDepth / oldDepth;254 const float depthDif = projDepth - oldDepth;255 256 //const float oldNumSamples = oldCol.y;257 const float oldWeight = clamp(oldCol.y, 0, temporalCoherence);258 259 float newWeight;260 261 // the number of valid samples in this frame262 //const float newNumSamples = ao.y;263 264 if ((temporalCoherence > 0)265 && (tex.x >= 0.0f) && (tex.x < 1.0f)266 && (tex.y >= 0.0f) && (tex.y < 1.0f)267 && (abs(depthDif) < MIN_DEPTH_DIFF)268 && (abs(oldCol.x - ao.x) < 0.1f)269 // if visibility changed in the surrounding area we have to recompute270 //&& (oldNumSamples > 0.8f * newNumSamples)271 )272 {273 // increase the weight for convergence274 newWeight = oldWeight + 1.0f;275 OUT.illum_col.x = (ao.x + oldCol.x * oldWeight) / newWeight;276 //if (!(oldNumSamples > ao.y - 1.5f)) newWeight = 0;277 }278 else279 {280 OUT.illum_col.x = ao.x;281 newWeight = .0f;282 }283 284 OUT.illum_col.y = newWeight;285 OUT.illum_col.z = currentDepth;286 287 return OUT;288 }289 290 #endif291 292 202 293 203 float4 Output(fragment IN, uniform sampler2D colors): COLOR … … 304 214 color.w /= length(IN.view); 305 215 216 return color; 217 } 218 219 220 /** This shader computes the reprojection and checks 221 if the reprojected pixel from last frame is still 222 valid in the current frame 223 */ 224 inline float PixelValid(sampler2D diffVals, 225 sampler2D oldTex, 226 float4 color, 227 float2 texCoord, 228 float3 viewDir, 229 float3 oldEyePos, 230 float4x4 modelViewProj, 231 float4x4 oldModelViewProj, 232 float3 oldbl, 233 float3 oldbr, 234 float3 oldtl, 235 float3 oldtr 236 ) 237 { 238 // reconstruct position from the eye space depth 239 const float eyeSpaceDepth = color.w; 240 const float4 worldPos = float4(-viewDir * eyeSpaceDepth, 1.0f); 241 242 float3 diffVec = tex2Dlod(diffVals, float4(texCoord, 0, 0)).xyz; 243 244 245 //////////////// 246 //-- calculcate the current projected posiion (also used for next frame) 247 248 float4 projPos = mul(modelViewProj, worldPos); 249 const float invw = 1.0f / projPos.w; 250 projPos *= invw; 251 252 // compute position from old frame for dynamic objects + translational portion 253 //const float3 translatedPos = diffVec - oldEyePos + worldPos.xyz; 254 const float3 translatedPos = worldPos.xyz; 255 256 257 ///////////////// 258 //-- reproject into old frame and calculate texture position of sample in old frame 259 260 // note: the old model view matrix only holds the view orientation part 261 //float4 backProjPos = mul(oldModelViewProj, float4(translatedPos, 1.0f)); 262 float4 backProjPos = mul(modelViewProj, float4(translatedPos, 1.0f)); 263 backProjPos /= backProjPos.w; 264 265 // fit from unit cube into 0 .. 1 266 //const float2 oldTexCoords = backProjPos.xy * 0.5f + 0.5f; 267 const float2 oldTexCoords = texCoord; 268 // retrieve the sample from the last frame 269 const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f)); 270 271 // calculate eye space position of sample in old frame 272 const float oldEyeSpaceDepth = oldPixel.w; 273 274 // vector from eye pos to old sample 275 const float3 oldViewDir = viewDir;//Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 276 const float invLen = 1.0f / length(oldViewDir); 277 const float projectedEyeSpaceDepth = invLen * length(translatedPos); 278 279 const float depthDif = abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth); 280 281 const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 282 283 //if (squaredLen < 1e-8f) // object not dynamic 284 //{} 285 286 float validPixel; 287 288 if (1 289 && (oldTexCoords.x >= 0.0f) && (oldTexCoords.x < 1.0f) 290 && (oldTexCoords.y >= 0.0f) && (oldTexCoords.y < 1.0f) 291 //&& (depthDif <= MIN_DEPTH_DIFF) 292 && (depthDif <= 9e-1f) 293 ) 294 { 295 validPixel = 0.0f;//5f; 296 } 297 else 298 { 299 validPixel = 1.5f; 300 } 301 302 return depthDif; 303 //return validPixel; 304 } 305 306 307 float4 PrepareSsao(fragment IN, 308 uniform sampler2D colorsTex, 309 uniform sampler2D oldTex, 310 uniform float4x4 modelViewProj, 311 uniform float4x4 oldModelViewProj, 312 uniform float3 oldEyePos, 313 uniform float3 oldbl, 314 uniform float3 oldbr, 315 uniform float3 oldtl, 316 uniform float3 oldtr, 317 uniform sampler2D diffVals 318 ): COLOR 319 { 320 //const float3 normal = normalize(tex2Dlod(normals, float4(IN.texCoord, 0 ,0)).xyz); 321 const float3 viewDir = IN.view; 322 float4 color = tex2Dlod(colorsTex, float4(IN.texCoord, 0, 0)); 323 324 // store scaled view vector so wie don't have to normalize for e.g., ssao 325 color.w /= length(IN.view); 326 //color.w = 1; 327 328 // do reprojection and filter out the pixels that are not save 329 float pValid = PixelValid(diffVals, 330 oldTex, 331 color, 332 IN.texCoord, 333 viewDir, 334 oldEyePos, 335 modelViewProj, 336 oldModelViewProj, 337 oldbl, oldbr, oldtl, oldtr 338 ); 339 340 color.x = pValid; 306 341 return color; 307 342 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3151 r3155 51 51 52 52 // reconstruct world space position 53 inline float3 ReconstructSamplePos( uniform sampler2D tex,53 inline float3 ReconstructSamplePos(float eyeSpaceDepth, 54 54 float2 texcoord, 55 55 float3 bl, float3 br, float3 tl, float3 tr) 56 56 { 57 const float eyeSpaceDepth = tex2Dlod(tex, float4(texcoord, 0, 0)).w;58 59 57 float3 viewVec = Interpol(texcoord, bl, br, tl, tr); 60 58 float3 samplePos = -viewVec * eyeSpaceDepth; … … 117 115 118 116 /** This shader computes the reprojection and stores 119 reprojected color / depth values as well as a boolean that 117 the ssao value of the old pixel as well as the 118 weight of the pixel in the new frame. 120 119 */ 121 120 inline float2 temporalSmoothing(float4 worldPos, … … 140 139 float3 oldtl, 141 140 float3 oldtr, 142 float3 diffVec 141 float3 diffVec, 142 float pixelValid 143 143 ) 144 144 { … … 183 183 #endif 184 184 185 float notValid = 0.5f;185 //float pixelValid = 0.5f; 186 186 float overallDepth = 0; 187 187 188 #if 1188 #if 0 189 189 const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 190 190 … … 222 222 // if visibility changed in the surrounding area we have to recompute 223 223 //&& (oldNumSamples > 0.8f * newNumSamples) 224 //&& ( notValid < 1.0f)224 //&& (pixelValid < 1.0f) 225 225 ) 226 226 { 227 227 // increase the weight for convergence 228 228 newWeight = oldWeight + 1.0f; 229 if ( notValid > 1.0f) newWeight = 4.0f;230 //if ( notValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f);229 if (pixelValid > 1.0f) newWeight = 4.0f; 230 //if (pixelValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f); 231 231 } 232 232 else … … 234 234 newWeight = 1.0f; 235 235 } 236 237 //if (oldPixel.y >= 2000)238 // newWeight = min(temporalCoherence + 1, max(oldPixel.y - 70, 50));239 //if (newWeight >= 2000) newWeight = 1000;240 //newWeight -= step(512.0f, newWeight) * 256.0f;241 236 242 237 return float2(oldPixel.x, newWeight); … … 288 283 289 284 //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f)) ++ numSamples; 290 const float3 samplePos = ReconstructSamplePos(colors, texcoord, bl, br, tl, tr); 285 float4 sampleColor = tex2Dlod(colors, float4(texcoord, 0, 0)); 286 287 const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr); 291 288 const float3 sampleNormal = normalize(tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz); 289 290 numSamples += sampleColor.x; 292 291 293 292 … … 301 300 302 301 // angle between current normal and direction to sample controls AO intensity. 303 //const float cosAngle = max(-dot(sampleNormal, normal), .0f);304 //const float cosAngle = .5f - dot(sampleNormal, normal) * 0.5f;305 302 float cosAngle = .5f + dot(sampleNormal, -normal) * 0.5f; 306 307 float dirAngle = dot(dirSample, normal); 308 309 cosAngle *= step(0.0f, dirAngle); 310 311 //cosAngle *= step(0.5f, cosAngle); 312 //const float cosAngle = .5f * dot(sampleNormal, normal) + 1.0f; 303 // use binary decision to cull samples that are behind current shading point 304 cosAngle *= step(0.0f, dot(dirSample, normal)); 313 305 314 306 // the distance_scale offset is used to avoid singularity that occurs at global illumination when … … 374 366 const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor; 375 367 376 //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f)) ++ numSamples;377 const float3 samplePos = ReconstructSamplePos( colors, texcoord, bl, br, tl, tr);368 float4 sampleColor = tex2Dlod(colors, float4(texcoord, 0, 0)); 369 const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr); 378 370 371 numSamples += sampleColor.x; 372 379 373 380 374 //////////////// … … 454 448 455 449 450 float2 ao; 451 452 // note: this should be done with the stencil buffer 453 if (eyeSpaceDepth < 1e10f) 454 { 455 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir)); 456 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 457 } 458 else 459 { 460 ao = float2(1.0f, 0); 461 } 462 456 463 ///////////////// 457 464 //-- compute temporal reprojection … … 467 474 scaleFactor, 468 475 oldbl, oldbr, oldtl, oldtr, 469 diffVec 476 diffVec, 477 ao.y 470 478 ); 471 479 … … 473 481 const float newWeight = temporalVals.y; 474 482 475 float2 ao; 476 477 // note: this should be done with the stencil buffer 478 if (eyeSpaceDepth < 1e10f) 479 { 480 //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir)); 481 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 482 } 483 else 484 { 485 ao = float2(1.0f, 0); 486 } 487 488 OUT.illum_col.x = (ao.x + oldSsao * (newWeight - 1.0f)) / newWeight; 483 484 OUT.illum_col.x = ao.y;//(ao.x + oldSsao * (newWeight - 1.0f)) / newWeight; 489 485 OUT.illum_col.y = newWeight; 490 486 OUT.illum_col.z = invw; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg
r3116 r3155 75 75 uniform float timer, 76 76 uniform float oldTimer 77 //uniform float4x4 modelMatrix,78 //uniform float4x4 oldModelMatrix79 77 ) 80 78 {
Note: See TracChangeset
for help on using the changeset viewer.