Changeset 3006 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 10/06/08 03:02:23 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3005 r3006 87 87 88 88 static CGparameter sOldModelViewProjMatrixGiParam; 89 static CGparameter sModelViewProjMatrixGiParam; 89 90 static CGparameter sMaxDepthGiParam; 90 91 static CGparameter sSamplesGiParam; … … 286 287 //-- the flip-flop fbos 287 288 288 mFbo = new FrameBufferObject(w , h, FrameBufferObject::DEPTH_NONE);289 mFbo = new FrameBufferObject(w / 2, h / 2, FrameBufferObject::DEPTH_NONE); 289 290 290 291 mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); … … 297 298 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 298 299 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 299 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 300 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 300 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 301 301 } 302 302 … … 406 406 407 407 sOldModelViewProjMatrixGiParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj"); 408 sModelViewProjMatrixGiParam = cgGetNamedParameter(sCgGiProgram, "modelViewProj"); 408 409 sMaxDepthGiParam = cgGetNamedParameter(sCgGiProgram, "maxDepth"); 409 410 sTemporalCoherenceGiParam = cgGetNamedParameter(sCgGiProgram, "temporalCoherence"); … … 576 577 float h = 768; 577 578 578 float xoffs = 1/ w;579 float yoffs = 1/ h;579 float xoffs = 0.5f / w; 580 float yoffs = 0.5f / h; 580 581 581 582 downSampleOffsets[0] = xoffs; downSampleOffsets[1] = yoffs; … … 609 610 mFboIndex = 2 - mFboIndex; 610 611 612 611 613 FrameBufferObject::Release(); 612 614 cgGLEnableProfile(RenderState::sCgFragmentProfile); … … 638 640 { 639 641 case SSAO: 642 DownSample(fbo, colorBufferIdx, mDownSampleFbo, 0); 643 DownSample(fbo, 1, mDownSampleFbo, 1); 644 DownSample(fbo, 2, mDownSampleFbo, 2); 645 640 646 ComputeSsao(fbo, tempCohFactor, oldProjViewMatrix, projViewMatrix); 641 647 CombineSsao(fbo); 642 648 break; 643 649 case GI: 644 DownSample(fbo); 645 ComputeGlobIllum(fbo, tempCohFactor, oldProjViewMatrix); 650 DownSample(fbo, colorBufferIdx, mDownSampleFbo, 0); 651 DownSample(fbo, 2, mDownSampleFbo, 2); 652 ComputeGlobIllum(fbo, tempCohFactor, projViewMatrix, oldProjViewMatrix); 646 653 CombineIllum(fbo); 647 654 break; … … 698 705 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 699 706 700 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 701 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 702 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 703 704 // generate mip map levels of position in order to improve texture lookup performance 705 //glBindTexture(GL_TEXTURE_2D, positionsTex); glGenerateMipmapEXT(GL_TEXTURE_2D); 706 //glBindTexture(GL_TEXTURE_2D, colorsTex); glGenerateMipmapEXT(GL_TEXTURE_2D); 707 //GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 708 //GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 709 //GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 710 711 GLuint colorsTex = mDownSampleFbo->GetColorBuffer(0)->GetTexture(); 712 GLuint positionsTex = mDownSampleFbo->GetColorBuffer(1)->GetTexture(); 713 GLuint normalsTex = mDownSampleFbo->GetColorBuffer(2)->GetTexture(); 714 715 glPushAttrib(GL_VIEWPORT_BIT); 716 glViewport(0, 0, mFbo->GetWidth(), mFbo->GetHeight()); 707 717 708 718 // read the second buffer, write to the first buffer … … 711 721 712 722 GLuint oldTex = mFbo->GetColorBuffer(2 - mFboIndex)->GetTexture(); 713 714 723 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 715 724 716 cgGLEnableProfile(RenderState::sCgFragmentProfile);717 725 cgGLBindProgram(sCgSsaoProgram); 718 726 … … 782 790 cgGLDisableTextureParameter(sOldTexParam); 783 791 784 792 glPopAttrib(); 785 793 FrameBufferObject::Release(); 786 794 … … 823 831 GLuint colorsTex = colorBuffer->GetTexture(); 824 832 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 825 826 833 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 827 828 cgGLEnableProfile(RenderState::sCgFragmentProfile);829 834 cgGLBindProgram(sCgAntiAliasingProgram); 830 835 … … 868 873 colorBufferIdx = 3 - colorBufferIdx; 869 874 glDrawBuffers(1, mrt + colorBufferIdx); 870 875 871 876 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 872 cgGLEnableProfile(RenderState::sCgFragmentProfile); 873 877 874 878 cgGLBindProgram(sCgDeferredProgram); 875 879 … … 904 908 cgGLDisableTextureParameter(sNormalsTexDeferredParam); 905 909 906 cgGLDisableProfile(RenderState::sCgFragmentProfile);907 908 910 FrameBufferObject::Release(); 909 911 … … 915 917 void DeferredRenderer::ComputeGlobIllum(FrameBufferObject *fbo, 916 918 float tempCohFactor, 919 const Matrix4x4 &projViewMatrix, 917 920 const Matrix4x4 &oldProjViewMatrix) 918 921 { 919 922 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x); 920 921 // GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 923 cgGLSetMatrixParameterfc(sModelViewProjMatrixGiParam, (const float *)projViewMatrix.x); 924 925 //GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 922 926 GLuint colorsTex = mDownSampleFbo->GetColorBuffer(0)->GetTexture(); 923 927 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 924 GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture();925 926 // generate mip map levels for position texture927 //glBindTexture(GL_TEXTURE_2D, positionsTex); glGenerateMipmapEXT(GL_TEXTURE_2D);928 GLuint normalsTex = mDownSampleFbo->GetColorBuffer(2)->GetTexture(); 929 930 glPushAttrib(GL_VIEWPORT_BIT); 931 glViewport(0, 0, mFbo->GetWidth(), mFbo->GetHeight()); 928 932 929 933 // read the second buffer, write to the first buffer … … 934 938 GLuint oldSsaoTex = mFbo->GetColorBuffer(2 - mFboIndex)->GetTexture(); 935 939 GLuint oldIllumTex = mFbo->GetColorBuffer(2 - mFboIndex + 1)->GetTexture(); 936 940 937 941 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 938 942 939 cgGLEnableProfile(RenderState::sCgFragmentProfile);940 943 cgGLBindProgram(sCgGiProgram); 941 944 … … 1015 1018 FrameBufferObject::Release(); 1016 1019 1020 glPopAttrib(); 1021 1017 1022 PrintGLerror("globillum first pass"); 1018 1023 } … … 1033 1038 1034 1039 glDrawBuffers(1, mrt + colorBufferIdx); 1035 1036 cgGLEnableProfile(RenderState::sCgFragmentProfile);1037 1040 1038 1041 cgGLBindProgram(sCgCombinedIllumProgram); … … 1067 1070 cgGLDisableTextureParameter(sIllumTexCombinedIllumParam); 1068 1071 1069 cgGLDisableProfile(RenderState::sCgFragmentProfile);1070 1071 1072 FrameBufferObject::Release(); 1072 1073 … … 1089 1090 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1090 1091 1091 cgGLEnableProfile(RenderState::sCgFragmentProfile);1092 1093 1092 cgGLBindProgram(sCgCombinedSsaoProgram); 1094 1093 … … 1116 1115 cgGLDisableTextureParameter(sSsaoTexCombinedSsaoParam); 1117 1116 1118 cgGLDisableProfile(RenderState::sCgFragmentProfile);1119 1120 1117 FrameBufferObject::Release(); 1121 1118 … … 1250 1247 glDrawBuffers(1, mrt + colorBufferIdx); 1251 1248 1252 1253 1249 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1254 1250 1255 cgGLEnableProfile(RenderState::sCgFragmentProfile);1256 1251 cgGLBindProgram(sCgLogLumProgram); 1257 1252 … … 1314 1309 1315 1310 1316 void DeferredRenderer::DownSample(FrameBufferObject *fbo) 1317 { 1318 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 1311 void DeferredRenderer::DownSample(FrameBufferObject *fbo, int bufferIdx, 1312 FrameBufferObject *downSampleFbo, 1313 int downSampleBufferIdx) 1314 { 1315 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(bufferIdx); 1319 1316 GLuint colorsTex = colorBuffer->GetTexture(); 1320 1321 cgGLEnableProfile(RenderState::sCgFragmentProfile); 1317 1318 glPushAttrib(GL_VIEWPORT_BIT); 1319 glViewport(0, 0, downSampleFbo->GetWidth(), downSampleFbo->GetHeight()); 1320 1322 1321 cgGLBindProgram(sCgDownSampleProgram); 1323 1322 … … 1326 1325 1327 1326 mDownSampleFbo->Bind(); 1328 1329 glDrawBuffers(1, mrt); 1330 1327 glDrawBuffers(1, mrt + downSampleBufferIdx); 1328 1331 1329 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1332 1333 cgGLEnableProfile(RenderState::sCgFragmentProfile);1334 1330 cgGLBindProgram(sCgDownSampleProgram); 1335 1336 //glPushAttrib(GL_VIEWPORT_BIT); 1337 glViewport(0, 0, mWidth / 2, mHeight / 2); 1338 1339 glMatrixMode(GL_PROJECTION); 1340 glPushMatrix(); 1341 glLoadIdentity(); 1342 1343 const float offs2 = 0.5f; 1344 glOrtho(-offs2, offs2, -offs2, offs2, 0, 1); 1345 1346 glMatrixMode(GL_MODELVIEW); 1347 glPushMatrix(); 1348 glLoadIdentity(); 1349 1331 1350 1332 const float offs = 0.5f; 1351 1333 … … 1360 1342 1361 1343 cgGLDisableTextureParameter(sColorsTexDownSampleParam); 1362 1363 1344 FrameBufferObject::Release(); 1364 1345 1365 float *data = (float *)mDownSampleFbo->GetColorBuffer(0)->ReadTexture(); 1366 //float *data = (float *)mFbo->GetColorBuffer(colorBufferIdx)->ReadTexture(); 1346 /*float *data = (float *)mDownSampleFbo->GetColorBuffer(0)->ReadTexture(); 1367 1347 ExportData(data, mWidth / 2, mHeight / 2); 1368 //ExportData(data, mWidth, mHeight); 1369 1370 glMatrixMode(GL_PROJECTION); 1371 glPopMatrix(); 1372 glMatrixMode(GL_MODELVIEW); 1373 glPopMatrix(); 1374 1375 //glPopAttrib(); 1376 glViewport(0, 0, mWidth, mHeight); 1348 delete [] data;*/ 1349 1350 glPopAttrib(); 1351 1377 1352 PrintGLerror("downsample"); 1378 1379 delete [] data;1380 1353 } 1381 1354 … … 1394 1367 colorBufferIdx = 3 - colorBufferIdx; 1395 1368 glDrawBuffers(1, mrt + colorBufferIdx); 1396 1397 1369 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1398 1370 1399 cgGLEnableProfile(RenderState::sCgFragmentProfile);1400 1371 cgGLBindProgram(sCgToneProgram); 1401 1372 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r2994 r3006 72 72 const Matrix4x4 &projViewMatrix); 73 73 74 void ComputeGlobIllum(FrameBufferObject *fbo, float tempCohFactor, const Matrix4x4 & oldProjViewMatrix);74 void ComputeGlobIllum(FrameBufferObject *fbo, float tempCohFactor, const Matrix4x4 &projViewMatrix, const Matrix4x4 &oldProjViewMatrix); 75 75 76 76 void FirstPass(FrameBufferObject *fbo, DirectionalLight *light); … … 90 90 */ 91 91 void ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br); 92 93 void DownSample(FrameBufferObject *fbo);94 92 93 /** Downsample buffer of fbo to buffer of downSampleFbo. The downSampleFbo must have half the 94 resolution of fbo. 95 */ 96 void DownSample(FrameBufferObject *fbo, int bufferIdx, 97 FrameBufferObject *downSampleFbo, int downSampleBufferIdx); 95 98 96 99 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
r3005 r3006 116 116 unsigned int GetDepthTex() const { return mDepthTexId; } 117 117 118 inline int GetWidth() { return mWidth; } 119 120 inline int GetHeight() { return mHeight; } 121 122 118 123 protected: 119 124 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r3003 r3006 62 62 uniform float2 samples[NUM_SAMPLES], 63 63 uniform float3 currentNormal, 64 uniform float 4centerPosition,64 uniform float3 centerPosition, 65 65 float w, 66 66 uniform float3 eyePos, … … 103 103 //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f)) ++ numSamples; 104 104 105 // reconstruct world space position from sample 105 ////////// 106 //-- reconstruct world space position from sample 107 106 108 float4 sample = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)); 107 109 const float eyeSpaceDepth = sample.w; … … 118 120 float3 direction_to_sample = vector_to_sample / length_to_sample; 119 121 120 // Angle between current normal and direction to sample controls AO intensity.122 // use angle between current normal and direction to sample controls AO intensity. 121 123 float cos_angle = max(dot(direction_to_sample, currentNormal), 0); 122 124 … … 153 155 uniform sampler2D oldIllumTex, 154 156 const uniform float4x4 oldModelViewProj, 157 const uniform float4x4 modelViewProj, 155 158 uniform float maxDepth, 156 159 uniform float temporalCoherence, … … 166 169 float4 norm = tex2D(normals, IN.texCoord.xy); 167 170 float3 normal = normalize(norm.xyz); 168 // something like a constant ambient term169 const float amb = norm.w;170 171 /// the current view direction172 //float3 viewDir = normalize(IN.view);173 171 174 172 // the w coordinate from the persp. projection 175 173 float w = norm.w; 176 // the current world position 177 const float4 centerPosition2 = tex2D(positions, IN.texCoord.xy); 178 179 /// reconstruct position from the eye space depth 180 float3 viewDir = normalize(IN.view); 181 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 182 183 float4 centerPosition; 174 175 176 ///////////// 177 //-- reconstruct position from the eye space depth 178 179 float3 viewDir = Interpol(IN.texCoord.xy, bl, br, tl, tr);//IN.view; 180 const float eyeDepth = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)).w; 181 182 float3 centerPosition; 184 183 centerPosition.xyz = eyePos - viewDir * eyeDepth; 185 186 centerPosition.w = centerPosition2.w; 187 188 // the current color 189 const float4 currentCol = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 190 // the current depth is stored in the w component 191 const float currentDepth = centerPosition.w; 192 193 GiStruct gi = globIllum(IN, colors, noiseTexture, samples, normal, centerPosition2, w, eyePos, bl, br, tl, tr); 184 185 //const float3 centerPosition = tex2D(positions, IN.texCoord.xy).xyz; 186 187 188 /////////// 189 //-- compute color bleeding + ao 190 191 GiStruct gi = globIllum(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 194 192 195 193 … … 197 195 //-- compute temporally smoothing 198 196 199 float4 realPos = centerPosition * maxDepth; 200 realPos.w = 1.0f; 201 202 float4 oldPos = mul(oldModelViewProj, realPos); 203 204 const float newDepth = oldPos.z / oldPos.w; 205 206 float2 tex = (oldPos.xy / oldPos.w) * 0.5f + 0.5f; 207 197 float4 realPos = float4(centerPosition * maxDepth, 1.0f); 198 199 200 // calculcate the current projected depth for next frame 201 float4 currentPos = mul(modelViewProj, realPos); 202 currentPos /= currentPos.w; 203 const float currentDepth = currentPos.z; 204 205 206 /////////// 207 //-- reprojection new frame into old one 208 209 // calculate projected depth 210 float4 projPos = mul(oldModelViewProj, realPos); 211 projPos /= projPos.w; 212 213 // the current depth projected into the old frame 214 const float projDepth = projPos.z; 215 216 // fit from unit cube into 0 .. 1 217 float2 tex = (projPos.xy) * 0.5f + 0.5f; 218 219 // retrieve the sample from the last frame 208 220 float4 oldSsao = tex2D(oldSsaoTex, tex); 209 221 float4 oldIllum = tex2D(oldIllumTex, tex); 210 222 211 223 const float oldDepth = oldSsao.w; 212 const float depthDif = 1.0f - newDepth / oldDepth;224 const float depthDif = 1.0f - projDepth / oldDepth; 213 225 214 226 float oldWeight = clamp(oldSsao.z, 0, temporalCoherence); 227 215 228 float newWeight; 216 229 217 const float oldNumSamples = oldSsao.y;218 const float oldAvgDepth = oldSsao.z;230 //const float oldNumSamples = oldSsao.y; 231 //const float oldAvgDepth = oldSsao.z; 219 232 220 233 if (//(temporalCoherence > 0.0f) && -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3005 r3006 6 6 7 7 8 #define USE_EYE_SPACE_DEPTH 08 #define USE_EYE_SPACE_DEPTH 1 9 9 10 10 … … 71 71 uniform float2 samples[NUM_SAMPLES], 72 72 uniform float3 currentNormal, 73 uniform float 4centerPosition,73 uniform float3 centerPosition, 74 74 uniform float scaleFactor, 75 75 uniform float3 eyePos, … … 161 161 pixel OUT; 162 162 163 float4 norm = tex2D (normals, IN.texCoord.xy);163 float4 norm = tex2Dlod(normals, float4(IN.texCoord, 0 ,0)); 164 164 float3 normal = normalize(norm.xyz); 165 165 166 // a constant ambient term167 const float amb = norm.w;168 166 // the w coordinate from the persp. projection 169 167 float w = norm.w; … … 173 171 /// reconstruct position from the eye space depth 174 172 float3 viewDir = IN.view; 175 const float eyeDepth = tex2D (colors, IN.texCoord.xy).w;176 177 float 4centerPosition;173 const float eyeDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w; 174 175 float3 centerPosition; 178 176 centerPosition.xyz = eyePos - viewDir * eyeDepth; 179 centerPosition.w = centerPosition.w;180 177 181 178 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); … … 183 180 184 181 // the current world position 185 const float 4 centerPosition = tex2D(positions, IN.texCoord.xy);182 const float3 centerPosition = tex2Dlod(positions, float4(IN.texCoord, 0, 0)).xyz; 186 183 187 184 const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); … … 192 189 //-- compute temporally smoothing 193 190 194 float4 realPos = centerPosition * maxDepth; 195 realPos.w = 1.0f; 196 197 // calulcate the current depth 198 //const float currentDepth = centerPosition.w; 199 200 // apply modelview matrix 191 float4 realPos = float4(centerPosition * maxDepth, 1.0f); 192 193 194 // calculcate the current projected depth for next frame 201 195 float4 currentPos = mul(modelViewProj, realPos); 202 196 currentPos /= currentPos.w; … … 217 211 float2 tex = (projPos.xy) * 0.5f + 0.5f; 218 212 219 // optainthe sample from the last frame213 // retrieve the sample from the last frame 220 214 float4 oldCol = tex2D(oldTex, tex); 221 215 222 216 const float oldDepth = oldCol.w; 217 const float depthDif = 1.0f - projDepth / oldDepth; 218 219 223 220 //const float oldNumSamples = oldCol.y; 224 221 const float oldWeight = clamp(oldCol.z, 0, temporalCoherence); 225 226 const float depthDif = 1.0f - projDepth / oldDepth;227 222 228 223 float newWeight; … … 264 259 pixel OUT; 265 260 266 float4 col = tex2Dlod(colors, float4(IN.texCoord .xy, 0, 0));267 float4 ao = tex2D (ssaoTex, IN.texCoord.xy);261 float4 col = tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 262 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 268 263 269 264 OUT.illum_col = col * ao.x; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r3005 r3006 28 28 for(int i = 0; i < 4; ++ i) 29 29 { 30 average += tex2D (colors, IN.texCoord + downSampleOffs[i]);30 average += tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i],0,0)); 31 31 } 32 32 33 33 average *= 1.0f / 4.0f; 34 34 35 return tex2D(colors, IN.texCoord);//average;35 return average; 36 36 } 37 37
Note: See TracChangeset
for help on using the changeset viewer.