- Timestamp:
- 10/07/08 03:02:30 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.sln
r2961 r3010 2 2 Microsoft Visual Studio Solution File, Format Version 9.00 3 3 # Visual Studio 2005 4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = " friendlyculling", "FriendlyCulling.vcproj", "{03661866-4093-4B02-B26A-028EA91AF023}"4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DemoEngine", "FriendlyCulling.vcproj", "{03661866-4093-4B02-B26A-028EA91AF023}" 5 5 EndProject 6 6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Converter", "Converter.vcproj", "{93A522E1-76F0-4D46-9C97-30DC2DDB531D}" 7 EndProject 8 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FriendlyCulling", "MainApp.vcproj", "{A564071F-D054-4556-883B-999D7F9CC58C}" 9 ProjectSection(ProjectDependencies) = postProject 10 {03661866-4093-4B02-B26A-028EA91AF023} = {03661866-4093-4B02-B26A-028EA91AF023} 11 EndProjectSection 7 12 EndProject 8 13 Global … … 20 25 {93A522E1-76F0-4D46-9C97-30DC2DDB531D}.Release|Win32.ActiveCfg = Release|Win32 21 26 {93A522E1-76F0-4D46-9C97-30DC2DDB531D}.Release|Win32.Build.0 = Release|Win32 27 {A564071F-D054-4556-883B-999D7F9CC58C}.Debug|Win32.ActiveCfg = Debug|Win32 28 {A564071F-D054-4556-883B-999D7F9CC58C}.Debug|Win32.Build.0 = Debug|Win32 29 {A564071F-D054-4556-883B-999D7F9CC58C}.Release|Win32.ActiveCfg = Release|Win32 30 {A564071F-D054-4556-883B-999D7F9CC58C}.Release|Win32.Build.0 = Release|Win32 22 31 EndGlobalSection 23 32 GlobalSection(SolutionProperties) = preSolution -
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r2980 r3010 3 3 ProjectType="Visual C++" 4 4 Version="8,00" 5 Name=" friendlyculling"5 Name="DemoEngine" 6 6 ProjectGUID="{03661866-4093-4B02-B26A-028EA91AF023}" 7 7 RootNamespace="chc_revisited" … … 98 98 <Configuration 99 99 Name="Release|Win32" 100 OutputDirectory="$(SolutionDir)/ bin/$(ConfigurationName)"100 OutputDirectory="$(SolutionDir)/lib/$(ConfigurationName)" 101 101 IntermediateDirectory="obj/$(ConfigurationName)" 102 ConfigurationType=" 1"102 ConfigurationType="4" 103 103 CharacterSet="1" 104 104 WholeProgramOptimization="1" … … 150 150 /> 151 151 <Tool 152 Name="VCLinkerTool" 153 AdditionalDependencies="glut32.lib glew32s.lib glew32.lib DevIL.lib ILUT.lib zlib.lib cg.lib cgGL.lib" 154 LinkIncremental="1" 155 AdditionalLibraryDirectories="libs/GL;libs/Devil/lib;libs/Zlib/lib;"$(CG_LIB_PATH)"" 156 IgnoreAllDefaultLibraries="false" 157 IgnoreDefaultLibraryNames="LIBCMT" 158 GenerateDebugInformation="false" 159 SubSystem="1" 160 OptimizeReferences="2" 161 EnableCOMDATFolding="2" 162 OptimizeForWindows98="1" 163 TargetMachine="1" 152 Name="VCLibrarianTool" 164 153 /> 165 154 <Tool … … 167 156 /> 168 157 <Tool 169 Name="VCManifestTool"170 />171 <Tool172 158 Name="VCXDCMakeTool" 173 159 /> … … 177 163 <Tool 178 164 Name="VCFxCopTool" 179 />180 <Tool181 Name="VCAppVerifierTool"182 />183 <Tool184 Name="VCWebDeploymentTool"185 165 /> 186 166 <Tool … … 240 220 </File> 241 221 <File 222 RelativePath=".\src\IrradianceMap.cpp" 223 > 224 </File> 225 <File 226 RelativePath=".\src\IrradianceMap.h" 227 > 228 </File> 229 <File 242 230 RelativePath=".\src\MotionPath.cpp" 243 231 > … … 269 257 <File 270 258 RelativePath=".\src\SceneEntityConverter.h" 271 >272 </File>273 <File274 RelativePath=".\src\shaderenv.h"275 259 > 276 260 </File> … … 531 515 </File> 532 516 <File 517 RelativePath=".\src\shaderenv.h" 518 > 519 </File> 520 <File 533 521 RelativePath=".\src\ShadowMapping.h" 534 522 > … … 599 587 /> 600 588 </FileConfiguration> 601 </File>602 <File603 RelativePath=".\src\chcdemo.cpp"604 >605 589 </File> 606 590 <File -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3009 r3010 573 573 sColorsTexDownSampleParam = cgGetNamedParameter(sCgDownSampleProgram, "colors"); 574 574 sDownSampleOffsetParam = cgGetNamedParameter(sCgDownSampleProgram, "downSampleOffs"); 575 576 float downSampleOffsets[8];577 578 float w = 1028;579 float h = 768;580 581 float xoffs = 0.5f / w;582 float yoffs = 0.5f / h;583 584 downSampleOffsets[0] = xoffs; downSampleOffsets[1] = yoffs;585 downSampleOffsets[2] = xoffs; downSampleOffsets[3] = -yoffs;586 downSampleOffsets[4] = -xoffs; downSampleOffsets[5] = -yoffs;587 downSampleOffsets[6] = -xoffs; downSampleOffsets[7] = yoffs;588 589 cgGLSetParameterArray2f(sDownSampleOffsetParam, 0, 4, (const float *)downSampleOffsets);590 575 } 591 576 else … … 1214 1199 { 1215 1200 // hack: estimate value where sky burns out 1216 whiteLum = log( 1e4f);1201 whiteLum = log(WHITE_LUMINANCE); 1217 1202 1218 1203 //////////////////// … … 1298 1283 1299 1284 1285 static void ComputeDownsSampleOffsets(float *downSampleOffsets, int w, int h) 1286 { 1287 /* 1288 float downSampleOffsets[8]; 1289 1290 const float xoffs = 0.5f / w; 1291 const float yoffs = 0.5f / h; 1292 1293 downSampleOffsets[0] = xoffs; downSampleOffsets[1] = yoffs; 1294 downSampleOffsets[2] = xoffs; downSampleOffsets[3] = -yoffs; 1295 downSampleOffsets[4] = -xoffs; downSampleOffsets[5] = -yoffs; 1296 downSampleOffsets[6] = -xoffs; downSampleOffsets[7] = yoffs; 1297 */ 1298 const float xoffs = .5f / w; 1299 const float yoffs = .5f / h; 1300 1301 int idx = 0; 1302 1303 for (int x = -1; x <= 1; ++ x) 1304 { 1305 for (int y = -1; y <= 1; ++ y) 1306 { 1307 downSampleOffsets[idx + 0] = x * xoffs; 1308 downSampleOffsets[idx + 1] = y * yoffs; 1309 1310 idx += 2; 1311 } 1312 } 1313 } 1314 1315 1300 1316 void DeferredRenderer::DownSample(FrameBufferObject *fbo, int bufferIdx, 1301 1317 FrameBufferObject *downSampleFbo, 1302 1318 int downSampleBufferIdx) 1303 1319 { 1320 float downSampleOffsets[NUM_DOWNSAMPLES * 2]; 1321 ComputeDownsSampleOffsets(downSampleOffsets, fbo->GetWidth(), fbo->GetHeight()); 1322 1304 1323 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(bufferIdx); 1305 1324 GLuint colorsTex = colorBuffer->GetTexture(); … … 1312 1331 cgGLSetTextureParameter(sColorsTexDownSampleParam, colorsTex); 1313 1332 cgGLEnableTextureParameter(sColorsTexDownSampleParam); 1333 1334 cgGLSetParameterArray2f(sDownSampleOffsetParam, 0, NUM_DOWNSAMPLES, (const float *)downSampleOffsets); 1314 1335 1315 1336 mDownSampleFbo->Bind(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3009 r3010 59 59 /// the renderable scene geometry 60 60 SceneEntityContainer sceneEntities; 61 SceneEntityContainer sceneEntities2;62 61 // traverses and renders the hierarchy 63 62 RenderTraverser *traverser = NULL; … … 1828 1827 DEL_PTR(ssaoShader); 1829 1828 1830 CLEAR_CONTAINER(sceneEntities2);1831 1832 1829 if (sCgMrtVertexProgram) 1833 1830 cgDestroyProgram(sCgMrtVertexProgram); … … 2030 2027 2031 2028 if (!showAlgorithmTime) 2032 { 2033 sprintf(msg[7], "%s: %6.1f fps", alg_str[renderMode], fps); 2034 } 2029 sprintf(msg[7], "%s: %6.1f fps", alg_str[renderMode], fps); 2035 2030 else 2036 {2037 2031 sprintf(msg[7], "%s: %6.1f ms", alg_str[renderMode], rTime); 2038 } 2039 2032 2040 2033 myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color); 2041 2034 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3009 r3010 9 9 //#define NUM_SAMPLES 16 10 10 11 // for linear falloff 12 //#define SAMPLE_INTENSITY 500.0f 11 // for quadratic falloff 12 #define SAMPLE_INTENSITY 0.35f 13 //#define SAMPLE_INTENSITY 0.32f 13 14 14 // for quadratic falloff15 #define SAMPLE_INTENSITY 0.32f16 //#define SAMPLE_INTENSITY 0.85f17 18 //#define AREA_SIZE 15e-1f19 15 #define AREA_SIZE 8e-1f 20 21 #define VIEW_CORRECTION_SCALE 0.0f22 //#define VIEW_CORRECTION_SCALE 0.1f23 16 24 17 //#define DISTANCE_SCALE 1e-4f … … 26 19 27 20 #define ILLUM_INTENSITY 5e-1f; 28 //#define ILLUM_INTENSITY 9e-1f;29 21 30 #define SSAO_MIPMAP_LEVEL 0//1 31 #define GI_MIPMAP_LEVEL 0//2 22 #define VIEW_CORRECTION_SCALE 0.1f 32 23 33 24 … … 47 38 #define LOGLUM_RANGE 20.0f 48 39 49 #define MAX_LOD_LEVEL 9940 #define MAX_LOD_LEVEL 10 50 41 51 #define MIN_DEPTH_DIFF 1e-5f 42 #define MIN_DEPTH_DIFF 1e-3f 43 // burnout 44 #define WHITE_LUMINANCE 3e4f 45 46 /////////////////// 47 48 #define NUM_DOWNSAMPLES 9 52 49 53 50 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r3009 r3010 103 103 //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f)) ++ numSamples; 104 104 105 105 106 ////////// 106 107 //-- reconstruct world space position from sample 107 108 108 float4 sample = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL));109 float4 sample = tex2Dlod(colors, float4(texcoord, 0, 0)); 109 110 const float eyeSpaceDepth = sample.w; 110 111 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3009 r3010 52 52 { 53 53 #if USE_EYE_SPACE_DEPTH 54 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w;54 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, 0)).w; 55 55 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 56 56 float3 rotView = Interpol(texcoord, bl, br, tl, tr); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao3d.cg
r2998 r3010 76 76 ++ j; 77 77 // sample downsampled texture in order to speed up texture accesses 78 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz;78 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 0)).xyz; 79 79 //float3 sample_position = tex2D(positions, texcoord).xyz; 80 80 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r3008 r3010 20 20 21 21 22 float4 DownSample(frag IN,22 /*float4 DownSample(frag IN, 23 23 uniform sampler2D colors, 24 uniform float2 downSampleOffs[ 4]): COLOR24 uniform float2 downSampleOffs[9]): COLOR 25 25 { 26 26 float4 average = .0f; 27 27 28 for(int i = 0; i < 4; ++ i) 28 const float4 avgColor = tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 29 30 float j = 0; 31 float4 color; 32 33 for (int i = 0; i < 9; ++ i) 29 34 { 30 average += tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i],0,0)); 35 color = tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i], 0, 0)); 36 if (abs(color.w - avgColor.w) < 1e-3f) 37 { 38 average += color; 39 ++ j; 40 } 31 41 } 32 42 33 average *= 1.0f / 4.0f; 43 //average *= 1.0f / 9.0f; 44 average *= 1.0f / j; 45 46 return average; 47 }*/ 48 49 float4 DownSample(frag IN, 50 uniform sampler2D colors, 51 uniform float2 downSampleOffs[NUM_DOWNSAMPLES]): COLOR 52 { 53 float4 average = .0f; 54 55 for (int i = 0; i < NUM_DOWNSAMPLES; ++ i) 56 { 57 average += tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i], 0, 0)); 58 } 59 60 average *= 1.0f / (float)NUM_DOWNSAMPLES; 34 61 35 62 return average; 36 63 } 37 64 65 66 /** Does the first downsampling step and on the same time calculates the 67 intensity. 68 */ 38 69 39 70 float4 GreyScaleDownSample(frag IN, 40 uniform sampler2D colors 71 uniform sampler2D colors, 72 uniform float2 downSampleOffs[4] 41 73 ): COLOR 42 74 { … … 50 82 //float3 w = float3(0.2125f, 0.7154f, 0.0721f); 51 83 52 float4 cols[4]; 53 54 cols[0] = tex2D(colors, IN.lt); 55 cols[1] = tex2D(colors, IN.lb); 56 cols[2] = tex2D(colors, IN.rt); 57 cols[3] = tex2D(colors, IN.rb); 84 float4 color; 58 85 59 86 for (int i = 0; i < 4; ++ i) 60 87 { 88 color = tex2D(colors, downSampleOffs[i]); 89 61 90 const float intensity = dot(cols[i].rgb, w); 62 91 … … 65 94 } 66 95 67 average = exp(average * 0.25f);96 average *= 0.25f; 68 97 69 float4 c = cols[0] + cols[1] + cols[2] + cols[3];70 71 return c * 0.25f;72 98 // Output the luminance to the render target 73 //return float4(average, maximum, 0.0f, 1.0f);99 return float4(average, maximum, 0.0f, 1.0f); 74 100 } 75 101 102 103 /** Used for downsampling the tone map parameters (average loglum, maximum) 104 to the next lower level. This has to be applied until there is only 105 a 1x1 texture which holds the required numbers. 106 */ 107 float4 DownSampleForToneMapping(frag IN, 108 uniform sampler2D colors, 109 uniform float2 downSampleOffs[4]): COLOR 110 { 111 float average = .0f; 112 float maximum = .0f; 113 114 float4 color; 115 116 for (int i = 0; i < 4; ++ i) 117 { 118 color = tex2D(colors, downSampleOffs[i]); 119 120 maximum = max(maximum, color.y); 121 average += color.x; 122 } 123 124 average *= 1.0f / (float)NUM_DOWNSAMPLES; 125 126 return float4(average, maximum, 0.0f, 1.0f); 127 } 128 129 76 130 77 131 pixel ToneMap(frag IN,
Note: See TracChangeset
for help on using the changeset viewer.