Changeset 3079 for GTP/trunk/App/Demos
- Timestamp:
- 10/29/08 18:21:41 (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
r3068 r3079 732 732 glDrawBuffers(1, mrt + colorBufferIdx); 733 733 734 float filterOffsets[NUM_ DOWNSAMPLES * 2];735 float filterWeights[NUM_ DOWNSAMPLES];736 737 PoissonDiscSampleGenerator2 poisson(NUM_ DOWNSAMPLES, 1.0f);734 float filterOffsets[NUM_SSAO_FILTERSAMPLES * 2]; 735 float filterWeights[NUM_SSAO_FILTERSAMPLES]; 736 737 PoissonDiscSampleGenerator2 poisson(NUM_SSAO_FILTERSAMPLES, 1.0f); 738 738 poisson.Generate((float *)filterOffsets); 739 739 740 const float xoffs = 2.0f / fbo->GetWidth(); 741 const float yoffs = 2.0f / fbo->GetHeight(); 742 743 for (int i = 0; i < NUM_DOWNSAMPLES; ++ i) 740 const float filterWidth = 10.0f; 741 const float xoffs = filterWidth / fbo->GetWidth(); 742 const float yoffs = filterWidth / fbo->GetHeight(); 743 744 for (int i = 0; i < NUM_SSAO_FILTERSAMPLES; ++ i) 744 745 { 745 746 float x = filterOffsets[2 * i + 0]; … … 756 757 sCgCombineSsaoProgram->SetTexture(1, ssaoTex); 757 758 758 sCgCombineSsaoProgram->SetArray2f(2, (float *)filterOffsets, NUM_ DOWNSAMPLES);759 sCgCombineSsaoProgram->SetArray1f(3, (float *)filterWeights, NUM_ DOWNSAMPLES);759 sCgCombineSsaoProgram->SetArray2f(2, (float *)filterOffsets, NUM_SSAO_FILTERSAMPLES); 760 sCgCombineSsaoProgram->SetArray1f(3, (float *)filterWeights, NUM_SSAO_FILTERSAMPLES); 760 761 761 762 DrawQuad(sCgCombineSsaoProgram); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3078 r3079 458 458 //-- load some dynamic stuff 459 459 460 LoadModel("hbuddha.dem", dynamicObjects);460 /*LoadModel("hbuddha.dem", dynamicObjects); 461 461 buddha = dynamicObjects.back(); 462 462 … … 480 480 ent->SetTransform(transform); 481 481 dynamicObjects.push_back(ent); 482 } 482 }*/ 483 483 484 484 … … 880 880 881 881 Matrix4x4 mat = TranslationMatrix(planepos); 882 buddha->GetTransform()->SetMatrix(mat);882 //buddha->GetTransform()->SetMatrix(mat); 883 883 884 884 Vector3 oldPos = camera->GetPosition(); … … 942 942 943 943 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 944 945 944 glEnableClientState(GL_NORMAL_ARRAY); 946 947 945 break; 948 946 … … 963 961 // (should be handled by render state) 964 962 glShadeModel(GL_FLAT); 965 966 967 963 break; 968 964 … … 978 974 // (should be handled by render state) 979 975 glShadeModel(GL_FLAT); 980 981 982 976 break; 983 977 … … 994 988 glEnableClientState(GL_NORMAL_ARRAY); 995 989 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 996 997 990 break; 998 991 } … … 1019 1012 } 1020 1013 else 1021 { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);1014 { 1022 1015 // actually render the scene geometry using the specified algorithm 1023 1016 traverser->RenderScene(); 1024 //for (int i = 0; i < sceneEntities.size(); ++ i)1025 // sceneEntities[i]->Render(&state);1026 1017 } 1027 1018 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3017 r3079 10 10 11 11 // for quadratic falloff 12 #define SAMPLE_INTENSITY 0.1f13 //#define SAMPLE_INTENSITY 0.2f12 //#define SAMPLE_INTENSITY 0.1f 13 #define SAMPLE_INTENSITY 0.07f 14 14 15 15 #define SAMPLE_RADIUS 8e-1f … … 44 44 #define WHITE_LUMINANCE 3e4f 45 45 46 46 47 /////////////////// 47 48 48 49 #define NUM_DOWNSAMPLES 16 49 50 51 #define NUM_SSAO_FILTERSAMPLES 100 50 52 51 53 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3034 r3079 236 236 float Filter(float2 texCoord, 237 237 uniform sampler2D ssaoTex, 238 uniform float2 filterOffs[NUM_ DOWNSAMPLES],239 uniform float filterWeights[NUM_ DOWNSAMPLES]238 uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 239 uniform float filterWeights[NUM_SSAO_FILTERSAMPLES] 240 240 ) 241 241 { … … 243 243 float w = .0f; 244 244 245 for (int i = 0; i < NUM_ DOWNSAMPLES; ++ i)245 for (int i = 0; i < NUM_SSAO_FILTERSAMPLES; ++ i) 246 246 { 247 247 average += filterWeights[i] * tex2Dlod(ssaoTex, float4(texCoord + filterOffs[i], 0, 0)).x; … … 258 258 uniform sampler2D colors, 259 259 uniform sampler2D ssaoTex, 260 uniform float2 filterOffs[NUM_ DOWNSAMPLES],261 uniform float filterWeights[NUM_ DOWNSAMPLES]260 uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 261 uniform float filterWeights[NUM_SSAO_FILTERSAMPLES] 262 262 ) 263 263 { … … 267 267 float3 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 268 268 269 //if (ao.y < 2000.0f)270 //ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights);269 if (ao.y < 10.0f) 270 ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights); 271 271 272 272 OUT.illum_col = col * ao.x;
Note: See TracChangeset
for help on using the changeset viewer.