Changeset 2978 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 09/26/08 22:36:20 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2977 r2978 29 29 static CGparameter sColorsTexDeferredParam; 30 30 static CGparameter sOldColorsTexDeferredParam; 31 static CGparameter sOldColorsTexShadowParam; 31 32 32 33 static CGparameter sPositionsTexDeferredParam; … … 468 469 sLightDirShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "lightDir"); 469 470 471 sOldColorsTexShadowParam = cgGetNamedParameter(sCgDeferredShadowProgram, "oldColors"); 472 470 473 471 474 PoissonDiscSampleGenerator2 poisson(NUM_PCF_TABS, 1.0f); … … 1056 1059 GLuint shadowTex = shadowMap->GetDepthTexture(); 1057 1060 1061 GLuint oldColorsTex = fbo->GetColorBuffer(3 - colorBufferIdx)->GetTexture(); 1062 1058 1063 Matrix4x4 shadowMatrix; 1059 1064 shadowMap->GetTextureMatrix(shadowMatrix); … … 1078 1083 cgGLSetTextureParameter(sShadowMapParam, shadowTex); 1079 1084 cgGLEnableTextureParameter(sShadowMapParam); 1085 1086 cgGLSetTextureParameter(sOldColorsTexShadowParam, oldColorsTex); 1087 cgGLEnableTextureParameter(sOldColorsTexShadowParam); 1080 1088 1081 1089 cgGLSetParameter1f(sMaxDepthShadowParam, mScaleFactor); … … 1111 1119 cgGLDisableTextureParameter(sNormalsTexShadowParam); 1112 1120 cgGLDisableTextureParameter(sShadowMapParam); 1121 1122 cgGLDisableTextureParameter(sOldColorsTexShadowParam); 1113 1123 1114 1124 cgGLDisableTextureParameter(sNoiseTexShadowParam); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2977 r2978 924 924 cgGLEnableProfile(RenderState::sCgFragmentProfile); 925 925 cgGLBindProgram(RenderState::sCgMrtFragmentProgram); 926 927 // draw to 3 color buffers 928 // a color, normal, and positions buffer 929 if (sCurrentMrtSet == 0) 930 { 931 DeferredRenderer::colorBufferIdx = 0; 932 glDrawBuffers(3, mrt); 933 } 934 else 935 { 936 DeferredRenderer::colorBufferIdx = 3; 937 glDrawBuffers(3, mrt2); 938 } 939 sCurrentMrtSet = 1 - sCurrentMrtSet; 926 940 } 927 941 … … 1051 1065 InitDeferredRendering(); 1052 1066 1053 // draw to 3 color buffers1054 // a color, normal, and positions buffer1055 if (sCurrentMrtSet == 0)1056 {1057 DeferredRenderer::colorBufferIdx = 0;1058 glDrawBuffers(3, mrt);1059 }1060 else1061 {1062 DeferredRenderer::colorBufferIdx = 3;1063 glDrawBuffers(3, mrt2);1064 }1065 sCurrentMrtSet = 1 - sCurrentMrtSet;1066 1067 1067 glEnableClientState(GL_NORMAL_ARRAY); 1068 1068 … … 2024 2024 InitDeferredRendering(); 2025 2025 2026 // draw to 3 color buffers2027 glDrawBuffers(3, mrt);2028 2026 glClear(GL_COLOR_BUFFER_BIT); 2029 2027 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r2975 r2978 47 47 #define LOGLUM_RANGE 20.0f 48 48 49 #define MAX_LOD_LEVEL 99 50 49 51 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2977 r2978 87 87 //-- write out logaritmic luminance for tone mapping 88 88 89 float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 99));89 float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL)); 90 90 91 91 const float3 w = float3(0.299f, 0.587f, 0.114f); … … 157 157 uniform sampler2D noiseTexture, 158 158 uniform float2 samples[NUM_PCF_TABS], 159 uniform float3 lightDir 159 uniform float3 lightDir, 160 uniform sampler2D oldColors 160 161 ) 161 162 { … … 201 202 OUT.color = (emmisive > 1.5f) ? color: (ambient + diffuse) * color; 202 203 204 203 205 //////////// 204 206 //-- write out logaritmic luminance for tone mapping 205 207 208 float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL)); 209 206 210 const float3 w = float3(0.299f, 0.587f, 0.114f); 207 211 … … 212 216 float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset; 213 217 214 OUT.color.w = logLumScaled; 218 if (oldColor.w > 0) 219 OUT.color.w = lerp(oldColor.w, logLumScaled, 0.2f); 220 else 221 OUT.color.w = logLumScaled; 215 222 216 223 return OUT; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2975 r2978 52 52 float numSamples = 0; 53 53 54 // avoid singularity of 55 centerPosition.xyz += currentNormal * 1e-4f; 56 54 57 for (int i = 0; i < NUM_SAMPLES; ++ i) 55 58 { … … 82 85 const float cos_angle = max(dot(direction_to_sample, currentNormal), 0.0f); 83 86 84 // distance between current position and sample position controls AO intensity.85 87 const float distance_intensity = 86 88 (SAMPLE_INTENSITY * DISTANCE_SCALE) / (DISTANCE_SCALE + length_to_sample * length_to_sample);
Note: See TracChangeset
for help on using the changeset viewer.