- Timestamp:
- 10/02/08 17:54:38 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2992 r2993 666 666 // generate mip map levels of position in order to improve texture lookup performance 667 667 //glBindTexture(GL_TEXTURE_2D, positionsTex); glGenerateMipmapEXT(GL_TEXTURE_2D); 668 668 //glBindTexture(GL_TEXTURE_2D, colorsTex); glGenerateMipmapEXT(GL_TEXTURE_2D); 669 669 670 // read the second buffer, write to the first buffer 670 671 mFbo->Bind(); … … 1200 1201 middleGrey = lightIntensity * maxKey + (1.0f - lightIntensity) * minKey; 1201 1202 1203 1202 1204 #if 1 1203 1205 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2992 r2993 48 48 float3 bl, float3 br, float3 tl, float3 tr) 49 49 { 50 #if 0 50 51 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 51 52 float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 52 53 53 54 float3 sample_position = eyePos - rotView * eyeSpaceDepth; 54 //float3 sample_position = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 55 55 #else 56 float3 sample_position = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 57 #endif 56 58 return sample_position; 57 59 } … … 67 69 uniform float4 centerPosition, 68 70 uniform float scaleFactor, 69 //uniform float3 viewDir,70 71 uniform float3 eyePos, 71 72 uniform float3 bl, … … 73 74 uniform float3 tl, 74 75 uniform float3 tr 76 //, uniform float3 viewDir 75 77 ) 76 78 { … … 159 161 // the w coordinate from the persp. projection 160 162 float w = norm.w; 163 164 #if 1 161 165 // the current world position 162 166 const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 163 164 /* 165 /// the current view direction 167 const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 168 169 #else 170 /// reconstruct position from the eye space depth 166 171 float3 viewDir = normalize(IN.view); 167 172 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 168 float4 centerPosition2; 169 centerPosition2.xyz = eyePos - view2 * eyeDepth; 170 */ 173 float4 centerPosition; 174 centerPosition.xyz = eyePos - viewDir * eyeDepth; 175 176 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 177 178 #endif 171 179 172 180 // the current depth 173 181 const float currentDepth = centerPosition.w; 174 175 //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 176 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 177 182 178 183 179 184 ///////////////// … … 185 190 186 191 /////////// 187 //-- reprojection from new frame into old one 192 //-- reprojection from new frame into old one 193 194 // note: could be done using eye space depth values 195 // by storing the position from last frame and the old model view matrix 188 196 189 197 float4 oldPos = mul(oldModelViewProj, realPos); … … 202 210 float newWeight; 203 211 204 float newNumSamples = ao.y; 212 // the number of valid samples in this frame 213 const float newNumSamples = ao.y; 205 214 206 215 if (//(temporalCoherence > 0) &&
Note: See TracChangeset
for help on using the changeset viewer.