Changeset 3193 for GTP/trunk/App
- Timestamp:
- 11/28/08 03:26:36 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp
r3161 r3193 174 174 175 175 ambient.x = ambient.y = ambient.z = 0.2f; 176 diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 176 //diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 177 diffuse.x = 0.8f; diffuse.y = 0.8f; diffuse.z = 0.4f; 177 178 //diffuse.x = diffuse.y = diffuse.z = 1.0f; 178 179 spec.x = spec.y = spec.z = .0f; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3192 r3193 38 38 39 39 # bad view point (culling bug!) 40 camPosition=469.381 267.293 184.778 41 camDirection=0.142006 0.645885 -0.750111 40 #camPosition=469.381 267.293 184.778 41 #camDirection=0.142006 0.645885 -0.750111 42 43 #camPosition=458.412 255.767 182.632 44 #camDirection=0.891691 0.42723 0.149535 45 46 #camPosition=740.137 487.855 188.506 47 #camDirection=0.669256 0.727829 0.149535 48 49 camPosition=492.678 249.827 187.232 50 camDirection=-0.651041 -0.693292 -0.309017 42 51 43 52 #lightDirection=-0.8f 1.0f -0.7f … … 64 73 # ssao temporal coherence factor 65 74 tempCohFactor=1000.0f 75 66 76 # tone mapping 67 77 useHDR=0 78 68 79 # use antialiasing 69 80 useAA=1 81 70 82 # use ssao / color bleeding 71 83 useAdvancedShading=1 84 85 # skylight turbitity 86 turbitity=3.0f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3192 r3193 517 517 // multisampling is difficult / costly with deferred shading 518 518 // at least do some edge blurring 519 if (useAntiAliasing) AntiAliasing(fbo, light);519 //if (useAntiAliasing) AntiAliasing(fbo, light); 520 520 521 521 switch (mShadingMethod) … … 544 544 // multisampling is difficult / costly with deferred shading 545 545 // at least do some edge blurring 546 //if (useAntiAliasing) AntiAliasing(fbo, light);else546 if (useAntiAliasing) AntiAliasing(fbo, light);// else 547 547 Output(fbo); // just output the latest buffer 548 548 … … 1020 1020 normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 1021 1021 diffVals = fbo->GetColorBuffer(2)->GetTexture(); 1022 //diffVals = mDownSampleFbo->GetColorBuffer(2)->GetTexture();1023 1022 1024 1023 // flip flop between illumination buffers -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r3117 r3193 217 217 218 218 glBindTexture(GL_TEXTURE_2D, mTexId); 219 220 /*GLint width, height;221 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);222 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);223 cout << "w: " << width << "h: " << height << endl;224 */225 219 226 220 unsigned char *data = new unsigned char[bytes * 4 * mWidth * mHeight]; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3189 r3193 111 111 //const float scaleFactor = 5.0f; 112 112 113 position.z -= 3 * scaleFactor;113 position.z -= 3.0f * scaleFactor; 114 114 Matrix4x4 m = TranslationMatrix(position); 115 115 … … 143 143 else 144 144 { 145 // no tone mapping => scale torange145 // no tone mapping => linearily scale to displayable dynamic range 146 146 vtxParams->SetValue1f(8, 8e-5f); 147 147 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3189 r3193 145 145 double accumulatedTime = 1000.0; 146 146 float fps = 1e3f; 147 float turbitity = 5.0f; 147 148 148 149 int shadowSize = 2048; … … 369 370 env.GetFloatParam(string("keyRotation"), keyRotation); 370 371 env.GetFloatParam(string("tempCohFactor"), ssaoTempCohFactor); 371 372 372 env.GetFloatParam(string("turbitity"), turbitity); 373 373 374 374 env.GetVectorParam(string("camPosition"), camPos); … … 403 403 cout << "use antialiasing: " << useAntiAliasing << endl; 404 404 cout << "use advanced shading: " << useAdvancedShading << endl; 405 cout << "turbitity: " << turbitity << endl; 405 406 406 407 //cout << "model path: " << model_path << endl; … … 478 479 //-- load some dynamic stuff 479 480 480 //resourceManager->mUseNormalMapping = true;481 resourceManager->mUseNormalMapping = false;482 483 //LoadModel("fisch.dem", dynamicObjects);484 LoadModel("hbuddha.dem", dynamicObjects);481 resourceManager->mUseNormalMapping = true; 482 //resourceManager->mUseNormalMapping = false; 483 484 LoadModel("fisch.dem", dynamicObjects); 485 //LoadModel("hbuddha.dem", dynamicObjects); 485 486 //LoadModel("venusm.dem", dynamicObjects); 486 487 //LoadModel("camel.dem", dynamicObjects); … … 492 493 buddha = dynamicObjects.back(); 493 494 494 const Vector3 sceneCenter(470.398f, 240.364f, 182.5f); 495 //const Vector3 sceneCenter(470.398f, 240.364f, 182.5f); 496 const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 495 497 496 498 Matrix4x4 transl = TranslationMatrix(sceneCenter); … … 547 549 548 550 /// the turbitity of the sky (from clear to hazy, use <3 for clear sky) 549 const float turbitiy = 5.0f; 550 preetham = new SkyPreetham(turbitiy, skyDome); 551 preetham = new SkyPreetham(turbitity, skyDome); 551 552 552 553 CreateAnimation(); … … 809 810 Vector3 sunDiffuse; 810 811 812 #if 1 811 813 preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse, !useHDRValues); 812 814 … … 819 821 diffuse[2] = sunDiffuse.z; 820 822 821 //cout << sunDiffuse << " " << sunAmbient << endl; 823 #else 824 825 ambient[0] = .2f; 826 ambient[1] = .2f; 827 ambient[2] = .2f; 828 829 diffuse[0] = 1.0f; 830 diffuse[1] = 1.0f; 831 diffuse[2] = 1.0f; 832 833 #endif 822 834 823 835 glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3192 r3193 6 6 //-- ssao + gi parameters 7 7 8 //#define NUM_SAMPLES 88 #define NUM_SAMPLES 8 9 9 //#define NUM_SAMPLES 16 10 #define NUM_SAMPLES 48 10 //#define NUM_SAMPLES 24 11 11 12 12 // for quadratic falloff 13 #define SAMPLE_INTENSITY 0. 2f13 #define SAMPLE_INTENSITY 0.5f 14 14 //#define SAMPLE_INTENSITY 0.1f 15 15 … … 17 17 //#define SAMPLE_INTENSITY 0.2f 18 18 19 #define SAMPLE_RADIUS 8e-1f20 //#define SAMPLE_RADIUS 4e-1f19 //#define SAMPLE_RADIUS 8e-1f 20 #define SAMPLE_RADIUS 4e-1f 21 21 22 22 //#define DISTANCE_SCALE 1e-1f … … 30 30 //#define NUM_SSAO_FILTERSAMPLES 80 31 31 #define NUM_SSAO_FILTER_SAMPLES 16 32 #define NUM_SSAO_FILTER_WIDTH 1 5.0f32 #define NUM_SSAO_FILTER_WIDTH 12.0f 33 33 #define SSAO_CONVERGENCE_WEIGHT 200.0f 34 34 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3192 r3193 104 104 float total_w = .0f; 105 105 106 const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr); 106 //const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr); 107 const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 107 108 const float3 centerNormal = tex2Dlod(normalsTex, float4(texCoord, 0, 0)).xyz; 108 109 … … 127 128 128 129 // check spatial discontinuity 129 samplePos = ReconstructSamplePos(ssaoTex, sampleTexCoord.xy, bl, br, tl, tr); 130 // using the depth from the color texture is not 100% correct as depth was 131 // not scaled with the interpolated view vector depth yet ... 132 samplePos = ReconstructSamplePos(colorsTex, sampleTexCoord.xy, bl, br, tl, tr); 133 //samplePos = ReconstructSamplePos(ssaoTex, sampleTexCoord.xy, bl, br, tl, tr); 134 130 135 len = min(SqrLen(centerPos - samplePos), 1e3f); 131 136 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3192 r3193 1 1 #include "../shaderenv.h" 2 2 #include "common.h" 3 3 4 4 struct fragment … … 17 17 float3 diffVal: COLOR2; 18 18 }; 19 20 21 float2 myreflect(float2 pt, float2 n)22 {23 // distance to plane24 float d = dot(n, pt);25 // reflect around plane26 float2 rpt = pt - d * 2.0f * n;27 28 return rpt;29 }30 19 31 20 … … 123 112 124 113 return total_d; 125 }126 127 128 inline float3 Interpol(float2 w, float3 bl, float3 br, float3 tl, float3 tr)129 {130 float3 x1 = lerp(bl, tl, w.y);131 float3 x2 = lerp(br, tr, w.y);132 float3 v = lerp(x1, x2, w.x);133 134 return v;135 114 } 136 115 … … 157 136 158 137 const float3 normal = tex2D(normals, IN.texCoord.xy); 159 160 138 float4 color = tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 161 139 … … 166 144 167 145 const float eyeDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w; 168 169 146 const float4 worldPos = float4(eyePos - viewDir * eyeDepth, 1); 170 147 … … 197 174 // store scaled view vector from now on so wie don't have to normalize later (e.g., for ssao) 198 175 //OUT.color.w = color.w / lenView; 176 OUT.color.w = color.w; 199 177 200 178 return OUT; … … 217 195 return color; 218 196 } 219 220 221 222 inline float SqrLen(float3 v)223 {224 return v.x * v.x + v.y * v.y + v.z * v.z;225 }226 227 197 228 198 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg
r3110 r3193 83 83 0.055648f, -0.204043f, 1.057311f); 84 84 85 //float3 hcol = mul(conv_Mat, XYZ);86 //OUT.color = float4(hcol, 1.0f);87 85 OUT.color = float4(mul(conv_Mat, XYZ), 1.0f); 88 86 … … 102 100 103 101 pix.col = IN.hdrColor; 102 //pix.col.xyz = float3(0.3f, 0.6f, 1.0f); 103 // set depth to large value 104 104 pix.col.w = 1e20f; 105 105 pix.norm = IN.normal; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3192 r3193 153 153 sample normal as weight. 154 154 */ 155 float 2ssao2(fragment IN,155 float3 ssao2(fragment IN, 156 156 sampler2D colors, 157 157 sampler2D noiseTex, … … 230 230 // check if the samples have been valid in the last frame 231 231 //numSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 232 numSamples += 1.0f - sampleColor.x; 233 } 234 235 return float2(max(0.0f, 1.0f - total_ao), numSamples); 232 ++ numSamples; 233 } 234 235 total_ao /= numSamples; 236 237 return float3(max(0.0f, 1.0f - total_ao), .0f, numSamples); 236 238 } 237 239 … … 316 318 317 319 ++ numSamples; 318 if ((validSamples < 1.0f) && (newWeight > 20) && (numSamples >= 8)) break;320 //if ((validSamples < 1.0f) && (newWeight > 20) && (numSamples >= 8)) break; 319 321 } 320 322 … … 391 393 if (eyeSpaceDepth < 1e10f) 392 394 { 393 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight);394 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals);395 //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 396 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 395 397 } 396 398 else
Note: See TracChangeset
for help on using the changeset viewer.