- Timestamp:
- 11/02/08 18:47:23 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3087 r3088 261 261 for (int i = 0; i < 4; ++ i) 262 262 { 263 mIllumFbo->AddColorBuffer(ColorBufferObject::RGB _FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);263 mIllumFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 264 264 InitBuffer(mIllumFbo, i); 265 265 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3087 r3088 42 42 #define MAX_LOD_LEVEL 10 43 43 44 #define MIN_DEPTH_DIFF 1e- 1f44 #define MIN_DEPTH_DIFF 1e-2f 45 45 #define PRECISION_SCALE 1e-1f 46 46 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3087 r3088 54 54 float3 bl, float3 br, float3 tl, float3 tr) 55 55 { 56 const float eyeSpaceDepth = tex2D lod(tex, float4(texcoord, 0, 0)).w;56 const float eyeSpaceDepth = tex2D(tex, texcoord).w; 57 57 float3 viewVec = Interpol(texcoord, bl, br, tl, tr); 58 58 float3 samplePos = -viewVec * eyeSpaceDepth; … … 80 80 uniform float3 oldbr, 81 81 uniform float3 oldtl, 82 uniform float3 oldtr ,83 float dummy382 uniform float3 oldtr 83 // float dummy3 84 84 ) 85 85 { … … 98 98 99 99 // retrieve the sample from the last frame 100 float4 oldCol = tex2D lod(oldTex, float4(oldTexCoords, 0, 0));101 102 float oldEyeSpaceDepth = oldCol. z/ dummy3;100 float4 oldCol = tex2D(oldTex, oldTexCoords); 101 102 float oldEyeSpaceDepth = oldCol.w;// dummy3; 103 103 float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 104 104 float3 oldSamplePos = oldEyePos - viewVec * oldEyeSpaceDepth; … … 115 115 float4 temporalSmoothing(float4 currentProjPos, 116 116 float4 worldPos, 117 float currentDepth,118 117 uniform sampler2D oldTex, 119 118 const uniform float4x4 oldModelViewProj, … … 151 150 152 151 // retrieve the sample from the last frame 153 float4 oldCol = tex2Dlod(oldTex, float4(oldTexCoords, 0, 0)); 152 //float4 oldCol = tex2Dlod(oldTex, float4(oldTexCoords, 0, 0)); 153 float4 oldCol = tex2D(oldTex, oldTexCoords); 154 154 155 155 //eyeSpaceDepth = 1e6f; 156 156 157 const float dummy3 = 1e-4f;157 //const float dummy3 = 1e-4f; 158 158 //const float oldEyeSpaceDepth = 1e5f * dummy3; 159 const float oldEyeSpaceDepth = oldCol.z / dummy3; 159 //const float oldEyeSpaceDepth = oldCol.z / dummy3; 160 const float oldEyeSpaceDepth = oldCol.w; 160 161 161 162 //oldTexCoords.x += 0.5f / 1024.0f; oldTexCoords.y += 0.5f / 768.0f; … … 167 168 //const float oldDepth = oldCol.z; 168 169 const float depthDif = length(oldSamplePos - worldPos.xyz); 169 eyeSpaceDepth *= dummy3;170 //eyeSpaceDepth *= dummy3; 170 171 171 172 //const float depthDif = abs(oldEyeSpaceDepth - eyeSpaceDepth);// * 1e4f; … … 190 191 eyePos, 191 192 oldEyePos, 192 oldbl, oldbr, oldtl, oldtr, 193 dummy3); 194 195 if (sampleDif > MIN_DEPTH_DIFF) isValid = false; 193 oldbl, oldbr, oldtl, oldtr 194 //,dummy3 195 ); 196 197 //if (sampleDif > 1e-1f) isValid = false; 196 198 } 197 199 … … 224 226 //illum_col.y = isValid / 16.0f; 225 227 illum_col.y = newWeight; 226 illum_col. z= eyeSpaceDepth;228 illum_col.w = eyeSpaceDepth; 227 229 //illum_col.z = dummy2; 228 230 … … 336 338 // reconstruct position from the eye space depth 337 339 const float3 viewDir = IN.view; 338 const float eye Depth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w;339 const float3 eyeSpacePos = -viewDir * eye Depth;340 const float eyeSpaceDepth = tex2D(colors, IN.texCoord).w; 341 const float3 eyeSpacePos = -viewDir * eyeSpaceDepth; 340 342 const float4 worldPos = float4(eyePos + eyeSpacePos, 1.0f); 341 343 … … 350 352 w *= SAMPLE_RADIUS; 351 353 352 const float currentDepth = projPos.z * PRECISION_SCALE;353 354 354 const float2 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos, w, bl, br, tl, tr, normalize(viewDir)); 355 355 … … 358 358 //-- compute temporally smoothing 359 359 360 OUT.illum_col = temporalSmoothing(projPos, worldPos, currentDepth,oldTex, oldModelViewProj, temporalCoherence, ao,361 samples, colors, noiseTex, w, bl, br, tl, tr, IN.texCoord, eyePos, eye Depth,360 OUT.illum_col = temporalSmoothing(projPos, worldPos, oldTex, oldModelViewProj, temporalCoherence, ao, 361 samples, colors, noiseTex, w, bl, br, tl, tr, IN.texCoord, eyePos, eyeSpaceDepth, 362 362 oldEyePos, oldbl, oldbr, oldtl, oldtr); 363 363 … … 402 402 // ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights); 403 403 404 OUT.illum_col = col * ao.x;405 //OUT.illum_col = float4(ao.x, ao.x, ao.x, col.w);404 //OUT.illum_col = col * ao.x; 405 OUT.illum_col = float4(ao.x, ao.x, ao.x, col.w); 406 406 //OUT.illum_col.xyz = float3(1.0f - ao.x, 1.0f - ao.y * 1e-2f, 1); 407 407 //OUT.illum_col.xyz = float3(1.0f - ao.x, ao.y, 0);
Note: See TracChangeset
for help on using the changeset viewer.